Submission #1015990

# Submission time Handle Problem Language Result Execution time Memory
1015990 2024-07-07T08:18:22 Z isaachew Netrpeljivost (COI23_netrpeljivost) C++17
100 / 100
334 ms 57964 KB
#include <bits/stdc++.h>
/*
 O(n^2 log n) what
 
 */

int main(){
  std::ios::sync_with_stdio(0);
  std::cin.tie(0);
    int n;
    std::cin>>n;
    std::vector<std::vector<int>> netrp(n);
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            int x;
            std::cin>>x;
            netrp[i].push_back(x);
        }
    }
    std::vector<long long> ccosts(n);
    for(int i=1;i<n;i++){
        std::vector<long long> nccosts(n,1e18);
        for(int j=0;j<n;j++){
            for(int k=0;!(i&k);k++){
                nccosts[j^k^(i&-i)]=std::min(nccosts[j^k^(i&-i)],ccosts[j]+netrp[j][j^k^(i&-i)]);
            }
        }
        ccosts=nccosts;
    }
    long long mn=1e18;
    for(int i=0;i<n;i++)mn=std::min(mn,ccosts[i]);
    std::cout<<mn<<'\n';
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Correct 2 ms 604 KB Output is correct
22 Correct 1 ms 584 KB Output is correct
23 Correct 1 ms 600 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 2 ms 604 KB Output is correct
27 Correct 2 ms 676 KB Output is correct
28 Correct 2 ms 644 KB Output is correct
29 Correct 1 ms 604 KB Output is correct
30 Correct 2 ms 576 KB Output is correct
31 Correct 1 ms 464 KB Output is correct
32 Correct 1 ms 604 KB Output is correct
33 Correct 1 ms 604 KB Output is correct
34 Correct 1 ms 604 KB Output is correct
35 Correct 1 ms 648 KB Output is correct
36 Correct 1 ms 604 KB Output is correct
37 Correct 2 ms 600 KB Output is correct
38 Correct 2 ms 580 KB Output is correct
39 Correct 2 ms 604 KB Output is correct
40 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Correct 2 ms 604 KB Output is correct
22 Correct 1 ms 584 KB Output is correct
23 Correct 1 ms 600 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 2 ms 604 KB Output is correct
27 Correct 2 ms 676 KB Output is correct
28 Correct 2 ms 644 KB Output is correct
29 Correct 1 ms 604 KB Output is correct
30 Correct 2 ms 576 KB Output is correct
31 Correct 1 ms 464 KB Output is correct
32 Correct 1 ms 604 KB Output is correct
33 Correct 1 ms 604 KB Output is correct
34 Correct 1 ms 604 KB Output is correct
35 Correct 1 ms 648 KB Output is correct
36 Correct 1 ms 604 KB Output is correct
37 Correct 2 ms 600 KB Output is correct
38 Correct 2 ms 580 KB Output is correct
39 Correct 2 ms 604 KB Output is correct
40 Correct 1 ms 604 KB Output is correct
41 Correct 19 ms 3876 KB Output is correct
42 Correct 24 ms 3968 KB Output is correct
43 Correct 19 ms 3928 KB Output is correct
44 Correct 20 ms 3932 KB Output is correct
45 Correct 26 ms 3804 KB Output is correct
46 Correct 20 ms 3932 KB Output is correct
47 Correct 21 ms 3932 KB Output is correct
48 Correct 18 ms 3932 KB Output is correct
49 Correct 20 ms 3932 KB Output is correct
50 Correct 19 ms 3876 KB Output is correct
51 Correct 18 ms 3920 KB Output is correct
52 Correct 20 ms 3824 KB Output is correct
53 Correct 19 ms 4040 KB Output is correct
54 Correct 20 ms 3920 KB Output is correct
55 Correct 19 ms 3920 KB Output is correct
56 Correct 19 ms 4076 KB Output is correct
57 Correct 22 ms 3936 KB Output is correct
58 Correct 18 ms 3940 KB Output is correct
59 Correct 26 ms 3924 KB Output is correct
60 Correct 20 ms 3928 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Correct 2 ms 604 KB Output is correct
22 Correct 1 ms 584 KB Output is correct
23 Correct 1 ms 600 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 2 ms 604 KB Output is correct
27 Correct 2 ms 676 KB Output is correct
28 Correct 2 ms 644 KB Output is correct
29 Correct 1 ms 604 KB Output is correct
30 Correct 2 ms 576 KB Output is correct
31 Correct 1 ms 464 KB Output is correct
32 Correct 1 ms 604 KB Output is correct
33 Correct 1 ms 604 KB Output is correct
34 Correct 1 ms 604 KB Output is correct
35 Correct 1 ms 648 KB Output is correct
36 Correct 1 ms 604 KB Output is correct
37 Correct 2 ms 600 KB Output is correct
38 Correct 2 ms 580 KB Output is correct
39 Correct 2 ms 604 KB Output is correct
40 Correct 1 ms 604 KB Output is correct
41 Correct 19 ms 3876 KB Output is correct
42 Correct 24 ms 3968 KB Output is correct
43 Correct 19 ms 3928 KB Output is correct
44 Correct 20 ms 3932 KB Output is correct
45 Correct 26 ms 3804 KB Output is correct
46 Correct 20 ms 3932 KB Output is correct
47 Correct 21 ms 3932 KB Output is correct
48 Correct 18 ms 3932 KB Output is correct
49 Correct 20 ms 3932 KB Output is correct
50 Correct 19 ms 3876 KB Output is correct
51 Correct 18 ms 3920 KB Output is correct
52 Correct 20 ms 3824 KB Output is correct
53 Correct 19 ms 4040 KB Output is correct
54 Correct 20 ms 3920 KB Output is correct
55 Correct 19 ms 3920 KB Output is correct
56 Correct 19 ms 4076 KB Output is correct
57 Correct 22 ms 3936 KB Output is correct
58 Correct 18 ms 3940 KB Output is correct
59 Correct 26 ms 3924 KB Output is correct
60 Correct 20 ms 3928 KB Output is correct
61 Correct 328 ms 57380 KB Output is correct
62 Correct 305 ms 57168 KB Output is correct
63 Correct 309 ms 57344 KB Output is correct
64 Correct 284 ms 57168 KB Output is correct
65 Correct 322 ms 57340 KB Output is correct
66 Correct 309 ms 57288 KB Output is correct
67 Correct 319 ms 57292 KB Output is correct
68 Correct 323 ms 57172 KB Output is correct
69 Correct 324 ms 57168 KB Output is correct
70 Correct 334 ms 57168 KB Output is correct
71 Correct 302 ms 57936 KB Output is correct
72 Correct 312 ms 57936 KB Output is correct
73 Correct 287 ms 57964 KB Output is correct
74 Correct 305 ms 57812 KB Output is correct
75 Correct 330 ms 57888 KB Output is correct
76 Correct 280 ms 57936 KB Output is correct
77 Correct 312 ms 57896 KB Output is correct
78 Correct 293 ms 57840 KB Output is correct
79 Correct 320 ms 57800 KB Output is correct
80 Correct 290 ms 57924 KB Output is correct