답안 #1106224

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1106224 2024-10-29T15:00:53 Z Zero_OP Netrpeljivost (COI23_netrpeljivost) C++14
100 / 100
374 ms 55624 KB
#include <bits/stdc++.h>

using namespace std;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);

#ifdef LOCAL
    freopen("task.inp", "r", stdin);
    freopen("task.out", "w", stdout);
#endif // LOCAL

    int N;
    cin >> N;
    vector<vector<int>> cost(N, vector<int>(N, 0));
    for(int i = 0; i < N; ++i){
        for(int j = 0; j < N; ++j){
            cin >> cost[i][j];
        }
    }

    const long long inf = 1e18;

    vector<long long> f(N, 0);

    int full = N - 1;
    for(int i = 1; i < N; ++i){
        vector<long long> g(N, inf);
        int lsb = i & (-i);
        for(int j = 0; j < N; ++j){
            int t = (j ^ lsb) & (full ^ (lsb - 1));
            for(int last = t; last < t + lsb; ++last){
                g[j] = min(g[j], f[last] + cost[last][j]);
            }
        }

        f = g;
    }

    long long ans = *min_element(f.begin(), f.end());
    cout << ans << '\n';

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 504 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 508 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 508 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 504 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 508 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 508 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 2 ms 760 KB Output is correct
22 Correct 2 ms 592 KB Output is correct
23 Correct 2 ms 504 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 2 ms 592 KB Output is correct
27 Correct 2 ms 336 KB Output is correct
28 Correct 2 ms 336 KB Output is correct
29 Correct 2 ms 336 KB Output is correct
30 Correct 2 ms 592 KB Output is correct
31 Correct 2 ms 336 KB Output is correct
32 Correct 2 ms 468 KB Output is correct
33 Correct 2 ms 336 KB Output is correct
34 Correct 2 ms 592 KB Output is correct
35 Correct 2 ms 416 KB Output is correct
36 Correct 2 ms 604 KB Output is correct
37 Correct 2 ms 592 KB Output is correct
38 Correct 2 ms 336 KB Output is correct
39 Correct 3 ms 760 KB Output is correct
40 Correct 2 ms 592 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 504 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 508 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 508 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 2 ms 760 KB Output is correct
22 Correct 2 ms 592 KB Output is correct
23 Correct 2 ms 504 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 2 ms 592 KB Output is correct
27 Correct 2 ms 336 KB Output is correct
28 Correct 2 ms 336 KB Output is correct
29 Correct 2 ms 336 KB Output is correct
30 Correct 2 ms 592 KB Output is correct
31 Correct 2 ms 336 KB Output is correct
32 Correct 2 ms 468 KB Output is correct
33 Correct 2 ms 336 KB Output is correct
34 Correct 2 ms 592 KB Output is correct
35 Correct 2 ms 416 KB Output is correct
36 Correct 2 ms 604 KB Output is correct
37 Correct 2 ms 592 KB Output is correct
38 Correct 2 ms 336 KB Output is correct
39 Correct 3 ms 760 KB Output is correct
40 Correct 2 ms 592 KB Output is correct
41 Correct 22 ms 3664 KB Output is correct
42 Correct 21 ms 3656 KB Output is correct
43 Correct 23 ms 3920 KB Output is correct
44 Correct 21 ms 3676 KB Output is correct
45 Correct 28 ms 1360 KB Output is correct
46 Correct 20 ms 1528 KB Output is correct
47 Correct 22 ms 3148 KB Output is correct
48 Correct 20 ms 1360 KB Output is correct
49 Correct 22 ms 3008 KB Output is correct
50 Correct 23 ms 3196 KB Output is correct
51 Correct 22 ms 2892 KB Output is correct
52 Correct 25 ms 3772 KB Output is correct
53 Correct 30 ms 3600 KB Output is correct
54 Correct 24 ms 3668 KB Output is correct
55 Correct 20 ms 3656 KB Output is correct
56 Correct 21 ms 3656 KB Output is correct
57 Correct 20 ms 3656 KB Output is correct
58 Correct 21 ms 2896 KB Output is correct
59 Correct 20 ms 3656 KB Output is correct
60 Correct 25 ms 3212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 504 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 508 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 508 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 2 ms 760 KB Output is correct
22 Correct 2 ms 592 KB Output is correct
23 Correct 2 ms 504 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 2 ms 592 KB Output is correct
27 Correct 2 ms 336 KB Output is correct
28 Correct 2 ms 336 KB Output is correct
29 Correct 2 ms 336 KB Output is correct
30 Correct 2 ms 592 KB Output is correct
31 Correct 2 ms 336 KB Output is correct
32 Correct 2 ms 468 KB Output is correct
33 Correct 2 ms 336 KB Output is correct
34 Correct 2 ms 592 KB Output is correct
35 Correct 2 ms 416 KB Output is correct
36 Correct 2 ms 604 KB Output is correct
37 Correct 2 ms 592 KB Output is correct
38 Correct 2 ms 336 KB Output is correct
39 Correct 3 ms 760 KB Output is correct
40 Correct 2 ms 592 KB Output is correct
41 Correct 22 ms 3664 KB Output is correct
42 Correct 21 ms 3656 KB Output is correct
43 Correct 23 ms 3920 KB Output is correct
44 Correct 21 ms 3676 KB Output is correct
45 Correct 28 ms 1360 KB Output is correct
46 Correct 20 ms 1528 KB Output is correct
47 Correct 22 ms 3148 KB Output is correct
48 Correct 20 ms 1360 KB Output is correct
49 Correct 22 ms 3008 KB Output is correct
50 Correct 23 ms 3196 KB Output is correct
51 Correct 22 ms 2892 KB Output is correct
52 Correct 25 ms 3772 KB Output is correct
53 Correct 30 ms 3600 KB Output is correct
54 Correct 24 ms 3668 KB Output is correct
55 Correct 20 ms 3656 KB Output is correct
56 Correct 21 ms 3656 KB Output is correct
57 Correct 20 ms 3656 KB Output is correct
58 Correct 21 ms 2896 KB Output is correct
59 Correct 20 ms 3656 KB Output is correct
60 Correct 25 ms 3212 KB Output is correct
61 Correct 352 ms 52296 KB Output is correct
62 Correct 324 ms 16960 KB Output is correct
63 Correct 312 ms 16980 KB Output is correct
64 Correct 329 ms 16968 KB Output is correct
65 Correct 374 ms 37376 KB Output is correct
66 Correct 326 ms 37424 KB Output is correct
67 Correct 339 ms 47704 KB Output is correct
68 Correct 339 ms 47568 KB Output is correct
69 Correct 330 ms 52640 KB Output is correct
70 Correct 374 ms 53576 KB Output is correct
71 Correct 331 ms 55624 KB Output is correct
72 Correct 321 ms 37628 KB Output is correct
73 Correct 344 ms 47944 KB Output is correct
74 Correct 323 ms 37668 KB Output is correct
75 Correct 334 ms 55552 KB Output is correct
76 Correct 299 ms 16956 KB Output is correct
77 Correct 373 ms 55588 KB Output is correct
78 Correct 324 ms 48172 KB Output is correct
79 Correct 345 ms 16972 KB Output is correct
80 Correct 316 ms 20040 KB Output is correct