Submission #998928

# Submission time Handle Problem Language Result Execution time Memory
998928 2024-06-15T00:38:35 Z amirhoseinfar1385 Netrpeljivost (COI23_netrpeljivost) C++17
100 / 100
332 ms 125824 KB
#include<bits/stdc++.h>
using namespace std;
const long long maxn=2500;
long long dp[maxn][maxn],n,cost[maxn][maxn];
long long inf=1e18;

void vorod(){
	cin>>n;
	for(long long i=0;i<n;i++){
		for(long long j=0;j<n;j++){
			cin>>cost[i][j];
		}
	}
}

void solve(){
	for(long long lev=1;lev<n;lev++){
		long long pae=(lev&(-lev));
		for(long long i=0;i<n;i++){
			long long l=(i^pae)&(~(pae-1));
			long long r=l+pae;
			dp[lev][i]=inf;
			for(long long j=l;j<r;j++){
				dp[lev][i]=min(dp[lev][i],dp[lev-1][j]+cost[i][j]);
			}
		}
	}
}

void khor(){
	long long res=inf;
	for(long long i=0;i<n;i++){
		res=min(res,dp[n-1][i]);
	}
	cout<<res<<"\n";
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	vorod();
	solve();
	khor();
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 0 ms 4444 KB Output is correct
3 Correct 1 ms 4440 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4564 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 1 ms 4444 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4556 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 0 ms 4444 KB Output is correct
3 Correct 1 ms 4440 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4564 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 1 ms 4444 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4556 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
21 Correct 2 ms 8796 KB Output is correct
22 Correct 2 ms 8864 KB Output is correct
23 Correct 2 ms 8796 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 8864 KB Output is correct
27 Correct 2 ms 8796 KB Output is correct
28 Correct 2 ms 8796 KB Output is correct
29 Correct 2 ms 8796 KB Output is correct
30 Correct 2 ms 8796 KB Output is correct
31 Correct 2 ms 8792 KB Output is correct
32 Correct 2 ms 8792 KB Output is correct
33 Correct 2 ms 8796 KB Output is correct
34 Correct 2 ms 8796 KB Output is correct
35 Correct 2 ms 8796 KB Output is correct
36 Correct 2 ms 8796 KB Output is correct
37 Correct 2 ms 8664 KB Output is correct
38 Correct 2 ms 8796 KB Output is correct
39 Correct 2 ms 8796 KB Output is correct
40 Correct 2 ms 8824 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 0 ms 4444 KB Output is correct
3 Correct 1 ms 4440 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4564 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 1 ms 4444 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4556 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
21 Correct 2 ms 8796 KB Output is correct
22 Correct 2 ms 8864 KB Output is correct
23 Correct 2 ms 8796 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 8864 KB Output is correct
27 Correct 2 ms 8796 KB Output is correct
28 Correct 2 ms 8796 KB Output is correct
29 Correct 2 ms 8796 KB Output is correct
30 Correct 2 ms 8796 KB Output is correct
31 Correct 2 ms 8792 KB Output is correct
32 Correct 2 ms 8792 KB Output is correct
33 Correct 2 ms 8796 KB Output is correct
34 Correct 2 ms 8796 KB Output is correct
35 Correct 2 ms 8796 KB Output is correct
36 Correct 2 ms 8796 KB Output is correct
37 Correct 2 ms 8664 KB Output is correct
38 Correct 2 ms 8796 KB Output is correct
39 Correct 2 ms 8796 KB Output is correct
40 Correct 2 ms 8824 KB Output is correct
41 Correct 20 ms 25440 KB Output is correct
42 Correct 21 ms 25568 KB Output is correct
43 Correct 20 ms 25432 KB Output is correct
44 Correct 20 ms 25436 KB Output is correct
45 Correct 20 ms 25436 KB Output is correct
46 Correct 21 ms 25436 KB Output is correct
47 Correct 22 ms 25436 KB Output is correct
48 Correct 21 ms 25624 KB Output is correct
49 Correct 21 ms 25436 KB Output is correct
50 Correct 20 ms 25632 KB Output is correct
51 Correct 21 ms 25436 KB Output is correct
52 Correct 20 ms 25428 KB Output is correct
53 Correct 22 ms 25436 KB Output is correct
54 Correct 20 ms 25692 KB Output is correct
55 Correct 21 ms 25500 KB Output is correct
56 Correct 20 ms 25428 KB Output is correct
57 Correct 20 ms 25436 KB Output is correct
58 Correct 22 ms 25432 KB Output is correct
59 Correct 21 ms 25428 KB Output is correct
60 Correct 21 ms 25424 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 0 ms 4444 KB Output is correct
3 Correct 1 ms 4440 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4564 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 1 ms 4444 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4556 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
21 Correct 2 ms 8796 KB Output is correct
22 Correct 2 ms 8864 KB Output is correct
23 Correct 2 ms 8796 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 8864 KB Output is correct
27 Correct 2 ms 8796 KB Output is correct
28 Correct 2 ms 8796 KB Output is correct
29 Correct 2 ms 8796 KB Output is correct
30 Correct 2 ms 8796 KB Output is correct
31 Correct 2 ms 8792 KB Output is correct
32 Correct 2 ms 8792 KB Output is correct
33 Correct 2 ms 8796 KB Output is correct
34 Correct 2 ms 8796 KB Output is correct
35 Correct 2 ms 8796 KB Output is correct
36 Correct 2 ms 8796 KB Output is correct
37 Correct 2 ms 8664 KB Output is correct
38 Correct 2 ms 8796 KB Output is correct
39 Correct 2 ms 8796 KB Output is correct
40 Correct 2 ms 8824 KB Output is correct
41 Correct 20 ms 25440 KB Output is correct
42 Correct 21 ms 25568 KB Output is correct
43 Correct 20 ms 25432 KB Output is correct
44 Correct 20 ms 25436 KB Output is correct
45 Correct 20 ms 25436 KB Output is correct
46 Correct 21 ms 25436 KB Output is correct
47 Correct 22 ms 25436 KB Output is correct
48 Correct 21 ms 25624 KB Output is correct
49 Correct 21 ms 25436 KB Output is correct
50 Correct 20 ms 25632 KB Output is correct
51 Correct 21 ms 25436 KB Output is correct
52 Correct 20 ms 25428 KB Output is correct
53 Correct 22 ms 25436 KB Output is correct
54 Correct 20 ms 25692 KB Output is correct
55 Correct 21 ms 25500 KB Output is correct
56 Correct 20 ms 25428 KB Output is correct
57 Correct 20 ms 25436 KB Output is correct
58 Correct 22 ms 25432 KB Output is correct
59 Correct 21 ms 25428 KB Output is correct
60 Correct 21 ms 25424 KB Output is correct
61 Correct 315 ms 125140 KB Output is correct
62 Correct 303 ms 124920 KB Output is correct
63 Correct 311 ms 124940 KB Output is correct
64 Correct 303 ms 125012 KB Output is correct
65 Correct 310 ms 124912 KB Output is correct
66 Correct 311 ms 125080 KB Output is correct
67 Correct 307 ms 125008 KB Output is correct
68 Correct 313 ms 124996 KB Output is correct
69 Correct 302 ms 125044 KB Output is correct
70 Correct 301 ms 125036 KB Output is correct
71 Correct 310 ms 125636 KB Output is correct
72 Correct 332 ms 125676 KB Output is correct
73 Correct 314 ms 125776 KB Output is correct
74 Correct 327 ms 125688 KB Output is correct
75 Correct 326 ms 125768 KB Output is correct
76 Correct 332 ms 125780 KB Output is correct
77 Correct 325 ms 125824 KB Output is correct
78 Correct 297 ms 125776 KB Output is correct
79 Correct 312 ms 125676 KB Output is correct
80 Correct 306 ms 125776 KB Output is correct