Submission #936315

# Submission time Handle Problem Language Result Execution time Memory
936315 2024-03-01T15:00:13 Z Trisanu_Das Netrpeljivost (COI23_netrpeljivost) C++17
100 / 100
467 ms 90912 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
const int N = 2050;
const int INF = 0x3f3f3f3f;
 
int n, cst[N][N];
ll dp[N][N];
 
int main(){
	scanf("%d", &n);
	for(int i = 0;i < n;i++) for(int j = 0;j < n;j++) scanf("%d", &cst[i][j]);
	for(int p = 1;p < n;p++) {
		int ch = p & (-p);
		for(int z = 0;z < n;z++) {
			dp[p][z] = (ll)1e18;
			int zz = (z ^ ch) & (~(ch - 1));
			for(int t = zz;t < zz + ch;t++) dp[p][z] = min(dp[p][z], dp[p - 1][t] + cst[t][z]);
		}
	}
	ll sol = (ll)1e18;
	for(int i = 0;i < n;i++) sol = min(sol, dp[n - 1][i]);
	printf("%lld\n", sol);
	return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |  scanf("%d", &n);
      |  ~~~~~^~~~~~~~~~
Main.cpp:13:57: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |  for(int i = 0;i < n;i++) for(int j = 0;j < n;j++) scanf("%d", &cst[i][j]);
      |                                                    ~~~~~^~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6492 KB Output is correct
2 Correct 2 ms 6492 KB Output is correct
3 Correct 1 ms 6584 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 6588 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 6492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6492 KB Output is correct
2 Correct 2 ms 6492 KB Output is correct
3 Correct 1 ms 6584 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 6588 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 6492 KB Output is correct
21 Correct 3 ms 7000 KB Output is correct
22 Correct 2 ms 6748 KB Output is correct
23 Correct 2 ms 6748 KB Output is correct
24 Correct 2 ms 6636 KB Output is correct
25 Correct 1 ms 6492 KB Output is correct
26 Correct 3 ms 6748 KB Output is correct
27 Correct 2 ms 6748 KB Output is correct
28 Correct 3 ms 6800 KB Output is correct
29 Correct 3 ms 6748 KB Output is correct
30 Correct 2 ms 6748 KB Output is correct
31 Correct 2 ms 6748 KB Output is correct
32 Correct 3 ms 6748 KB Output is correct
33 Correct 3 ms 6748 KB Output is correct
34 Correct 3 ms 6748 KB Output is correct
35 Correct 2 ms 6744 KB Output is correct
36 Correct 3 ms 6704 KB Output is correct
37 Correct 2 ms 6748 KB Output is correct
38 Correct 3 ms 6748 KB Output is correct
39 Correct 3 ms 6748 KB Output is correct
40 Correct 3 ms 6800 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6492 KB Output is correct
2 Correct 2 ms 6492 KB Output is correct
3 Correct 1 ms 6584 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 6588 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 6492 KB Output is correct
21 Correct 3 ms 7000 KB Output is correct
22 Correct 2 ms 6748 KB Output is correct
23 Correct 2 ms 6748 KB Output is correct
24 Correct 2 ms 6636 KB Output is correct
25 Correct 1 ms 6492 KB Output is correct
26 Correct 3 ms 6748 KB Output is correct
27 Correct 2 ms 6748 KB Output is correct
28 Correct 3 ms 6800 KB Output is correct
29 Correct 3 ms 6748 KB Output is correct
30 Correct 2 ms 6748 KB Output is correct
31 Correct 2 ms 6748 KB Output is correct
32 Correct 3 ms 6748 KB Output is correct
33 Correct 3 ms 6748 KB Output is correct
34 Correct 3 ms 6748 KB Output is correct
35 Correct 2 ms 6744 KB Output is correct
36 Correct 3 ms 6704 KB Output is correct
37 Correct 2 ms 6748 KB Output is correct
38 Correct 3 ms 6748 KB Output is correct
39 Correct 3 ms 6748 KB Output is correct
40 Correct 3 ms 6800 KB Output is correct
41 Correct 26 ms 17244 KB Output is correct
42 Correct 26 ms 17188 KB Output is correct
43 Correct 32 ms 17328 KB Output is correct
44 Correct 26 ms 17352 KB Output is correct
45 Correct 26 ms 17244 KB Output is correct
46 Correct 27 ms 17204 KB Output is correct
47 Correct 26 ms 17240 KB Output is correct
48 Correct 33 ms 17456 KB Output is correct
49 Correct 34 ms 17236 KB Output is correct
50 Correct 26 ms 17244 KB Output is correct
51 Correct 26 ms 17192 KB Output is correct
52 Correct 27 ms 17244 KB Output is correct
53 Correct 27 ms 17244 KB Output is correct
54 Correct 25 ms 17236 KB Output is correct
55 Correct 26 ms 17440 KB Output is correct
56 Correct 26 ms 17200 KB Output is correct
57 Correct 25 ms 17204 KB Output is correct
58 Correct 25 ms 17436 KB Output is correct
59 Correct 26 ms 17244 KB Output is correct
60 Correct 25 ms 17328 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6492 KB Output is correct
2 Correct 2 ms 6492 KB Output is correct
3 Correct 1 ms 6584 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 6588 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 6492 KB Output is correct
21 Correct 3 ms 7000 KB Output is correct
22 Correct 2 ms 6748 KB Output is correct
23 Correct 2 ms 6748 KB Output is correct
24 Correct 2 ms 6636 KB Output is correct
25 Correct 1 ms 6492 KB Output is correct
26 Correct 3 ms 6748 KB Output is correct
27 Correct 2 ms 6748 KB Output is correct
28 Correct 3 ms 6800 KB Output is correct
29 Correct 3 ms 6748 KB Output is correct
30 Correct 2 ms 6748 KB Output is correct
31 Correct 2 ms 6748 KB Output is correct
32 Correct 3 ms 6748 KB Output is correct
33 Correct 3 ms 6748 KB Output is correct
34 Correct 3 ms 6748 KB Output is correct
35 Correct 2 ms 6744 KB Output is correct
36 Correct 3 ms 6704 KB Output is correct
37 Correct 2 ms 6748 KB Output is correct
38 Correct 3 ms 6748 KB Output is correct
39 Correct 3 ms 6748 KB Output is correct
40 Correct 3 ms 6800 KB Output is correct
41 Correct 26 ms 17244 KB Output is correct
42 Correct 26 ms 17188 KB Output is correct
43 Correct 32 ms 17328 KB Output is correct
44 Correct 26 ms 17352 KB Output is correct
45 Correct 26 ms 17244 KB Output is correct
46 Correct 27 ms 17204 KB Output is correct
47 Correct 26 ms 17240 KB Output is correct
48 Correct 33 ms 17456 KB Output is correct
49 Correct 34 ms 17236 KB Output is correct
50 Correct 26 ms 17244 KB Output is correct
51 Correct 26 ms 17192 KB Output is correct
52 Correct 27 ms 17244 KB Output is correct
53 Correct 27 ms 17244 KB Output is correct
54 Correct 25 ms 17236 KB Output is correct
55 Correct 26 ms 17440 KB Output is correct
56 Correct 26 ms 17200 KB Output is correct
57 Correct 25 ms 17204 KB Output is correct
58 Correct 25 ms 17436 KB Output is correct
59 Correct 26 ms 17244 KB Output is correct
60 Correct 25 ms 17328 KB Output is correct
61 Correct 409 ms 90548 KB Output is correct
62 Correct 404 ms 89896 KB Output is correct
63 Correct 466 ms 90200 KB Output is correct
64 Correct 442 ms 90108 KB Output is correct
65 Correct 401 ms 90012 KB Output is correct
66 Correct 428 ms 90340 KB Output is correct
67 Correct 467 ms 89924 KB Output is correct
68 Correct 414 ms 90160 KB Output is correct
69 Correct 418 ms 90060 KB Output is correct
70 Correct 466 ms 89988 KB Output is correct
71 Correct 405 ms 90744 KB Output is correct
72 Correct 394 ms 90544 KB Output is correct
73 Correct 410 ms 90844 KB Output is correct
74 Correct 417 ms 90724 KB Output is correct
75 Correct 404 ms 90532 KB Output is correct
76 Correct 436 ms 90756 KB Output is correct
77 Correct 398 ms 90744 KB Output is correct
78 Correct 405 ms 90912 KB Output is correct
79 Correct 401 ms 90708 KB Output is correct
80 Correct 454 ms 90656 KB Output is correct