diff --git a/src/week7/BOJ2098/BOJ2098_V1.cpp b/src/week7/BOJ2098/BOJ2098_V1.cpp new file mode 100644 index 0000000..d72daf8 --- /dev/null +++ b/src/week7/BOJ2098/BOJ2098_V1.cpp @@ -0,0 +1,41 @@ +#include +using namespace std; +int dist[16][16]; +int N; +int dp[16][1 << 16]; +int tsp(int here, int visited) { + if (visited == (1 << N)-1) + return dist[here][0] ? dist[here][0] : INT_MAX; + + int &ret = dp[here][visited]; + if (ret != -1) return ret; + ret = INT_MAX; + for (int i=0; i> N; + for (int i=0; i> dist[i][j]; + } + } + + memset(dp, -1, sizeof(dp)); + cout << tsp(0,1) << '\n'; + + + + return 0; +} \ No newline at end of file