Submission #1114342

# Submission time Handle Problem Language Result Execution time Memory
1114342 2024-11-18T15:48:02 Z SalihSahin Netrpeljivost (COI23_netrpeljivost) C++14
100 / 100
422 ms 101964 KB
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
 
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);
 
	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++){
          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;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6480 KB Output is correct
2 Correct 1 ms 6480 KB Output is correct
3 Correct 2 ms 6616 KB Output is correct
4 Correct 2 ms 6480 KB Output is correct
5 Correct 2 ms 6480 KB Output is correct
6 Correct 1 ms 6648 KB Output is correct
7 Correct 2 ms 6480 KB Output is correct
8 Correct 1 ms 6480 KB Output is correct
9 Correct 2 ms 6480 KB Output is correct
10 Correct 2 ms 6480 KB Output is correct
11 Correct 2 ms 6480 KB Output is correct
12 Correct 2 ms 6492 KB Output is correct
13 Correct 2 ms 6648 KB Output is correct
14 Correct 2 ms 6480 KB Output is correct
15 Correct 2 ms 6480 KB Output is correct
16 Correct 2 ms 6480 KB Output is correct
17 Correct 1 ms 6484 KB Output is correct
18 Correct 1 ms 6480 KB Output is correct
19 Correct 2 ms 6480 KB Output is correct
20 Correct 2 ms 6480 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6480 KB Output is correct
2 Correct 1 ms 6480 KB Output is correct
3 Correct 2 ms 6616 KB Output is correct
4 Correct 2 ms 6480 KB Output is correct
5 Correct 2 ms 6480 KB Output is correct
6 Correct 1 ms 6648 KB Output is correct
7 Correct 2 ms 6480 KB Output is correct
8 Correct 1 ms 6480 KB Output is correct
9 Correct 2 ms 6480 KB Output is correct
10 Correct 2 ms 6480 KB Output is correct
11 Correct 2 ms 6480 KB Output is correct
12 Correct 2 ms 6492 KB Output is correct
13 Correct 2 ms 6648 KB Output is correct
14 Correct 2 ms 6480 KB Output is correct
15 Correct 2 ms 6480 KB Output is correct
16 Correct 2 ms 6480 KB Output is correct
17 Correct 1 ms 6484 KB Output is correct
18 Correct 1 ms 6480 KB Output is correct
19 Correct 2 ms 6480 KB Output is correct
20 Correct 2 ms 6480 KB Output is correct
21 Correct 3 ms 6736 KB Output is correct
22 Correct 3 ms 6736 KB Output is correct
23 Correct 3 ms 6736 KB Output is correct
24 Correct 2 ms 6708 KB Output is correct
25 Correct 2 ms 6480 KB Output is correct
26 Correct 2 ms 6736 KB Output is correct
27 Correct 3 ms 6736 KB Output is correct
28 Correct 3 ms 6632 KB Output is correct
29 Correct 3 ms 6736 KB Output is correct
30 Correct 3 ms 6776 KB Output is correct
31 Correct 3 ms 6736 KB Output is correct
32 Correct 3 ms 6736 KB Output is correct
33 Correct 3 ms 6736 KB Output is correct
34 Correct 3 ms 6736 KB Output is correct
35 Correct 3 ms 6624 KB Output is correct
36 Correct 3 ms 6736 KB Output is correct
37 Correct 3 ms 6736 KB Output is correct
38 Correct 3 ms 6736 KB Output is correct
39 Correct 3 ms 6736 KB Output is correct
40 Correct 3 ms 6736 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6480 KB Output is correct
2 Correct 1 ms 6480 KB Output is correct
3 Correct 2 ms 6616 KB Output is correct
4 Correct 2 ms 6480 KB Output is correct
5 Correct 2 ms 6480 KB Output is correct
6 Correct 1 ms 6648 KB Output is correct
7 Correct 2 ms 6480 KB Output is correct
8 Correct 1 ms 6480 KB Output is correct
9 Correct 2 ms 6480 KB Output is correct
10 Correct 2 ms 6480 KB Output is correct
11 Correct 2 ms 6480 KB Output is correct
12 Correct 2 ms 6492 KB Output is correct
13 Correct 2 ms 6648 KB Output is correct
14 Correct 2 ms 6480 KB Output is correct
15 Correct 2 ms 6480 KB Output is correct
16 Correct 2 ms 6480 KB Output is correct
17 Correct 1 ms 6484 KB Output is correct
18 Correct 1 ms 6480 KB Output is correct
19 Correct 2 ms 6480 KB Output is correct
20 Correct 2 ms 6480 KB Output is correct
21 Correct 3 ms 6736 KB Output is correct
22 Correct 3 ms 6736 KB Output is correct
23 Correct 3 ms 6736 KB Output is correct
24 Correct 2 ms 6708 KB Output is correct
25 Correct 2 ms 6480 KB Output is correct
26 Correct 2 ms 6736 KB Output is correct
27 Correct 3 ms 6736 KB Output is correct
28 Correct 3 ms 6632 KB Output is correct
29 Correct 3 ms 6736 KB Output is correct
30 Correct 3 ms 6776 KB Output is correct
31 Correct 3 ms 6736 KB Output is correct
32 Correct 3 ms 6736 KB Output is correct
33 Correct 3 ms 6736 KB Output is correct
34 Correct 3 ms 6736 KB Output is correct
35 Correct 3 ms 6624 KB Output is correct
36 Correct 3 ms 6736 KB Output is correct
37 Correct 3 ms 6736 KB Output is correct
38 Correct 3 ms 6736 KB Output is correct
39 Correct 3 ms 6736 KB Output is correct
40 Correct 3 ms 6736 KB Output is correct
41 Correct 28 ms 21328 KB Output is correct
42 Correct 25 ms 20196 KB Output is correct
43 Correct 26 ms 19024 KB Output is correct
44 Correct 28 ms 16976 KB Output is correct
45 Correct 26 ms 20040 KB Output is correct
46 Correct 25 ms 19024 KB Output is correct
47 Correct 31 ms 19016 KB Output is correct
48 Correct 28 ms 21072 KB Output is correct
49 Correct 23 ms 20060 KB Output is correct
50 Correct 24 ms 19124 KB Output is correct
51 Correct 24 ms 16968 KB Output is correct
52 Correct 23 ms 19016 KB Output is correct
53 Correct 23 ms 20048 KB Output is correct
54 Correct 22 ms 21320 KB Output is correct
55 Correct 24 ms 21328 KB Output is correct
56 Correct 23 ms 21328 KB Output is correct
57 Correct 23 ms 21064 KB Output is correct
58 Correct 24 ms 21328 KB Output is correct
59 Correct 22 ms 21488 KB Output is correct
60 Correct 27 ms 19092 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6480 KB Output is correct
2 Correct 1 ms 6480 KB Output is correct
3 Correct 2 ms 6616 KB Output is correct
4 Correct 2 ms 6480 KB Output is correct
5 Correct 2 ms 6480 KB Output is correct
6 Correct 1 ms 6648 KB Output is correct
7 Correct 2 ms 6480 KB Output is correct
8 Correct 1 ms 6480 KB Output is correct
9 Correct 2 ms 6480 KB Output is correct
10 Correct 2 ms 6480 KB Output is correct
11 Correct 2 ms 6480 KB Output is correct
12 Correct 2 ms 6492 KB Output is correct
13 Correct 2 ms 6648 KB Output is correct
14 Correct 2 ms 6480 KB Output is correct
15 Correct 2 ms 6480 KB Output is correct
16 Correct 2 ms 6480 KB Output is correct
17 Correct 1 ms 6484 KB Output is correct
18 Correct 1 ms 6480 KB Output is correct
19 Correct 2 ms 6480 KB Output is correct
20 Correct 2 ms 6480 KB Output is correct
21 Correct 3 ms 6736 KB Output is correct
22 Correct 3 ms 6736 KB Output is correct
23 Correct 3 ms 6736 KB Output is correct
24 Correct 2 ms 6708 KB Output is correct
25 Correct 2 ms 6480 KB Output is correct
26 Correct 2 ms 6736 KB Output is correct
27 Correct 3 ms 6736 KB Output is correct
28 Correct 3 ms 6632 KB Output is correct
29 Correct 3 ms 6736 KB Output is correct
30 Correct 3 ms 6776 KB Output is correct
31 Correct 3 ms 6736 KB Output is correct
32 Correct 3 ms 6736 KB Output is correct
33 Correct 3 ms 6736 KB Output is correct
34 Correct 3 ms 6736 KB Output is correct
35 Correct 3 ms 6624 KB Output is correct
36 Correct 3 ms 6736 KB Output is correct
37 Correct 3 ms 6736 KB Output is correct
38 Correct 3 ms 6736 KB Output is correct
39 Correct 3 ms 6736 KB Output is correct
40 Correct 3 ms 6736 KB Output is correct
41 Correct 28 ms 21328 KB Output is correct
42 Correct 25 ms 20196 KB Output is correct
43 Correct 26 ms 19024 KB Output is correct
44 Correct 28 ms 16976 KB Output is correct
45 Correct 26 ms 20040 KB Output is correct
46 Correct 25 ms 19024 KB Output is correct
47 Correct 31 ms 19016 KB Output is correct
48 Correct 28 ms 21072 KB Output is correct
49 Correct 23 ms 20060 KB Output is correct
50 Correct 24 ms 19124 KB Output is correct
51 Correct 24 ms 16968 KB Output is correct
52 Correct 23 ms 19016 KB Output is correct
53 Correct 23 ms 20048 KB Output is correct
54 Correct 22 ms 21320 KB Output is correct
55 Correct 24 ms 21328 KB Output is correct
56 Correct 23 ms 21328 KB Output is correct
57 Correct 23 ms 21064 KB Output is correct
58 Correct 24 ms 21328 KB Output is correct
59 Correct 22 ms 21488 KB Output is correct
60 Correct 27 ms 19092 KB Output is correct
61 Correct 415 ms 96840 KB Output is correct
62 Correct 415 ms 96676 KB Output is correct
63 Correct 422 ms 101824 KB Output is correct
64 Correct 388 ms 96740 KB Output is correct
65 Correct 401 ms 101964 KB Output is correct
66 Correct 378 ms 86636 KB Output is correct
67 Correct 366 ms 86572 KB Output is correct
68 Correct 389 ms 96344 KB Output is correct
69 Correct 348 ms 86528 KB Output is correct
70 Correct 368 ms 96704 KB Output is correct
71 Correct 351 ms 86856 KB Output is correct
72 Correct 370 ms 87028 KB Output is correct
73 Correct 349 ms 86856 KB Output is correct
74 Correct 372 ms 66120 KB Output is correct
75 Correct 408 ms 90712 KB Output is correct
76 Correct 406 ms 86780 KB Output is correct
77 Correct 372 ms 86788 KB Output is correct
78 Correct 390 ms 66124 KB Output is correct
79 Correct 399 ms 96764 KB Output is correct
80 Correct 421 ms 96880 KB Output is correct