# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1026563 | 2024-07-18T07:59:53 Z | vjudge1 | Netrpeljivost (COI23_netrpeljivost) | C++17 | 359 ms | 107348 KB |
#include <bits/stdc++.h> using namespace std; #define int long long void f(){ #ifndef ONLINE_JUDGE freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); #endif } int dp[1<<11][(1<<11)+1]; int d[(1<<11)+1][(1<<11)+1]; signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); //f(); int n; cin >> n; for(int i=0; i<=n; i++){ for(int j=0; j<n; j++){ dp[j][i]=1e18; } dp[0][i]=0; } for(int i=0; i<n; i++){ for(int l=0; l<n; l++) cin >> d[i][l]; } for(int i=1; i<n; i++){ int c=0, val=i; int f=0; for(int h=0; h<11; h++){ if(val&(1<<h)){ c=h; break; } } for(int h=c; h<=11; h++){ f+=(1<<h); } for(int g=0; g<n; g++){ if(g&(1<<c)){ int h = g^(1<<c); h&=f; for(int l=0; l<(1<<c); l++){ dp[i][h+l]=min(dp[i][h+l], dp[i-1][g]+d[g][h+l]); } } else{ int h = g^(1<<c); h&=f; for(int l=0; l<(1<<c); l++){ dp[i][h+l]=min(dp[i][h+l], dp[i-1][g]+d[g][h+l]); } } } } int mi=1e18; for(int l=0; l<n; l++) mi=min(mi, dp[n-1][l]); cout<<mi; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 6492 KB | Output is correct |
2 | Correct | 1 ms | 6492 KB | Output is correct |
3 | Correct | 1 ms | 6492 KB | Output is correct |
4 | Correct | 1 ms | 6492 KB | Output is correct |
5 | Correct | 1 ms | 6492 KB | Output is correct |
6 | Correct | 1 ms | 6492 KB | Output is correct |
7 | Correct | 1 ms | 6492 KB | Output is correct |
8 | Correct | 1 ms | 6492 KB | Output is correct |
9 | Correct | 1 ms | 6492 KB | Output is correct |
10 | Correct | 1 ms | 6492 KB | Output is correct |
11 | Correct | 1 ms | 6492 KB | Output is correct |
12 | Correct | 1 ms | 6492 KB | Output is correct |
13 | Correct | 1 ms | 6492 KB | Output is correct |
14 | Correct | 1 ms | 6492 KB | Output is correct |
15 | Correct | 1 ms | 6492 KB | Output is correct |
16 | Correct | 1 ms | 6492 KB | Output is correct |
17 | Correct | 1 ms | 6492 KB | Output is correct |
18 | Correct | 1 ms | 6492 KB | Output is correct |
19 | Correct | 1 ms | 6492 KB | Output is correct |
20 | Correct | 1 ms | 6612 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 6492 KB | Output is correct |
2 | Correct | 1 ms | 6492 KB | Output is correct |
3 | Correct | 1 ms | 6492 KB | Output is correct |
4 | Correct | 1 ms | 6492 KB | Output is correct |
5 | Correct | 1 ms | 6492 KB | Output is correct |
6 | Correct | 1 ms | 6492 KB | Output is correct |
7 | Correct | 1 ms | 6492 KB | Output is correct |
8 | Correct | 1 ms | 6492 KB | Output is correct |
9 | Correct | 1 ms | 6492 KB | Output is correct |
10 | Correct | 1 ms | 6492 KB | Output is correct |
11 | Correct | 1 ms | 6492 KB | Output is correct |
12 | Correct | 1 ms | 6492 KB | Output is correct |
13 | Correct | 1 ms | 6492 KB | Output is correct |
14 | Correct | 1 ms | 6492 KB | Output is correct |
15 | Correct | 1 ms | 6492 KB | Output is correct |
16 | Correct | 1 ms | 6492 KB | Output is correct |
17 | Correct | 1 ms | 6492 KB | Output is correct |
18 | Correct | 1 ms | 6492 KB | Output is correct |
19 | Correct | 1 ms | 6492 KB | Output is correct |
20 | Correct | 1 ms | 6612 KB | Output is correct |
21 | Correct | 2 ms | 6748 KB | Output is correct |
22 | Correct | 2 ms | 6748 KB | Output is correct |
23 | Correct | 2 ms | 6748 KB | Output is correct |
24 | Correct | 1 ms | 6492 KB | Output is correct |
25 | Correct | 1 ms | 6492 KB | Output is correct |
26 | Correct | 2 ms | 6748 KB | Output is correct |
27 | Correct | 2 ms | 6748 KB | Output is correct |
28 | Correct | 2 ms | 6748 KB | Output is correct |
29 | Correct | 2 ms | 6748 KB | Output is correct |
30 | Correct | 2 ms | 6776 KB | Output is correct |
31 | Correct | 2 ms | 6748 KB | Output is correct |
32 | Correct | 2 ms | 6748 KB | Output is correct |
33 | Correct | 2 ms | 6632 KB | Output is correct |
34 | Correct | 2 ms | 6748 KB | Output is correct |
35 | Correct | 2 ms | 6748 KB | Output is correct |
36 | Correct | 2 ms | 6748 KB | Output is correct |
37 | Correct | 2 ms | 6748 KB | Output is correct |
38 | Correct | 2 ms | 6748 KB | Output is correct |
39 | Correct | 2 ms | 6748 KB | Output is correct |
40 | Correct | 2 ms | 6748 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 6492 KB | Output is correct |
2 | Correct | 1 ms | 6492 KB | Output is correct |
3 | Correct | 1 ms | 6492 KB | Output is correct |
4 | Correct | 1 ms | 6492 KB | Output is correct |
5 | Correct | 1 ms | 6492 KB | Output is correct |
6 | Correct | 1 ms | 6492 KB | Output is correct |
7 | Correct | 1 ms | 6492 KB | Output is correct |
8 | Correct | 1 ms | 6492 KB | Output is correct |
9 | Correct | 1 ms | 6492 KB | Output is correct |
10 | Correct | 1 ms | 6492 KB | Output is correct |
11 | Correct | 1 ms | 6492 KB | Output is correct |
12 | Correct | 1 ms | 6492 KB | Output is correct |
13 | Correct | 1 ms | 6492 KB | Output is correct |
14 | Correct | 1 ms | 6492 KB | Output is correct |
15 | Correct | 1 ms | 6492 KB | Output is correct |
16 | Correct | 1 ms | 6492 KB | Output is correct |
17 | Correct | 1 ms | 6492 KB | Output is correct |
18 | Correct | 1 ms | 6492 KB | Output is correct |
19 | Correct | 1 ms | 6492 KB | Output is correct |
20 | Correct | 1 ms | 6612 KB | Output is correct |
21 | Correct | 2 ms | 6748 KB | Output is correct |
22 | Correct | 2 ms | 6748 KB | Output is correct |
23 | Correct | 2 ms | 6748 KB | Output is correct |
24 | Correct | 1 ms | 6492 KB | Output is correct |
25 | Correct | 1 ms | 6492 KB | Output is correct |
26 | Correct | 2 ms | 6748 KB | Output is correct |
27 | Correct | 2 ms | 6748 KB | Output is correct |
28 | Correct | 2 ms | 6748 KB | Output is correct |
29 | Correct | 2 ms | 6748 KB | Output is correct |
30 | Correct | 2 ms | 6776 KB | Output is correct |
31 | Correct | 2 ms | 6748 KB | Output is correct |
32 | Correct | 2 ms | 6748 KB | Output is correct |
33 | Correct | 2 ms | 6632 KB | Output is correct |
34 | Correct | 2 ms | 6748 KB | Output is correct |
35 | Correct | 2 ms | 6748 KB | Output is correct |
36 | Correct | 2 ms | 6748 KB | Output is correct |
37 | Correct | 2 ms | 6748 KB | Output is correct |
38 | Correct | 2 ms | 6748 KB | Output is correct |
39 | Correct | 2 ms | 6748 KB | Output is correct |
40 | Correct | 2 ms | 6748 KB | Output is correct |
41 | Correct | 23 ms | 21340 KB | Output is correct |
42 | Correct | 20 ms | 21340 KB | Output is correct |
43 | Correct | 20 ms | 21340 KB | Output is correct |
44 | Correct | 20 ms | 21340 KB | Output is correct |
45 | Correct | 20 ms | 21436 KB | Output is correct |
46 | Correct | 20 ms | 21340 KB | Output is correct |
47 | Correct | 20 ms | 21304 KB | Output is correct |
48 | Correct | 21 ms | 21436 KB | Output is correct |
49 | Correct | 21 ms | 21340 KB | Output is correct |
50 | Correct | 22 ms | 21472 KB | Output is correct |
51 | Correct | 21 ms | 21340 KB | Output is correct |
52 | Correct | 21 ms | 21340 KB | Output is correct |
53 | Correct | 20 ms | 21340 KB | Output is correct |
54 | Correct | 20 ms | 21340 KB | Output is correct |
55 | Correct | 20 ms | 21564 KB | Output is correct |
56 | Correct | 20 ms | 21436 KB | Output is correct |
57 | Correct | 20 ms | 21440 KB | Output is correct |
58 | Correct | 22 ms | 21332 KB | Output is correct |
59 | Correct | 21 ms | 21332 KB | Output is correct |
60 | Correct | 20 ms | 21340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 6492 KB | Output is correct |
2 | Correct | 1 ms | 6492 KB | Output is correct |
3 | Correct | 1 ms | 6492 KB | Output is correct |
4 | Correct | 1 ms | 6492 KB | Output is correct |
5 | Correct | 1 ms | 6492 KB | Output is correct |
6 | Correct | 1 ms | 6492 KB | Output is correct |
7 | Correct | 1 ms | 6492 KB | Output is correct |
8 | Correct | 1 ms | 6492 KB | Output is correct |
9 | Correct | 1 ms | 6492 KB | Output is correct |
10 | Correct | 1 ms | 6492 KB | Output is correct |
11 | Correct | 1 ms | 6492 KB | Output is correct |
12 | Correct | 1 ms | 6492 KB | Output is correct |
13 | Correct | 1 ms | 6492 KB | Output is correct |
14 | Correct | 1 ms | 6492 KB | Output is correct |
15 | Correct | 1 ms | 6492 KB | Output is correct |
16 | Correct | 1 ms | 6492 KB | Output is correct |
17 | Correct | 1 ms | 6492 KB | Output is correct |
18 | Correct | 1 ms | 6492 KB | Output is correct |
19 | Correct | 1 ms | 6492 KB | Output is correct |
20 | Correct | 1 ms | 6612 KB | Output is correct |
21 | Correct | 2 ms | 6748 KB | Output is correct |
22 | Correct | 2 ms | 6748 KB | Output is correct |
23 | Correct | 2 ms | 6748 KB | Output is correct |
24 | Correct | 1 ms | 6492 KB | Output is correct |
25 | Correct | 1 ms | 6492 KB | Output is correct |
26 | Correct | 2 ms | 6748 KB | Output is correct |
27 | Correct | 2 ms | 6748 KB | Output is correct |
28 | Correct | 2 ms | 6748 KB | Output is correct |
29 | Correct | 2 ms | 6748 KB | Output is correct |
30 | Correct | 2 ms | 6776 KB | Output is correct |
31 | Correct | 2 ms | 6748 KB | Output is correct |
32 | Correct | 2 ms | 6748 KB | Output is correct |
33 | Correct | 2 ms | 6632 KB | Output is correct |
34 | Correct | 2 ms | 6748 KB | Output is correct |
35 | Correct | 2 ms | 6748 KB | Output is correct |
36 | Correct | 2 ms | 6748 KB | Output is correct |
37 | Correct | 2 ms | 6748 KB | Output is correct |
38 | Correct | 2 ms | 6748 KB | Output is correct |
39 | Correct | 2 ms | 6748 KB | Output is correct |
40 | Correct | 2 ms | 6748 KB | Output is correct |
41 | Correct | 23 ms | 21340 KB | Output is correct |
42 | Correct | 20 ms | 21340 KB | Output is correct |
43 | Correct | 20 ms | 21340 KB | Output is correct |
44 | Correct | 20 ms | 21340 KB | Output is correct |
45 | Correct | 20 ms | 21436 KB | Output is correct |
46 | Correct | 20 ms | 21340 KB | Output is correct |
47 | Correct | 20 ms | 21304 KB | Output is correct |
48 | Correct | 21 ms | 21436 KB | Output is correct |
49 | Correct | 21 ms | 21340 KB | Output is correct |
50 | Correct | 22 ms | 21472 KB | Output is correct |
51 | Correct | 21 ms | 21340 KB | Output is correct |
52 | Correct | 21 ms | 21340 KB | Output is correct |
53 | Correct | 20 ms | 21340 KB | Output is correct |
54 | Correct | 20 ms | 21340 KB | Output is correct |
55 | Correct | 20 ms | 21564 KB | Output is correct |
56 | Correct | 20 ms | 21436 KB | Output is correct |
57 | Correct | 20 ms | 21440 KB | Output is correct |
58 | Correct | 22 ms | 21332 KB | Output is correct |
59 | Correct | 21 ms | 21332 KB | Output is correct |
60 | Correct | 20 ms | 21340 KB | Output is correct |
61 | Correct | 313 ms | 106540 KB | Output is correct |
62 | Correct | 326 ms | 106308 KB | Output is correct |
63 | Correct | 331 ms | 106324 KB | Output is correct |
64 | Correct | 317 ms | 106456 KB | Output is correct |
65 | Correct | 319 ms | 106324 KB | Output is correct |
66 | Correct | 315 ms | 106580 KB | Output is correct |
67 | Correct | 327 ms | 106320 KB | Output is correct |
68 | Correct | 316 ms | 106308 KB | Output is correct |
69 | Correct | 359 ms | 106416 KB | Output is correct |
70 | Correct | 311 ms | 106324 KB | Output is correct |
71 | Correct | 322 ms | 107348 KB | Output is correct |
72 | Correct | 315 ms | 107052 KB | Output is correct |
73 | Correct | 309 ms | 107172 KB | Output is correct |
74 | Correct | 336 ms | 107144 KB | Output is correct |
75 | Correct | 312 ms | 107092 KB | Output is correct |
76 | Correct | 329 ms | 107184 KB | Output is correct |
77 | Correct | 334 ms | 107184 KB | Output is correct |
78 | Correct | 332 ms | 107092 KB | Output is correct |
79 | Correct | 323 ms | 107136 KB | Output is correct |
80 | Correct | 339 ms | 107092 KB | Output is correct |