Submission #1036723

# Submission time Handle Problem Language Result Execution time Memory
1036723 2024-07-27T16:02:20 Z model_code Brought Down the Grading Server? (CEOI23_balance) C++17
100 / 100
481 ms 172620 KB
#include<bits/stdc++.h>

using namespace std;

struct edge {
    int to;
    int back_idx;
    int who;
};

vector<vector<edge>> g;
vector<int> act;
unordered_set<int> ids;

void add_euler(int a, int b, int who) {
    g[a].push_back({b, g[b].size(), who});
    g[b].push_back({a, g[a].size() - 1, who});
    ids.insert(a);
    ids.insert(b);
}

void visit(int v) {
    while(not g[v].empty()) {
        auto e = g[v].back(); g[v].pop_back();
        if(e.back_idx == -1) continue;
        g[e.to][e.back_idx].back_idx = -1;
        visit(e.to);
        if(e.who >= 0) act[e.who] = v;
    }
}

void cleanup() {
    for(int x : ids) g[x].clear();
    ids.clear();
}

vector<int> merge(const vector<pair<int, int>> &v) {
    cleanup();
    act.resize(v.size());

    for(int i = 0; i < v.size(); ++i)
        add_euler(v[i].first, v[i].second, i);
    for(int x : ids)
        if(g[x].size() % 2)
            add_euler(x, 0, -1);
    for(int x : ids)
        visit(x);

    return act;
}

void solve(vector<vector<int>> &choices) {
    int T = choices[0].size();
    if(T == 1) return;

    vector<vector<int>> L(choices.size()), R(choices.size());
    for(int i = 0; i < choices.size(); ++i) {
        for(int j = 0; j < T / 2; ++j)
            L[i].push_back(choices[i][j]);
        for(int j = 0; j < T / 2; ++j)
            R[i].push_back(choices[i][j + T/2]);
    }

    vector<vector<int>> v = L;
    for(auto r : R) v.push_back(r);
    solve(v);
    for(int i = 0; i < L.size(); ++i) L[i] = v[i];
    for(int i = 0; i < R.size(); ++i) R[i] = v[i + L.size()];

    for(int i = 0; i < T/2; ++i) {
        vector<pair<int, int>> v;
        for(int j = 0; j < R.size(); ++j)
            v.emplace_back(L[j][i], R[j][i]);
        vector<int> a = merge(v);

        for(int j = 0; j < R.size(); ++j)
            if(a[j] != L[j][i]) swap(L[j][i], R[j][i]);
    }

    choices.assign(choices.size(), {});
    for(int i = 0; i < choices.size(); ++i) {
        for(int x : L[i]) choices[i].push_back(x);
        for(int x : R[i]) choices[i].push_back(x);
    }
}

int main() {
    int N, T, K; scanf("%d %d %d", &N, &T, &K);
    g.resize(K + 1);
    vector<vector<int>> choices(N);

    for(int i = 0; i < N; ++i) {
        for(int j = 0; j < T; ++j) {
            int a; scanf("%d", &a);
            choices[i].push_back(a);
        }
    }

    solve(choices);

    for(const auto &c : choices) {
        for(int x : c) printf("%d ", x);
        printf("\n");
    }

    return 0;
}

Compilation message

balance.cpp: In function 'void add_euler(int, int, int)':
balance.cpp:16:33: warning: narrowing conversion of '(& g.std::vector<std::vector<edge> >::operator[](((std::vector<std::vector<edge> >::size_type)b)))->std::vector<edge>::size()' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   16 |     g[a].push_back({b, g[b].size(), who});
      |                        ~~~~~~~~~^~
balance.cpp:17:36: warning: narrowing conversion of '((& g.std::vector<std::vector<edge> >::operator[](((std::vector<std::vector<edge> >::size_type)a)))->std::vector<edge>::size() - 1)' from 'std::vector<edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   17 |     g[b].push_back({a, g[a].size() - 1, who});
      |                        ~~~~~~~~~~~~^~~
balance.cpp: In function 'std::vector<int> merge(const std::vector<std::pair<int, int> >&)':
balance.cpp:41:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |     for(int i = 0; i < v.size(); ++i)
      |                    ~~^~~~~~~~~~
