# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
84669 | 2018-11-16T12:54:37 Z | wjoao | Kronican (COCI16_kronican) | C++11 | 2000 ms | 648 KB |
#include<bits/stdc++.h> #define maxn 25 #define maxn2 ((1<<21)+5) #define inf 0x3f3f3f3f using namespace std; int ma[maxn][maxn], pd[maxn2][maxn], n, k; int solve(int bitmask, int v, int count){ if(count >= k+1) return 0; int sol = inf; for(int i = 1; i <= n; i++){ if(bitmask & (1<<i)) continue; sol = min(sol, ma[v][i] + solve(bitmask|(1<<i), i, count+1) ); } return sol; } int main(){ scanf(" %d %d", &n, &k); k = n-k; for(int i = 1; i <= n; i++) for(int j = 1; j <= n; j++ ) scanf("%d", &ma[i][j]); for(int i = 1; i <= n; i++) for(int j = 1; j <= n; j++ ) ma[i][j] = min(ma[i][j], ma[j][i]); printf("%d\n", solve(1, 0, 0)); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 3 ms | 472 KB | Output isn't correct |
3 | Incorrect | 6 ms | 472 KB | Output isn't correct |
4 | Incorrect | 150 ms | 472 KB | Output isn't correct |
5 | Execution timed out | 2050 ms | 560 KB | Time limit exceeded |
6 | Execution timed out | 2050 ms | 560 KB | Time limit exceeded |
7 | Execution timed out | 2072 ms | 604 KB | Time limit exceeded |
8 | Execution timed out | 2060 ms | 604 KB | Time limit exceeded |
9 | Execution timed out | 2058 ms | 648 KB | Time limit exceeded |
10 | Execution timed out | 2062 ms | 648 KB | Time limit exceeded |