balance.cpp: In function 'void solve(std::vector<std::vector<int> >&)':
balance.cpp:57:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |     for(int i = 0; i < choices.size(); ++i) {
      |                    ~~^~~~~~~~~~~~~~~~
balance.cpp:67:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   67 |     for(int i = 0; i < L.size(); ++i) L[i] = v[i];
      |                    ~~^~~~~~~~~~
balance.cpp:68:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   68 |     for(int i = 0; i < R.size(); ++i) R[i] = v[i + L.size()];
      |                    ~~^~~~~~~~~~
balance.cpp:72:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   72 |         for(int j = 0; j < R.size(); ++j)
      |                        ~~^~~~~~~~~~
balance.cpp:76:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   76 |         for(int j = 0; j < R.size(); ++j)
      |                        ~~^~~~~~~~~~
balance.cpp:81:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   81 |     for(int i = 0; i < choices.size(); ++i) {
      |                    ~~^~~~~~~~~~~~~~~~
balance.cpp: In function 'int main()':
balance.cpp:88:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   88 |     int N, T, K; scanf("%d %d %d", &N, &T, &K);
      |                  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
balance.cpp:94:25: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   94 |             int a; scanf("%d", &a);
      |                    ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 0 ms 344 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Correct
2 Correct 0 ms 348 KB Correct
3 Correct 0 ms 348 KB Correct
4 Correct 0 ms 348 KB Correct
5 Correct 0 ms 348 KB Correct
6 Correct 0 ms 348 KB Correct
7 Correct 0 ms 348 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 91 ms 42284 KB Correct
2 Correct 91 ms 41640 KB Correct
3 Correct 71 ms 35604 KB Correct
4 Correct 62 ms 37048 KB Correct
5 Correct 80 ms 41028 KB Correct
6 Correct 92 ms 43564 KB Correct
7 Correct 91 ms 38936 KB Correct
8 Correct 87 ms 43968 KB Correct
9 Correct 87 ms 43652 KB Correct
10 Correct 74 ms 43908 KB Correct
11 Correct 73 ms 43688 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 91 ms 42284 KB Correct
2 Correct 91 ms 41640 KB Correct
3 Correct 71 ms 35604 KB Correct
4 Correct 62 ms 37048 KB Correct
5 Correct 80 ms 41028 KB Correct
6 Correct 92 ms 43564 KB Correct
7 Correct 91 ms 38936 KB Correct
8 Correct 87 ms 43968 KB Correct
9 Correct 87 ms 43652 KB Correct
10 Correct 74 ms 43908 KB Correct
11 Correct 73 ms 43688 KB Correct
12 Correct 88 ms 42280 KB Correct
13 Correct 88 ms 41440 KB Correct
14 Correct 71 ms 35712 KB Correct
15 Correct 62 ms 37180 KB Correct
16 Correct 82 ms 41116 KB Correct
17 Correct 91 ms 43560 KB Correct
18 Correct 94 ms 38968 KB Correct
19 Correct 90 ms 43820 KB Correct
20 Correct 89 ms 43640 KB Correct
21 Correct 78 ms 43816 KB Correct
22 Correct 73 ms 43828 KB Correct
23 Correct 104 ms 47656 KB Correct
24 Correct 60 ms 36656 KB Correct
25 Correct 86 ms 41952 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Correct
2 Correct 0 ms 348 KB Correct
3 Correct 0 ms 348 KB Correct
4 Correct 0 ms 348 KB Correct
5 Correct 0 ms 348 KB Correct
6 Correct 0 ms 348 KB Correct
7 Correct 0 ms 348 KB Correct
8 Correct 91 ms 42284 KB Correct
9 Correct 91 ms 41640 KB Correct
10 Correct 71 ms 35604 KB Correct
11 Correct 62 ms 37048 KB Correct
12 Correct 80 ms 41028 KB Correct
13 Correct 92 ms 43564 KB Correct
14 Correct 91 ms 38936 KB Correct
15 Correct 87 ms 43968 KB Correct
16 Correct 87 ms 43652 KB Correct
17 Correct 74 ms 43908 KB Correct
18 Correct 73 ms 43688 KB Correct
19 Correct 88 ms 42280 KB Correct
20 Correct 88 ms 41440 KB Correct
21 Correct 71 ms 35712 KB Correct
22 Correct 62 ms 37180 KB Correct
23 Correct 82 ms 41116 KB Correct
24 Correct 91 ms 43560 KB Correct
25 Correct 94 ms 38968 KB Correct
26 Correct 90 ms 43820 KB Correct
27 Correct 89 ms 43640 KB Correct
28 Correct 78 ms 43816 KB Correct
29 Correct 73 ms 43828 KB Correct
30 Correct 104 ms 47656 KB Correct
31 Correct 60 ms 36656 KB Correct
32 Correct 86 ms 41952 KB Correct
33 Correct 0 ms 344 KB Correct
34 Correct 0 ms 348 KB Correct
35 Correct 0 ms 348 KB Correct
36 Correct 0 ms 348 KB Correct
37 Correct 0 ms 348 KB Correct
38 Correct 0 ms 348 KB Correct
39 Correct 0 ms 344 KB Correct
40 Correct 90 ms 42284 KB Correct
41 Correct 88 ms 41560 KB Correct
42 Correct 71 ms 35608 KB Correct
43 Correct 60 ms 37180 KB Correct
44 Correct 86 ms 41004 KB Correct
45 Correct 91 ms 43560 KB Correct
46 Correct 93 ms 38972 KB Correct
47 Correct 94 ms 43816 KB Correct
48 Correct 88 ms 43812 KB Correct
49 Correct 72 ms 43816 KB Correct
50 Correct 72 ms 43828 KB Correct
51 Correct 103 ms 47660 KB Correct
52 Correct 61 ms 36412 KB Correct
53 Correct 87 ms 41920 KB Correct
54 Correct 55 ms 27580 KB Correct
55 Correct 2 ms 3164 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 6 ms 3196 KB Correct
3 Correct 6 ms 3164 KB Correct
4 Correct 5 ms 2648 KB Correct
5 Correct 3 ms 2140 KB Correct
6 Correct 4 ms 2396 KB Correct
7 Correct 4 ms 2652 KB Correct
8 Correct 5 ms 2908 KB Correct
9 Correct 5 ms 2668 KB Correct
10 Correct 5 ms 2652 KB Correct
11 Correct 4 ms 2652 KB Correct
12 Correct 4 ms 2396 KB Correct
13 Correct 4 ms 2396 KB Correct
14 Correct 4 ms 2396 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 6 ms 3196 KB Correct
3 Correct 6 ms 3164 KB Correct
4 Correct 5 ms 2648 KB Correct
5 Correct 3 ms 2140 KB Correct
6 Correct 4 ms 2396 KB Correct
7 Correct 4 ms 2652 KB Correct
8 Correct 5 ms 2908 KB Correct
9 Correct 5 ms 2668 KB Correct
10 Correct 5 ms 2652 KB Correct
11 Correct 4 ms 2652 KB Correct
12 Correct 4 ms 2396 KB Correct
13 Correct 4 ms 2396 KB Correct
14 Correct 4 ms 2396 KB Correct
15 Correct 0 ms 344 KB Correct
16 Correct 7 ms 3164 KB Correct
17 Correct 6 ms 3164 KB Correct
18 Correct 5 ms 2652 KB Correct
19 Correct 3 ms 2140 KB Correct
20 Correct 4 ms 2396 KB Correct
21 Correct 4 ms 2652 KB Correct
22 Correct 7 ms 2908 KB Correct
23 Correct 5 ms 2672 KB Correct
24 Correct 5 ms 2652 KB Correct
25 Correct 4 ms 2712 KB Correct
26 Correct 6 ms 2396 KB Correct
27 Correct 3 ms 2396 KB Correct
28 Correct 4 ms 2396 KB Correct
29 Correct 6 ms 3164 KB Correct
30 Correct 5 ms 2908 KB Correct
31 Correct 7 ms 3056 KB Correct
32 Correct 5 ms 2908 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 6 ms 3196 KB Correct
3 Correct 6 ms 3164 KB Correct
4 Correct 5 ms 2648 KB Correct
5 Correct 3 ms 2140 KB Correct
6 Correct 4 ms 2396 KB Correct
7 Correct 4 ms 2652 KB Correct
8 Correct 5 ms 2908 KB Correct
9 Correct 5 ms 2668 KB Correct
10 Correct 5 ms 2652 KB Correct
11 Correct 4 ms 2652 KB Correct
12 Correct 4 ms 2396 KB Correct
13 Correct 4 ms 2396 KB Correct
14 Correct 4 ms 2396 KB Correct
15 Correct 0 ms 344 KB Correct
16 Correct 7 ms 3164 KB Correct
17 Correct 6 ms 3164 KB Correct
18 Correct 5 ms 2652 KB Correct
19 Correct 3 ms 2140 KB Correct
20 Correct 4 ms 2396 KB Correct
21 Correct 4 ms 2652 KB Correct
22 Correct 7 ms 2908 KB Correct
23 Correct 5 ms 2672 KB Correct
24 Correct 5 ms 2652 KB Correct
25 Correct 4 ms 2712 KB Correct
26 Correct 6 ms 2396 KB Correct
27 Correct 3 ms 2396 KB Correct
28 Correct 4 ms 2396 KB Correct
29 Correct 6 ms 3164 KB Correct
30 Correct 5 ms 2908 KB Correct
31 Correct 7 ms 3056 KB Correct
32 Correct 5 ms 2908 KB Correct
33 Correct 0 ms 344 KB Correct
34 Correct 6 ms 3164 KB Correct
35 Correct 6 ms 3160 KB Correct
36 Correct 5 ms 2652 KB Correct
37 Correct 3 ms 2140 KB Correct
38 Correct 4 ms 2396 KB Correct
39 Correct 5 ms 2652 KB Correct
40 Correct 5 ms 2904 KB Correct
41 Correct 7 ms 2696 KB Correct
42 Correct 5 ms 2648 KB Correct
43 Correct 4 ms 2648 KB Correct
44 Correct 4 ms 2396 KB Correct
45 Correct 4 ms 2392 KB Correct
46 Correct 4 ms 2372 KB Correct
47 Correct 6 ms 3164 KB Correct
48 Correct 5 ms 2944 KB Correct
49 Correct 6 ms 3180 KB Correct
50 Correct 6 ms 2908 KB Correct
51 Correct 1 ms 348 KB Correct
52 Correct 0 ms 348 KB Correct
53 Correct 0 ms 348 KB Correct
54 Correct 0 ms 600 KB Correct
55 Correct 0 ms 348 KB Correct
56 Correct 0 ms 348 KB Correct
57 Correct 0 ms 348 KB Correct
58 Correct 16 ms 6688 KB Correct
59 Correct 18 ms 6236 KB Correct
60 Correct 8 ms 3676 KB Correct
61 Correct 13 ms 5432 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 91 ms 42284 KB Correct
2 Correct 91 ms 41640 KB Correct
3 Correct 71 ms 35604 KB Correct
4 Correct 62 ms 37048 KB Correct
5 Correct 80 ms 41028 KB Correct
6 Correct 92 ms 43564 KB Correct
7 Correct 91 ms 38936 KB Correct
8 Correct 87 ms 43968 KB Correct
9 Correct 87 ms 43652 KB Correct
10 Correct 74 ms 43908 KB Correct
11 Correct 73 ms 43688 KB Correct
12 Correct 0 ms 344 KB Correct
13 Correct 6 ms 3196 KB Correct
14 Correct 6 ms 3164 KB Correct
15 Correct 5 ms 2648 KB Correct
16 Correct 3 ms 2140 KB Correct
17 Correct 4 ms 2396 KB Correct
18 Correct 4 ms 2652 KB Correct
19 Correct 5 ms 2908 KB Correct
20 Correct 5 ms 2668 KB Correct
21 Correct 5 ms 2652 KB Correct
22 Correct 4 ms 2652 KB Correct
23 Correct 4 ms 2396 KB Correct
24 Correct 4 ms 2396 KB Correct
25 Correct 4 ms 2396 KB Correct
26 Correct 94 ms 42280 KB Correct
27 Correct 87 ms 41560 KB Correct
28 Correct 71 ms 35608 KB Correct
29 Correct 61 ms 37184 KB Correct
30 Correct 79 ms 40948 KB Correct
31 Correct 91 ms 43564 KB Correct
32 Correct 92 ms 39056 KB Correct
33 Correct 88 ms 43816 KB Correct
34 Correct 87 ms 43680 KB Correct
35 Correct 74 ms 43900 KB Correct
36 Correct 72 ms 43824 KB Correct
37 Correct 0 ms 348 KB Correct
38 Correct 6 ms 3164 KB Correct
39 Correct 6 ms 3164 KB Correct
40 Correct 5 ms 2648 KB Correct
41 Correct 3 ms 2140 KB Correct
42 Correct 6 ms 2388 KB Correct
43 Correct 5 ms 2652 KB Correct
44 Correct 5 ms 3160 KB Correct
45 Correct 5 ms 2904 KB Correct
46 Correct 5 ms 2652 KB Correct
47 Correct 4 ms 2652 KB Correct
48 Correct 4 ms 2396 KB Correct
49 Correct 3 ms 2396 KB Correct
50 Correct 4 ms 2396 KB Correct
51 Correct 331 ms 126836 KB Correct
52 Correct 347 ms 157772 KB Correct
53 Correct 80 ms 34768 KB Correct
54 Correct 110 ms 53036 KB Correct
55 Correct 306 ms 142448 KB Correct
56 Correct 319 ms 122120 KB Correct
57 Correct 344 ms 128564 KB Correct
58 Correct 370 ms 169092 KB Correct
59 Correct 298 ms 138620 KB Correct
60 Correct 285 ms 114524 KB Correct
61 Correct 342 ms 126760 KB Correct
62 Correct 182 ms 94492 KB Correct
63 Correct 185 ms 92104 KB Correct
64 Correct 175 ms 94172 KB Correct
65 Correct 178 ms 92116 KB Correct
66 Correct 172 ms 93396 KB Correct
67 Correct 178 ms 95704 KB Correct
68 Correct 183 ms 90172 KB Correct
69 Correct 191 ms 95236 KB Correct
70 Correct 237 ms 116804 KB Correct
71 Correct 244 ms 120372 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 91 ms 42284 KB Correct
2 Correct 91 ms 41640 KB Correct
3 Correct 71 ms 35604 KB Correct
4 Correct 62 ms 37048 KB Correct
5 Correct 80 ms 41028 KB Correct
6 Correct 92 ms 43564 KB Correct
7 Correct 91 ms 38936 KB Correct
8 Correct 87 ms 43968 KB Correct
9 Correct 87 ms 43652 KB Correct
10 Correct 74 ms 43908 KB Correct
11 Correct 73 ms 43688 KB Correct
12 Correct 88 ms 42280 KB Correct
13 Correct 88 ms 41440 KB Correct
14 Correct 71 ms 35712 KB Correct
15 Correct 62 ms 37180 KB Correct
16 Correct 82 ms 41116 KB Correct
17 Correct 91 ms 43560 KB Correct
18 Correct 94 ms 38968 KB Correct
19 Correct 90 ms 43820 KB Correct
20 Correct 89 ms 43640 KB Correct
21 Correct 78 ms 43816 KB Correct
22 Correct 73 ms 43828 KB Correct
23 Correct 104 ms 47656 KB Correct
24 Correct 60 ms 36656 KB Correct
25 Correct 86 ms 41952 KB Correct
26 Correct 0 ms 344 KB Correct
27 Correct 6 ms 3196 KB Correct
28 Correct 6 ms 3164 KB Correct
29 Correct 5 ms 2648 KB Correct
30 Correct 3 ms 2140 KB Correct
31 Correct 4 ms 2396 KB Correct
32 Correct 4 ms 2652 KB Correct
33 Correct 5 ms 2908 KB Correct
34 Correct 5 ms 2668 KB Correct
35 Correct 5 ms 2652 KB Correct
36 Correct 4 ms 2652 KB Correct
37 Correct 4 ms 2396 KB Correct
38 Correct 4 ms 2396 KB Correct
39 Correct 4 ms 2396 KB Correct
40 Correct 0 ms 344 KB Correct
41 Correct 7 ms 3164 KB Correct
42 Correct 6 ms 3164 KB Correct
43 Correct 5 ms 2652 KB Correct
44 Correct 3 ms 2140 KB Correct
45 Correct 4 ms 2396 KB Correct
46 Correct 4 ms 2652 KB Correct
47 Correct 7 ms 2908 KB Correct
48 Correct 5 ms 2672 KB Correct
49 Correct 5 ms 2652 KB Correct
50 Correct 4 ms 2712 KB Correct
51 Correct 6 ms 2396 KB Correct
52 Correct 3 ms 2396 KB Correct
53 Correct 4 ms 2396 KB Correct
54 Correct 6 ms 3164 KB Correct
55 Correct 5 ms 2908 KB Correct
56 Correct 7 ms 3056 KB Correct
57 Correct 5 ms 2908 KB Correct
58 Correct 94 ms 42280 KB Correct
59 Correct 87 ms 41560 KB Correct
60 Correct 71 ms 35608 KB Correct
61 Correct 61 ms 37184 KB Correct
62 Correct 79 ms 40948 KB Correct
63 Correct 91 ms 43564 KB Correct
64 Correct 92 ms 39056 KB Correct
65 Correct 88 ms 43816 KB Correct
66 Correct 87 ms 43680 KB Correct
67 Correct 74 ms 43900 KB Correct
68 Correct 72 ms 43824 KB Correct
69 Correct 0 ms 348 KB Correct
70 Correct 6 ms 3164 KB Correct
71 Correct 6 ms 3164 KB Correct
72 Correct 5 ms 2648 KB Correct
73 Correct 3 ms 2140 KB Correct
74 Correct 6 ms 2388 KB Correct
75 Correct 5 ms 2652 KB Correct
76 Correct 5 ms 3160 KB Correct
77 Correct 5 ms 2904 KB Correct
78 Correct 5 ms 2652 KB Correct
79 Correct 4 ms 2652 KB Correct
80 Correct 4 ms 2396 KB Correct
81 Correct 3 ms 2396 KB Correct
82 Correct 4 ms 2396 KB Correct
83 Correct 331 ms 126836 KB Correct
84 Correct 347 ms 157772 KB Correct
85 Correct 80 ms 34768 KB Correct
86 Correct 110 ms 53036 KB Correct
87 Correct 306 ms 142448 KB Correct
88 Correct 319 ms 122120 KB Correct
89 Correct 344 ms 128564 KB Correct
90 Correct 370 ms 169092 KB Correct
91 Correct 298 ms 138620 KB Correct
92 Correct 285 ms 114524 KB Correct
93 Correct 342 ms 126760 KB Correct
94 Correct 182 ms 94492 KB Correct
95 Correct 185 ms 92104 KB Correct
96 Correct 175 ms 94172 KB Correct
97 Correct 178 ms 92116 KB Correct
98 Correct 172 ms 93396 KB Correct
99 Correct 178 ms 95704 KB Correct
100 Correct 183 ms 90172 KB Correct
101 Correct 191 ms 95236 KB Correct
102 Correct 237 ms 116804 KB Correct
103 Correct 244 ms 120372 KB Correct
104 Correct 90 ms 42280 KB Correct
105 Correct 88 ms 41468 KB Correct
106 Correct 72 ms 35600 KB Correct
107 Correct 61 ms 37180 KB Correct
108 Correct 85 ms 41024 KB Correct
109 Correct 93 ms 43524 KB Correct
110 Correct 91 ms 38968 KB Correct
111 Correct 90 ms 43832 KB Correct
112 Correct 88 ms 43824 KB Correct
113 Correct 90 ms 43868 KB Correct
114 Correct 73 ms 43828 KB Correct
115 Correct 0 ms 348 KB Correct
116 Correct 6 ms 3164 KB Correct
117 Correct 6 ms 3160 KB Correct
118 Correct 4 ms 2652 KB Correct
119 Correct 3 ms 2140 KB Correct
120 Correct 4 ms 2392 KB Correct
121 Correct 4 ms 2652 KB Correct
122 Correct 5 ms 2904 KB Correct
123 Correct 5 ms 2672 KB Correct
124 Correct 5 ms 2652 KB Correct
125 Correct 4 ms 2652 KB Correct
126 Correct 4 ms 2396 KB Correct
127 Correct 4 ms 2548 KB Correct
128 Correct 4 ms 2396 KB Correct
129 Correct 346 ms 126836 KB Correct
130 Correct 353 ms 157740 KB Correct
131 Correct 71 ms 34512 KB Correct
132 Correct 112 ms 53036 KB Correct
133 Correct 313 ms 142448 KB Correct
134 Correct 307 ms 122096 KB Correct
135 Correct 343 ms 128584 KB Correct
136 Correct 376 ms 169264 KB Correct
137 Correct 300 ms 138708 KB Correct
138 Correct 288 ms 114532 KB Correct
139 Correct 321 ms 126708 KB Correct
140 Correct 181 ms 94400 KB Correct
141 Correct 177 ms 92228 KB Correct
142 Correct 183 ms 94160 KB Correct
143 Correct 181 ms 92116 KB Correct
144 Correct 186 ms 93396 KB Correct
145 Correct 178 ms 95700 KB Correct
146 Correct 181 ms 90068 KB Correct
147 Correct 185 ms 95316 KB Correct
148 Correct 230 ms 116788 KB Correct
149 Correct 250 ms 120376 KB Correct
150 Correct 103 ms 47604 KB Correct
151 Correct 68 ms 36416 KB Correct
152 Correct 86 ms 41920 KB Correct
153 Correct 6 ms 3160 KB Correct
154 Correct 5 ms 2908 KB Correct
155 Correct 5 ms 2928 KB Correct
156 Correct 5 ms 2908 KB Correct
157 Correct 375 ms 133148 KB Correct
158 Correct 369 ms 160056 KB Correct
159 Correct 53 ms 27896 KB Correct
160 Correct 373 ms 133584 KB Correct
161 Correct 384 ms 133432 KB Correct
162 Correct 402 ms 172480 KB Correct
163 Correct 355 ms 129392 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 0 ms 344 KB Correct
3 Correct 0 ms 348 KB Correct
4 Correct 0 ms 348 KB Correct
5 Correct 0 ms 348 KB Correct
6 Correct 0 ms 348 KB Correct
7 Correct 0 ms 348 KB Correct
8 Correct 0 ms 348 KB Correct
9 Correct 0 ms 348 KB Correct
10 Correct 91 ms 42284 KB Correct
11 Correct 91 ms 41640 KB Correct
12 Correct 71 ms 35604 KB Correct
13 Correct 62 ms 37048 KB Correct
14 Correct 80 ms 41028 KB Correct
15 Correct 92 ms 43564 KB Correct
16 Correct 91 ms 38936 KB Correct
17 Correct 87 ms 43968 KB Correct
18 Correct 87 ms 43652 KB Correct
19 Correct 74 ms 43908 KB Correct
20 Correct 73 ms 43688 KB Correct
21 Correct 88 ms 42280 KB Correct
22 Correct 88 ms 41440 KB Correct
23 Correct 71 ms 35712 KB Correct
24 Correct 62 ms 37180 KB Correct
25 Correct 82 ms 41116 KB Correct
26 Correct 91 ms 43560 KB Correct
27 Correct 94 ms 38968 KB Correct
28 Correct 90 ms 43820 KB Correct
29 Correct 89 ms 43640 KB Correct
30 Correct 78 ms 43816 KB Correct
31 Correct 73 ms 43828 KB Correct
32 Correct 104 ms 47656 KB Correct
33 Correct 60 ms 36656 KB Correct
34 Correct 86 ms 41952 KB Correct
35 Correct 0 ms 344 KB Correct
36 Correct 0 ms 348 KB Correct
37 Correct 0 ms 348 KB Correct
38 Correct 0 ms 348 KB Correct
39 Correct 0 ms 348 KB Correct
40 Correct 0 ms 348 KB Correct
41 Correct 0 ms 344 KB Correct
42 Correct 90 ms 42284 KB Correct
43 Correct 88 ms 41560 KB Correct
44 Correct 71 ms 35608 KB Correct
45 Correct 60 ms 37180 KB Correct
46 Correct 86 ms 41004 KB Correct
47 Correct 91 ms 43560 KB Correct
48 Correct 93 ms 38972 KB Correct
49 Correct 94 ms 43816 KB Correct
50 Correct 88 ms 43812 KB Correct
51 Correct 72 ms 43816 KB Correct
52 Correct 72 ms 43828 KB Correct
53 Correct 103 ms 47660 KB Correct
54 Correct 61 ms 36412 KB Correct
55 Correct 87 ms 41920 KB Correct
56 Correct 55 ms 27580 KB Correct
57 Correct 2 ms 3164 KB Correct
58 Correct 0 ms 344 KB Correct
59 Correct 6 ms 3196 KB Correct
60 Correct 6 ms 3164 KB Correct
61 Correct 5 ms 2648 KB Correct
62 Correct 3 ms 2140 KB Correct
63 Correct 4 ms 2396 KB Correct
64 Correct 4 ms 2652 KB Correct
65 Correct 5 ms 2908 KB Correct
66 Correct 5 ms 2668 KB Correct
67 Correct 5 ms 2652 KB Correct
68 Correct 4 ms 2652 KB Correct
69 Correct 4 ms 2396 KB Correct
70 Correct 4 ms 2396 KB Correct
71 Correct 4 ms 2396 KB Correct
72 Correct 0 ms 344 KB Correct
73 Correct 7 ms 3164 KB Correct
74 Correct 6 ms 3164 KB Correct
75 Correct 5 ms 2652 KB Correct
76 Correct 3 ms 2140 KB Correct
77 Correct 4 ms 2396 KB Correct
78 Correct 4 ms 2652 KB Correct
79 Correct 7 ms 2908 KB Correct
80 Correct 5 ms 2672 KB Correct
81 Correct 5 ms 2652 KB Correct
82 Correct 4 ms 2712 KB Correct
83 Correct 6 ms 2396 KB Correct
84 Correct 3 ms 2396 KB Correct
85 Correct 4 ms 2396 KB Correct
86 Correct 6 ms 3164 KB Correct
87 Correct 5 ms 2908 KB Correct
88 Correct 7 ms 3056 KB Correct
89 Correct 5 ms 2908 KB Correct
90 Correct 0 ms 344 KB Correct
91 Correct 6 ms 3164 KB Correct
92 Correct 6 ms 3160 KB Correct
93 Correct 5 ms 2652 KB Correct
94 Correct 3 ms 2140 KB Correct
95 Correct 4 ms 2396 KB Correct
96 Correct 5 ms 2652 KB Correct
97 Correct 5 ms 2904 KB Correct
98 Correct 7 ms 2696 KB Correct
99 Correct 5 ms 2648 KB Correct
100 Correct 4 ms 2648 KB Correct
101 Correct 4 ms 2396 KB Correct
102 Correct 4 ms 2392 KB Correct
103 Correct 4 ms 2372 KB Correct
104 Correct 6 ms 3164 KB Correct
105 Correct 5 ms 2944 KB Correct
106 Correct 6 ms 3180 KB Correct
107 Correct 6 ms 2908 KB Correct
108 Correct 1 ms 348 KB Correct
109 Correct 0 ms 348 KB Correct
110 Correct 0 ms 348 KB Correct
111 Correct 0 ms 600 KB Correct
112 Correct 0 ms 348 KB Correct
113 Correct 0 ms 348 KB Correct
114 Correct 0 ms 348 KB Correct
115 Correct 16 ms 6688 KB Correct
116 Correct 18 ms 6236 KB Correct
117 Correct 8 ms 3676 KB Correct
118 Correct 13 ms 5432 KB Correct
119 Correct 94 ms 42280 KB Correct
120 Correct 87 ms 41560 KB Correct
121 Correct 71 ms 35608 KB Correct
122 Correct 61 ms 37184 KB Correct
123 Correct 79 ms 40948 KB Correct
124 Correct 91 ms 43564 KB Correct
125 Correct 92 ms 39056 KB Correct
126 Correct 88 ms 43816 KB Correct
127 Correct 87 ms 43680 KB Correct
128 Correct 74 ms 43900 KB Correct
129 Correct 72 ms 43824 KB Correct
130 Correct 0 ms 348 KB Correct
131 Correct 6 ms 3164 KB Correct
132 Correct 6 ms 3164 KB Correct
133 Correct 5 ms 2648 KB Correct
134 Correct 3 ms 2140 KB Correct
135 Correct 6 ms 2388 KB Correct
136 Correct 5 ms 2652 KB Correct
137 Correct 5 ms 3160 KB Correct
138 Correct 5 ms 2904 KB Correct
139 Correct 5 ms 2652 KB Correct
140 Correct 4 ms 2652 KB Correct
141 Correct 4 ms 2396 KB Correct
142 Correct 3 ms 2396 KB Correct
143 Correct 4 ms 2396 KB Correct
144 Correct 331 ms 126836 KB Correct
145 Correct 347 ms 157772 KB Correct
146 Correct 80 ms 34768 KB Correct
147 Correct 110 ms 53036 KB Correct
148 Correct 306 ms 142448 KB Correct
149 Correct 319 ms 122120 KB Correct
150 Correct 344 ms 128564 KB Correct
151 Correct 370 ms 169092 KB Correct
152 Correct 298 ms 138620 KB Correct
153 Correct 285 ms 114524 KB Correct
154 Correct 342 ms 126760 KB Correct
155 Correct 182 ms 94492 KB Correct
156 Correct 185 ms 92104 KB Correct
157 Correct 175 ms 94172 KB Correct
158 Correct 178 ms 92116 KB Correct
159 Correct 172 ms 93396 KB Correct
160 Correct 178 ms 95704 KB Correct
161 Correct 183 ms 90172 KB Correct
162 Correct 191 ms 95236 KB Correct
163 Correct 237 ms 116804 KB Correct
164 Correct 244 ms 120372 KB Correct
165 Correct 90 ms 42280 KB Correct
166 Correct 88 ms 41468 KB Correct
167 Correct 72 ms 35600 KB Correct
168 Correct 61 ms 37180 KB Correct
169 Correct 85 ms 41024 KB Correct
170 Correct 93 ms 43524 KB Correct
171 Correct 91 ms 38968 KB Correct
172 Correct 90 ms 43832 KB Correct
173 Correct 88 ms 43824 KB Correct
174 Correct 90 ms 43868 KB Correct
175 Correct 73 ms 43828 KB Correct
176 Correct 0 ms 348 KB Correct
177 Correct 6 ms 3164 KB Correct
178 Correct 6 ms 3160 KB Correct
179 Correct 4 ms 2652 KB Correct
180 Correct 3 ms 2140 KB Correct
181 Correct 4 ms 2392 KB Correct
182 Correct 4 ms 2652 KB Correct
183 Correct 5 ms 2904 KB Correct
184 Correct 5 ms 2672 KB Correct
185 Correct 5 ms 2652 KB Correct
186 Correct 4 ms 2652 KB Correct
187 Correct 4 ms 2396 KB Correct
188 Correct 4 ms 2548 KB Correct
189 Correct 4 ms 2396 KB Correct
190 Correct 346 ms 126836 KB Correct
191 Correct 353 ms 157740 KB Correct
192 Correct 71 ms 34512 KB Correct
193 Correct 112 ms 53036 KB Correct
194 Correct 313 ms 142448 KB Correct
195 Correct 307 ms 122096 KB Correct
196 Correct 343 ms 128584 KB Correct
197 Correct 376 ms 169264 KB Correct
198 Correct 300 ms 138708 KB Correct
199 Correct 288 ms 114532 KB Correct
200 Correct 321 ms 126708 KB Correct
201 Correct 181 ms 94400 KB Correct
202 Correct 177 ms 92228 KB Correct
203 Correct 183 ms 94160 KB Correct
204 Correct 181 ms 92116 KB Correct
205 Correct 186 ms 93396 KB Correct
206 Correct 178 ms 95700 KB Correct
207 Correct 181 ms 90068 KB Correct
208 Correct 185 ms 95316 KB Correct
209 Correct 230 ms 116788 KB Correct
210 Correct 250 ms 120376 KB Correct
211 Correct 103 ms 47604 KB Correct
212 Correct 68 ms 36416 KB Correct
213 Correct 86 ms 41920 KB Correct
214 Correct 6 ms 3160 KB Correct
215 Correct 5 ms 2908 KB Correct
216 Correct 5 ms 2928 KB Correct
217 Correct 5 ms 2908 KB Correct
218 Correct 375 ms 133148 KB Correct
219 Correct 369 ms 160056 KB Correct
220 Correct 53 ms 27896 KB Correct
221 Correct 373 ms 133584 KB Correct
222 Correct 384 ms 133432 KB Correct
223 Correct 402 ms 172480 KB Correct
224 Correct 355 ms 129392 KB Correct
225 Correct 92 ms 42280 KB Correct
226 Correct 86 ms 41556 KB Correct
227 Correct 74 ms 35664 KB Correct
228 Correct 63 ms 36984 KB Correct
229 Correct 78 ms 41004 KB Correct
230 Correct 96 ms 43564 KB Correct
231 Correct 97 ms 38968 KB Correct
232 Correct 90 ms 43924 KB Correct
233 Correct 87 ms 43808 KB Correct
234 Correct 79 ms 43816 KB Correct
235 Correct 73 ms 43716 KB Correct
236 Correct 0 ms 348 KB Correct
237 Correct 6 ms 3172 KB Correct
238 Correct 6 ms 3164 KB Correct
239 Correct 4 ms 2652 KB Correct
240 Correct 3 ms 2140 KB Correct
241 Correct 4 ms 2396 KB Correct
242 Correct 4 ms 2652 KB Correct
243 Correct 5 ms 2908 KB Correct
244 Correct 5 ms 2668 KB Correct
245 Correct 5 ms 2652 KB Correct
246 Correct 4 ms 2652 KB Correct
247 Correct 4 ms 2396 KB Correct
248 Correct 4 ms 2396 KB Correct
249 Correct 4 ms 2392 KB Correct
250 Correct 330 ms 126832 KB Correct
251 Correct 346 ms 157740 KB Correct
252 Correct 75 ms 34520 KB Correct
253 Correct 117 ms 52956 KB Correct
254 Correct 304 ms 142448 KB Correct
255 Correct 320 ms 122140 KB Correct
256 Correct 342 ms 128644 KB Correct
257 Correct 375 ms 169092 KB Correct
258 Correct 311 ms 138664 KB Correct
259 Correct 299 ms 114424 KB Correct
260 Correct 359 ms 126888 KB Correct
261 Correct 177 ms 94424 KB Correct
262 Correct 177 ms 92160 KB Correct
263 Correct 174 ms 93980 KB Correct
264 Correct 176 ms 92224 KB Correct
265 Correct 178 ms 93376 KB Correct
266 Correct 190 ms 95708 KB Correct
267 Correct 181 ms 90068 KB Correct
268 Correct 181 ms 95192 KB Correct
269 Correct 270 ms 116792 KB Correct
270 Correct 242 ms 120248 KB Correct
271 Correct 97 ms 47656 KB Correct
272 Correct 62 ms 36500 KB Correct
273 Correct 88 ms 42048 KB Correct
274 Correct 6 ms 3160 KB Correct
275 Correct 6 ms 2908 KB Correct
276 Correct 6 ms 2928 KB Correct
277 Correct 5 ms 2908 KB Correct
278 Correct 363 ms 133328 KB Correct
279 Correct 353 ms 160048 KB Correct
280 Correct 53 ms 27832 KB Correct
281 Correct 376 ms 133480 KB Correct
282 Correct 369 ms 133304 KB Correct
283 Correct 386 ms 172620 KB Correct
284 Correct 364 ms 129208 KB Correct
285 Correct 0 ms 344 KB Correct
286 Correct 0 ms 348 KB Correct
287 Correct 0 ms 348 KB Correct
288 Correct 0 ms 348 KB Correct
289 Correct 0 ms 348 KB Correct
290 Correct 0 ms 348 KB Correct
291 Correct 0 ms 348 KB Correct
292 Correct 56 ms 27396 KB Correct
293 Correct 2 ms 3160 KB Correct
294 Correct 16 ms 6688 KB Correct
295 Correct 18 ms 6236 KB Correct
296 Correct 8 ms 3676 KB Correct
297 Correct 8 ms 5476 KB Correct
298 Correct 423 ms 136984 KB Correct
299 Correct 481 ms 160304 KB Correct
300 Correct 383 ms 169524 KB Correct
301 Correct 376 ms 171316 KB Correct
302 Correct 365 ms 169512 KB Correct
303 Correct 359 ms 134456 KB Correct
304 Correct 450 ms 138988 KB Correct
305 Correct 439 ms 139220 KB Correct
306 Correct 470 ms 142164 KB Correct
307 Correct 344 ms 129584 KB Correct