Submission #1041687

# Submission time Handle Problem Language Result Execution time Memory
1041687 2024-08-02T07:06:38 Z GEN(#11054) Brought Down the Grading Server? (CEOI23_balance) C++17
100 / 100
935 ms 74232 KB
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> A;
int B[100005]; // B[val] = id
int C[100005];
int D[100005]; // D[id] = sum
int E[100005]; // current
int N, S;
vector<vector<array<int, 4>>> adj2;
vector<int> path;
void Euler(int c) {
    while(adj2[c].size() > 0) {
        if(adj2[c].back()[1] == 0) {
            adj2[c].pop_back();
            continue;
        }
        int sz = adj2[c].size();
        adj2[c][sz-1][1]--;
        int a = adj2[c][sz-1][2], b = adj2[c][sz-1][3];
        if(adj2[a].size()>b) {
            adj2[a][b][1]--;
        }
        Euler(adj2[c][sz-1][0]);
    }
    path.push_back(c);
}
void addEdge(int u, int v) {
    //cout << "ADD : " << u << ' ' << v << '\n';
    int s1 = adj2[u].size(), s2 = adj2[v].size();
    adj2[u].push_back({v, 1, v, s2});
    adj2[v].push_back({u, 1, u, s1});
}
vector<int> DnC2(int s, int e, int a, int b) {
    int i, j;
    if(s>=e) return {};
    if(s+1==e) {
        vector<int> v;
        for(i=a;i<b;i++) v.push_back(A[s][i]);
        v.erase(unique(v.begin(),v.end()),v.end());
        return v;
    }
    int mid = (s+e)/2;
    vector<int> v1 = DnC2(s, mid, a, b);
    vector<int> v2 = DnC2(mid, e, a, b);
    vector<int> v;
    v.resize(v1.size()+v2.size());
    merge(v1.begin(),v1.end(),v2.begin(),v2.end(),v.begin());
    v.erase(unique(v.begin(),v.end()),v.end());
    return v;
}
vector<vector<array<int, 4>>> V;
void DnC(int s, int e) {
    if(e==s+1) return;
    int i, j;
    vector<int> S = DnC2(0, N, s, e);
    int T = S.size();
    for(i=0;i<T;i++) B[S[i]] = i;
    int mid = (s+e)/2;
    for(i=0;i<T;i++) {
        D[i] = 0;
    }
    for(i=0;i<N;i++) {
        for(j=s;j<e;j++) {
            D[B[A[i][j]]]++;
        }
    }
    adj2.clear();
    adj2.resize(T+N);
    vector<int> v;
    for(i=0;i<T;i++) {
        if(D[i] % 2 == 0) D[i] = 0;
        else v.push_back(i);
    }
    assert(v.size()%2==0);
    int sz = v.size();
    for(i=0;i<sz;i+=2) addEdge(N+v[i], N+v[i+1]);
    v.clear();
    V.clear();
    V.resize(N);
    for(i=0;i<N;i++) {
        for(j=s;j<e;) {
            int pt = j;
            while(pt+1<e&&A[i][j]==A[i][pt+1]) pt++;
            //[j ~ pt]
            V[i].push_back({j, pt, A[i][j], -1});
            j = pt + 1;
        }
        for(j=0;j<V[i].size();j++) {
            int v = V[i][j][1] - V[i][j][0] + 1;
            if(v % 2 == 0) V[i][j][3] = 0;
            if(v % 2 == 1) {
                addEdge(i, N+B[V[i][j][2]]);
            }
        }
    }
    //cout << "Adding Edge done\n";
    //Euler(0);
    vector<vector<array<int, 2>>> adj;
    //cout << s << ' ' << e << " Euler Done\n";
    adj.resize(N);
    for(j=N;j<T+N;j++) {
        path.clear();
        Euler(j);
        int cnt = 0;
        for(i=0;i+1<path.size();i++) {
            int x = path[i], y = path[i+1];
            if(x>y)swap(x, y);
            if(x < N && y >= N) {
                adj[x].push_back({y-N, 2*(cnt % 2)-1});
                cnt++;
            }
        }
    }
    for(i=0;i<N;i++) {
        /*cout << i << " : ";
        for(auto n : adj[i]) cout << "("<<n[0]<<", " << n[1] << ") ";
        cout << '\n';*/
        for(auto n : adj[i]) C[n[0]] = n[1];
        int l = s, r = mid;
        for(auto n : V[i]) {
            int a = -1, b = -1;
            int v = n[1] - n[0] + 1;
            if(v%2==0) a = v/2, b=v/2;
            else {
                if(C[B[n[2]]]==1) a = v/2+1, b = v/2;
                else a = v/2, b = v/2+1;
            }
            //cout << n[2] << " : " << a << ' ' << b <<'\n';
            assert(l+a-1<mid&&r+b-1<e);
            for(j=l;j<=l+a-1;j++) A[i][j] = n[2];
            l += a;
            for(j=r;j<=r+b-1;j++) A[i][j] = n[2];
            r += b;
        }
        assert(l == mid && r == e);
    }
    adj.clear();
    DnC(s, mid);
    DnC(mid, e);
}
signed main() {
    //cin.sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int T;
    cin >> N >> S >> T;
    A.resize(N);
    int i, j;
    for(i=0;i<N;i++) A[i].resize(S);
    for(i=0;i<N;i++) {
        for(j=0;j<S;j++) cin >> A[i][j];
    }
    for(i=0;i<N;i++) sort(A[i].begin(),A[i].end());
    DnC(0, S);
    for(i=0;i<N;i++) {
        for(j=0;j<S;j++)cout << A[i][j] << ' ';
        cout << '\n';
    }
}

Compilation message

balance.cpp: In function 'void Euler(int)':
balance.cpp:20:26: warning: comparison of integer expressions of different signedness: 'std::vector<std::array<int, 4> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |         if(adj2[a].size()>b) {
      |            ~~~~~~~~~~~~~~^~
balance.cpp: In function 'std::vector<int> DnC2(int, int, int, int)':
balance.cpp:34:12: warning: unused variable 'j' [-Wunused-variable]
   34 |     int i, j;
      |            ^
balance.cpp: In function 'void DnC(int, int)':
balance.cpp:88:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::array<int, 4> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   88 |         for(j=0;j<V[i].size();j++) {
      |                 ~^~~~~~~~~~~~
balance.cpp:105:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  105 |         for(i=0;i+1<path.size();i++) {
      |                 ~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 0 ms 600 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 127 ms 39608 KB Correct
2 Correct 116 ms 38728 KB Correct
3 Correct 105 ms 33796 KB Correct
4 Correct 71 ms 33420 KB Correct
5 Correct 107 ms 38084 KB Correct
6 Correct 126 ms 40636 KB Correct
7 Correct 125 ms 34112 KB Correct
8 Correct 121 ms 42012 KB Correct
9 Correct 107 ms 41840 KB Correct
10 Correct 87 ms 41084 KB Correct
11 Correct 84 ms 40828 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 127 ms 39608 KB Correct
2 Correct 116 ms 38728 KB Correct
3 Correct 105 ms 33796 KB Correct
4 Correct 71 ms 33420 KB Correct
5 Correct 107 ms 38084 KB Correct
6 Correct 126 ms 40636 KB Correct
7 Correct 125 ms 34112 KB Correct
8 Correct 121 ms 42012 KB Correct
9 Correct 107 ms 41840 KB Correct
10 Correct 87 ms 41084 KB Correct
11 Correct 84 ms 40828 KB Correct
12 Correct 132 ms 39512 KB Correct
13 Correct 134 ms 38724 KB Correct
14 Correct 97 ms 33792 KB Correct
15 Correct 75 ms 33420 KB Correct
16 Correct 108 ms 37992 KB Correct
17 Correct 147 ms 40716 KB Correct
18 Correct 129 ms 34028 KB Correct
19 Correct 106 ms 42024 KB Correct
20 Correct 108 ms 41648 KB Correct
21 Correct 83 ms 41088 KB Correct
22 Correct 84 ms 40828 KB Correct
23 Correct 138 ms 42880 KB Correct
24 Correct 82 ms 35216 KB Correct
25 Correct 140 ms 38852 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 127 ms 39608 KB Correct
9 Correct 116 ms 38728 KB Correct
10 Correct 105 ms 33796 KB Correct
11 Correct 71 ms 33420 KB Correct
12 Correct 107 ms 38084 KB Correct
13 Correct 126 ms 40636 KB Correct
14 Correct 125 ms 34112 KB Correct
15 Correct 121 ms 42012 KB Correct
16 Correct 107 ms 41840 KB Correct
17 Correct 87 ms 41084 KB Correct
18 Correct 84 ms 40828 KB Correct
19 Correct 132 ms 39512 KB Correct
20 Correct 134 ms 38724 KB Correct
21 Correct 97 ms 33792 KB Correct
22 Correct 75 ms 33420 KB Correct
23 Correct 108 ms 37992 KB Correct
24 Correct 147 ms 40716 KB Correct
25 Correct 129 ms 34028 KB Correct
26 Correct 106 ms 42024 KB Correct
27 Correct 108 ms 41648 KB Correct
28 Correct 83 ms 41088 KB Correct
29 Correct 84 ms 40828 KB Correct
30 Correct 138 ms 42880 KB Correct
31 Correct 82 ms 35216 KB Correct
32 Correct 140 ms 38852 KB Correct
33 Correct 0 ms 348 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 348 KB Correct
40 Correct 132 ms 39456 KB Correct
41 Correct 124 ms 38728 KB Correct
42 Correct 101 ms 33792 KB Correct
43 Correct 69 ms 33416 KB Correct
44 Correct 103 ms 38092 KB Correct
45 Correct 130 ms 40680 KB Correct
46 Correct 128 ms 33988 KB Correct
47 Correct 107 ms 42020 KB Correct
48 Correct 108 ms 41640 KB Correct
49 Correct 81 ms 41080 KB Correct
50 Correct 82 ms 40824 KB Correct
51 Correct 135 ms 42708 KB Correct
52 Correct 85 ms 35288 KB Correct
53 Correct 131 ms 39008 KB Correct
54 Correct 63 ms 23388 KB Correct
55 Correct 1 ms 1116 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Correct
2 Correct 9 ms 1016 KB Correct
3 Correct 5 ms 348 KB Correct
4 Correct 5 ms 1372 KB Correct
5 Correct 3 ms 1628 KB Correct
6 Correct 5 ms 2396 KB Correct
7 Correct 5 ms 1372 KB Correct
8 Correct 9 ms 1552 KB Correct
9 Correct 8 ms 1456 KB Correct
10 Correct 8 ms 1884 KB Correct
11 Correct 4 ms 1624 KB Correct
12 Correct 5 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 1 ms 344 KB Correct
2 Correct 9 ms 1016 KB Correct
3 Correct 5 ms 348 KB Correct
4 Correct 5 ms 1372 KB Correct
5 Correct 3 ms 1628 KB Correct
6 Correct 5 ms 2396 KB Correct
7 Correct 5 ms 1372 KB Correct
8 Correct 9 ms 1552 KB Correct
9 Correct 8 ms 1456 KB Correct
10 Correct 8 ms 1884 KB Correct
11 Correct 4 ms 1624 KB Correct
12 Correct 5 ms 2396 KB Correct
13 Correct 4 ms 2396 KB Correct
14 Correct 4 ms 2396 KB Correct
15 Correct 0 ms 348 KB Correct
16 Correct 9 ms 1180 KB Correct
17 Correct 5 ms 348 KB Correct
18 Correct 6 ms 1628 KB Correct
19 Correct 3 ms 1628 KB Correct
20 Correct 4 ms 2396 KB Correct
21 Correct 5 ms 1548 KB Correct
22 Correct 9 ms 1672 KB Correct
23 Correct 8 ms 1372 KB Correct
24 Correct 6 ms 2000 KB Correct
25 Correct 5 ms 1628 KB Correct
26 Correct 5 ms 2396 KB Correct
27 Correct 4 ms 2504 KB Correct
28 Correct 5 ms 2392 KB Correct
29 Correct 8 ms 1032 KB Correct
30 Correct 8 ms 1884 KB Correct
31 Correct 9 ms 1724 KB Correct
32 Correct 7 ms 1944 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Correct
2 Correct 9 ms 1016 KB Correct
3 Correct 5 ms 348 KB Correct
4 Correct 5 ms 1372 KB Correct
5 Correct 3 ms 1628 KB Correct
6 Correct 5 ms 2396 KB Correct
7 Correct 5 ms 1372 KB Correct
8 Correct 9 ms 1552 KB Correct
9 Correct 8 ms 1456 KB Correct
10 Correct 8 ms 1884 KB Correct
11 Correct 4 ms 1624 KB Correct
12 Correct 5 ms 2396 KB Correct
13 Correct 4 ms 2396 KB Correct
14 Correct 4 ms 2396 KB Correct
15 Correct 0 ms 348 KB Correct
16 Correct 9 ms 1180 KB Correct
17 Correct 5 ms 348 KB Correct
18 Correct 6 ms 1628 KB Correct
19 Correct 3 ms 1628 KB Correct
20 Correct 4 ms 2396 KB Correct
21 Correct 5 ms 1548 KB Correct
22 Correct 9 ms 1672 KB Correct
23 Correct 8 ms 1372 KB Correct
24 Correct 6 ms 2000 KB Correct
25 Correct 5 ms 1628 KB Correct
26 Correct 5 ms 2396 KB Correct
27 Correct 4 ms 2504 KB Correct
28 Correct 5 ms 2392 KB Correct
29 Correct 8 ms 1032 KB Correct
30 Correct 8 ms 1884 KB Correct
31 Correct 9 ms 1724 KB Correct
32 Correct 7 ms 1944 KB Correct
33 Correct 0 ms 344 KB Correct
34 Correct 10 ms 1116 KB Correct
35 Correct 6 ms 348 KB Correct
36 Correct 6 ms 1372 KB Correct
37 Correct 3 ms 1628 KB Correct
38 Correct 6 ms 2396 KB Correct
39 Correct 5 ms 1372 KB Correct
40 Correct 8 ms 1676 KB Correct
41 Correct 7 ms 1292 KB Correct
42 Correct 7 ms 1992 KB Correct
43 Correct 6 ms 1628 KB Correct
44 Correct 5 ms 2472 KB Correct
45 Correct 4 ms 2396 KB Correct
46 Correct 4 ms 2396 KB Correct
47 Correct 8 ms 860 KB Correct
48 Correct 8 ms 1884 KB Correct
49 Correct 9 ms 1628 KB Correct
50 Correct 7 ms 1860 KB Correct
51 Correct 0 ms 600 KB Correct
52 Correct 0 ms 348 KB Correct
53 Correct 0 ms 348 KB Correct
54 Correct 0 ms 348 KB Correct
55 Correct 0 ms 348 KB Correct
56 Correct 0 ms 348 KB Correct
57 Correct 0 ms 344 KB Correct
58 Correct 17 ms 2648 KB Correct
59 Correct 15 ms 2396 KB Correct
60 Correct 10 ms 2200 KB Correct
61 Correct 10 ms 2292 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 127 ms 39608 KB Correct
2 Correct 116 ms 38728 KB Correct
3 Correct 105 ms 33796 KB Correct
4 Correct 71 ms 33420 KB Correct
5 Correct 107 ms 38084 KB Correct
6 Correct 126 ms 40636 KB Correct
7 Correct 125 ms 34112 KB Correct
8 Correct 121 ms 42012 KB Correct
9 Correct 107 ms 41840 KB Correct
10 Correct 87 ms 41084 KB Correct
11 Correct 84 ms 40828 KB Correct
12 Correct 1 ms 344 KB Correct
13 Correct 9 ms 1016 KB Correct
14 Correct 5 ms 348 KB Correct
15 Correct 5 ms 1372 KB Correct
16 Correct 3 ms 1628 KB Correct
17 Correct 5 ms 2396 KB Correct
18 Correct 5 ms 1372 KB Correct
19 Correct 9 ms 1552 KB Correct
20 Correct 8 ms 1456 KB Correct
21 Correct 8 ms 1884 KB Correct
22 Correct 4 ms 1624 KB Correct
23 Correct 5 ms 2396 KB Correct
24 Correct 4 ms 2396 KB Correct
25 Correct 4 ms 2396 KB Correct
26 Correct 130 ms 39632 KB Correct
27 Correct 111 ms 38724 KB Correct
28 Correct 103 ms 33944 KB Correct
29 Correct 68 ms 33416 KB Correct
30 Correct 104 ms 38000 KB Correct
31 Correct 137 ms 40684 KB Correct
32 Correct 131 ms 33888 KB Correct
33 Correct 112 ms 42024 KB Correct
34 Correct 105 ms 41640 KB Correct
35 Correct 80 ms 41084 KB Correct
36 Correct 85 ms 40732 KB Correct
37 Correct 0 ms 344 KB Correct
38 Correct 9 ms 1116 KB Correct
39 Correct 5 ms 500 KB Correct
40 Correct 8 ms 1412 KB Correct
41 Correct 3 ms 1628 KB Correct
42 Correct 6 ms 2372 KB Correct
43 Correct 5 ms 1372 KB Correct
44 Correct 8 ms 1624 KB Correct
45 Correct 7 ms 1456 KB Correct
46 Correct 7 ms 1884 KB Correct
47 Correct 4 ms 1628 KB Correct
48 Correct 5 ms 2396 KB Correct
49 Correct 4 ms 2396 KB Correct
50 Correct 4 ms 2392 KB Correct
51 Correct 643 ms 60236 KB Correct
52 Correct 550 ms 13872 KB Correct
53 Correct 44 ms 1112 KB Correct
54 Correct 157 ms 12412 KB Correct
55 Correct 441 ms 11084 KB Correct
56 Correct 516 ms 49628 KB Correct
57 Correct 621 ms 62992 KB Correct
58 Correct 265 ms 3924 KB Correct
59 Correct 207 ms 3156 KB Correct
60 Correct 486 ms 43100 KB Correct
61 Correct 593 ms 46792 KB Correct
62 Correct 222 ms 44464 KB Correct
63 Correct 205 ms 44320 KB Correct
64 Correct 203 ms 44228 KB Correct
65 Correct 213 ms 44156 KB Correct
66 Correct 203 ms 44280 KB Correct
67 Correct 204 ms 44732 KB Correct
68 Correct 206 ms 44192 KB Correct
69 Correct 254 ms 44412 KB Correct
70 Correct 249 ms 29660 KB Correct
71 Correct 288 ms 29140 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 127 ms 39608 KB Correct
2 Correct 116 ms 38728 KB Correct
3 Correct 105 ms 33796 KB Correct
4 Correct 71 ms 33420 KB Correct
5 Correct 107 ms 38084 KB Correct
6 Correct 126 ms 40636 KB Correct
7 Correct 125 ms 34112 KB Correct
8 Correct 121 ms 42012 KB Correct
9 Correct 107 ms 41840 KB Correct
10 Correct 87 ms 41084 KB Correct
11 Correct 84 ms 40828 KB Correct
12 Correct 132 ms 39512 KB Correct
13 Correct 134 ms 38724 KB Correct
14 Correct 97 ms 33792 KB Correct
15 Correct 75 ms 33420 KB Correct
16 Correct 108 ms 37992 KB Correct
17 Correct 147 ms 40716 KB Correct
18 Correct 129 ms 34028 KB Correct
19 Correct 106 ms 42024 KB Correct
20 Correct 108 ms 41648 KB Correct
21 Correct 83 ms 41088 KB Correct
22 Correct 84 ms 40828 KB Correct
23 Correct 138 ms 42880 KB Correct
24 Correct 82 ms 35216 KB Correct
25 Correct 140 ms 38852 KB Correct
26 Correct 1 ms 344 KB Correct
27 Correct 9 ms 1016 KB Correct
28 Correct 5 ms 348 KB Correct
29 Correct 5 ms 1372 KB Correct
30 Correct 3 ms 1628 KB Correct
31 Correct 5 ms 2396 KB Correct
32 Correct 5 ms 1372 KB Correct
33 Correct 9 ms 1552 KB Correct
34 Correct 8 ms 1456 KB Correct
35 Correct 8 ms 1884 KB Correct
36 Correct 4 ms 1624 KB Correct
37 Correct 5 ms 2396 KB Correct
38 Correct 4 ms 2396 KB Correct
39 Correct 4 ms 2396 KB Correct
40 Correct 0 ms 348 KB Correct
41 Correct 9 ms 1180 KB Correct
42 Correct 5 ms 348 KB Correct
43 Correct 6 ms 1628 KB Correct
44 Correct 3 ms 1628 KB Correct
45 Correct 4 ms 2396 KB Correct
46 Correct 5 ms 1548 KB Correct
47 Correct 9 ms 1672 KB Correct
48 Correct 8 ms 1372 KB Correct
49 Correct 6 ms 2000 KB Correct
50 Correct 5 ms 1628 KB Correct
51 Correct 5 ms 2396 KB Correct
52 Correct 4 ms 2504 KB Correct
53 Correct 5 ms 2392 KB Correct
54 Correct 8 ms 1032 KB Correct
55 Correct 8 ms 1884 KB Correct
56 Correct 9 ms 1724 KB Correct
57 Correct 7 ms 1944 KB Correct
58 Correct 130 ms 39632 KB Correct
59 Correct 111 ms 38724 KB Correct
60 Correct 103 ms 33944 KB Correct
61 Correct 68 ms 33416 KB Correct
62 Correct 104 ms 38000 KB Correct
63 Correct 137 ms 40684 KB Correct
64 Correct 131 ms 33888 KB Correct
65 Correct 112 ms 42024 KB Correct
66 Correct 105 ms 41640 KB Correct
67 Correct 80 ms 41084 KB Correct
68 Correct 85 ms 40732 KB Correct
69 Correct 0 ms 344 KB Correct
70 Correct 9 ms 1116 KB Correct
71 Correct 5 ms 500 KB Correct
72 Correct 8 ms 1412 KB Correct
73 Correct 3 ms 1628 KB Correct
74 Correct 6 ms 2372 KB Correct
75 Correct 5 ms 1372 KB Correct
76 Correct 8 ms 1624 KB Correct
77 Correct 7 ms 1456 KB Correct
78 Correct 7 ms 1884 KB Correct
79 Correct 4 ms 1628 KB Correct
80 Correct 5 ms 2396 KB Correct
81 Correct 4 ms 2396 KB Correct
82 Correct 4 ms 2392 KB Correct
83 Correct 643 ms 60236 KB Correct
84 Correct 550 ms 13872 KB Correct
85 Correct 44 ms 1112 KB Correct
86 Correct 157 ms 12412 KB Correct
87 Correct 441 ms 11084 KB Correct
88 Correct 516 ms 49628 KB Correct
89 Correct 621 ms 62992 KB Correct
90 Correct 265 ms 3924 KB Correct
91 Correct 207 ms 3156 KB Correct
92 Correct 486 ms 43100 KB Correct
93 Correct 593 ms 46792 KB Correct
94 Correct 222 ms 44464 KB Correct
95 Correct 205 ms 44320 KB Correct
96 Correct 203 ms 44228 KB Correct
97 Correct 213 ms 44156 KB Correct
98 Correct 203 ms 44280 KB Correct
99 Correct 204 ms 44732 KB Correct
100 Correct 206 ms 44192 KB Correct
101 Correct 254 ms 44412 KB Correct
102 Correct 249 ms 29660 KB Correct
103 Correct 288 ms 29140 KB Correct
104 Correct 144 ms 39512 KB Correct
105 Correct 141 ms 38820 KB Correct
106 Correct 102 ms 33816 KB Correct
107 Correct 71 ms 33416 KB Correct
108 Correct 125 ms 38088 KB Correct
109 Correct 135 ms 40668 KB Correct
110 Correct 125 ms 34036 KB Correct
111 Correct 109 ms 41972 KB Correct
112 Correct 110 ms 41640 KB Correct
113 Correct 85 ms 41084 KB Correct
114 Correct 89 ms 40744 KB Correct
115 Correct 0 ms 348 KB Correct
116 Correct 9 ms 1116 KB Correct
117 Correct 5 ms 348 KB Correct
118 Correct 5 ms 1596 KB Correct
119 Correct 3 ms 1624 KB Correct
120 Correct 5 ms 2396 KB Correct
121 Correct 5 ms 1368 KB Correct
122 Correct 8 ms 1624 KB Correct
123 Correct 7 ms 1504 KB Correct
124 Correct 8 ms 1880 KB Correct
125 Correct 5 ms 1624 KB Correct
126 Correct 5 ms 2396 KB Correct
127 Correct 5 ms 2276 KB Correct
128 Correct 5 ms 2396 KB Correct
129 Correct 645 ms 60292 KB Correct
130 Correct 549 ms 13876 KB Correct
131 Correct 54 ms 1116 KB Correct
132 Correct 153 ms 12560 KB Correct
133 Correct 420 ms 11024 KB Correct
134 Correct 520 ms 49624 KB Correct
135 Correct 652 ms 62984 KB Correct
136 Correct 271 ms 4168 KB Correct
137 Correct 202 ms 3152 KB Correct
138 Correct 462 ms 43080 KB Correct
139 Correct 599 ms 46892 KB Correct
140 Correct 208 ms 44248 KB Correct
141 Correct 210 ms 44240 KB Correct
142 Correct 208 ms 44224 KB Correct
143 Correct 211 ms 44152 KB Correct
144 Correct 200 ms 44152 KB Correct
145 Correct 225 ms 44732 KB Correct
146 Correct 240 ms 44172 KB Correct
147 Correct 255 ms 44560 KB Correct
148 Correct 275 ms 29564 KB Correct
149 Correct 274 ms 29224 KB Correct
150 Correct 145 ms 42660 KB Correct
151 Correct 115 ms 35292 KB Correct
152 Correct 121 ms 38908 KB Correct
153 Correct 13 ms 856 KB Correct
154 Correct 8 ms 1884 KB Correct
155 Correct 9 ms 1624 KB Correct
156 Correct 12 ms 1884 KB Correct
157 Correct 862 ms 64816 KB Correct
158 Correct 698 ms 19016 KB Correct
159 Correct 115 ms 10580 KB Correct
160 Correct 935 ms 64868 KB Correct
161 Correct 748 ms 66004 KB Correct
162 Correct 303 ms 4176 KB Correct
163 Correct 715 ms 62452 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 0 ms 600 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 127 ms 39608 KB Correct
11 Correct 116 ms 38728 KB Correct
12 Correct 105 ms 33796 KB Correct
13 Correct 71 ms 33420 KB Correct
14 Correct 107 ms 38084 KB Correct
15 Correct 126 ms 40636 KB Correct
16 Correct 125 ms 34112 KB Correct
17 Correct 121 ms 42012 KB Correct
18 Correct 107 ms 41840 KB Correct
19 Correct 87 ms 41084 KB Correct
20 Correct 84 ms 40828 KB Correct
21 Correct 132 ms 39512 KB Correct
22 Correct 134 ms 38724 KB Correct
23 Correct 97 ms 33792 KB Correct
24 Correct 75 ms 33420 KB Correct
25 Correct 108 ms 37992 KB Correct
26 Correct 147 ms 40716 KB Correct
27 Correct 129 ms 34028 KB Correct
28 Correct 106 ms 42024 KB Correct
29 Correct 108 ms 41648 KB Correct
30 Correct 83 ms 41088 KB Correct
31 Correct 84 ms 40828 KB Correct
32 Correct 138 ms 42880 KB Correct
33 Correct 82 ms 35216 KB Correct
34 Correct 140 ms 38852 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 348 KB Correct
40 Correct 0 ms 348 KB Correct
41 Correct 0 ms 348 KB Correct
42 Correct 132 ms 39456 KB Correct
43 Correct 124 ms 38728 KB Correct
44 Correct 101 ms 33792 KB Correct
45 Correct 69 ms 33416 KB Correct
46 Correct 103 ms 38092 KB Correct
47 Correct 130 ms 40680 KB Correct
48 Correct 128 ms 33988 KB Correct
49 Correct 107 ms 42020 KB Correct
50 Correct 108 ms 41640 KB Correct
51 Correct 81 ms 41080 KB Correct
52 Correct 82 ms 40824 KB Correct
53 Correct 135 ms 42708 KB Correct
54 Correct 85 ms 35288 KB Correct
55 Correct 131 ms 39008 KB Correct
56 Correct 63 ms 23388 KB Correct
57 Correct 1 ms 1116 KB Correct
58 Correct 1 ms 344 KB Correct
59 Correct 9 ms 1016 KB Correct
60 Correct 5 ms 348 KB Correct
61 Correct 5 ms 1372 KB Correct
62 Correct 3 ms 1628 KB Correct
63 Correct 5 ms 2396 KB Correct
64 Correct 5 ms 1372 KB Correct
65 Correct 9 ms 1552 KB Correct
66 Correct 8 ms 1456 KB Correct
67 Correct 8 ms 1884 KB Correct
68 Correct 4 ms 1624 KB Correct
69 Correct 5 ms 2396 KB Correct
70 Correct 4 ms 2396 KB Correct
71 Correct 4 ms 2396 KB Correct
72 Correct 0 ms 348 KB Correct
73 Correct 9 ms 1180 KB Correct
74 Correct 5 ms 348 KB Correct
75 Correct 6 ms 1628 KB Correct
76 Correct 3 ms 1628 KB Correct
77 Correct 4 ms 2396 KB Correct
78 Correct 5 ms 1548 KB Correct
79 Correct 9 ms 1672 KB Correct
80 Correct 8 ms 1372 KB Correct
81 Correct 6 ms 2000 KB Correct
82 Correct 5 ms 1628 KB Correct
83 Correct 5 ms 2396 KB Correct
84 Correct 4 ms 2504 KB Correct
85 Correct 5 ms 2392 KB Correct
86 Correct 8 ms 1032 KB Correct
87 Correct 8 ms 1884 KB Correct
88 Correct 9 ms 1724 KB Correct
89 Correct 7 ms 1944 KB Correct
90 Correct 0 ms 344 KB Correct
91 Correct 10 ms 1116 KB Correct
92 Correct 6 ms 348 KB Correct
93 Correct 6 ms 1372 KB Correct
94 Correct 3 ms 1628 KB Correct
95 Correct 6 ms 2396 KB Correct
96 Correct 5 ms 1372 KB Correct
97 Correct 8 ms 1676 KB Correct
98 Correct 7 ms 1292 KB Correct
99 Correct 7 ms 1992 KB Correct
100 Correct 6 ms 1628 KB Correct
101 Correct 5 ms 2472 KB Correct
102 Correct 4 ms 2396 KB Correct
103 Correct 4 ms 2396 KB Correct
104 Correct 8 ms 860 KB Correct
105 Correct 8 ms 1884 KB Correct
106 Correct 9 ms 1628 KB Correct
107 Correct 7 ms 1860 KB Correct
108 Correct 0 ms 600 KB Correct
109 Correct 0 ms 348 KB Correct
110 Correct 0 ms 348 KB Correct
111 Correct 0 ms 348 KB Correct
112 Correct 0 ms 348 KB Correct
113 Correct 0 ms 348 KB Correct
114 Correct 0 ms 344 KB Correct
115 Correct 17 ms 2648 KB Correct
116 Correct 15 ms 2396 KB Correct
117 Correct 10 ms 2200 KB Correct
118 Correct 10 ms 2292 KB Correct
119 Correct 130 ms 39632 KB Correct
120 Correct 111 ms 38724 KB Correct
121 Correct 103 ms 33944 KB Correct
122 Correct 68 ms 33416 KB Correct
123 Correct 104 ms 38000 KB Correct
124 Correct 137 ms 40684 KB Correct
125 Correct 131 ms 33888 KB Correct
126 Correct 112 ms 42024 KB Correct
127 Correct 105 ms 41640 KB Correct
128 Correct 80 ms 41084 KB Correct
129 Correct 85 ms 40732 KB Correct
130 Correct 0 ms 344 KB Correct
131 Correct 9 ms 1116 KB Correct
132 Correct 5 ms 500 KB Correct
133 Correct 8 ms 1412 KB Correct
134 Correct 3 ms 1628 KB Correct
135 Correct 6 ms 2372 KB Correct
136 Correct 5 ms 1372 KB Correct
137 Correct 8 ms 1624 KB Correct
138 Correct 7 ms 1456 KB Correct
139 Correct 7 ms 1884 KB Correct
140 Correct 4 ms 1628 KB Correct
141 Correct 5 ms 2396 KB Correct
142 Correct 4 ms 2396 KB Correct
143 Correct 4 ms 2392 KB Correct
144 Correct 643 ms 60236 KB Correct
145 Correct 550 ms 13872 KB Correct
146 Correct 44 ms 1112 KB Correct
147 Correct 157 ms 12412 KB Correct
148 Correct 441 ms 11084 KB Correct
149 Correct 516 ms 49628 KB Correct
150 Correct 621 ms 62992 KB Correct
151 Correct 265 ms 3924 KB Correct
152 Correct 207 ms 3156 KB Correct
153 Correct 486 ms 43100 KB Correct
154 Correct 593 ms 46792 KB Correct
155 Correct 222 ms 44464 KB Correct
156 Correct 205 ms 44320 KB Correct
157 Correct 203 ms 44228 KB Correct
158 Correct 213 ms 44156 KB Correct
159 Correct 203 ms 44280 KB Correct
160 Correct 204 ms 44732 KB Correct
161 Correct 206 ms 44192 KB Correct
162 Correct 254 ms 44412 KB Correct
163 Correct 249 ms 29660 KB Correct
164 Correct 288 ms 29140 KB Correct
165 Correct 144 ms 39512 KB Correct
166 Correct 141 ms 38820 KB Correct
167 Correct 102 ms 33816 KB Correct
168 Correct 71 ms 33416 KB Correct
169 Correct 125 ms 38088 KB Correct
170 Correct 135 ms 40668 KB Correct
171 Correct 125 ms 34036 KB Correct
172 Correct 109 ms 41972 KB Correct
173 Correct 110 ms 41640 KB Correct
174 Correct 85 ms 41084 KB Correct
175 Correct 89 ms 40744 KB Correct
176 Correct 0 ms 348 KB Correct
177 Correct 9 ms 1116 KB Correct
178 Correct 5 ms 348 KB Correct
179 Correct 5 ms 1596 KB Correct
180 Correct 3 ms 1624 KB Correct
181 Correct 5 ms 2396 KB Correct
182 Correct 5 ms 1368 KB Correct
183 Correct 8 ms 1624 KB Correct
184 Correct 7 ms 1504 KB Correct
185 Correct 8 ms 1880 KB Correct
186 Correct 5 ms 1624 KB Correct
187 Correct 5 ms 2396 KB Correct
188 Correct 5 ms 2276 KB Correct
189 Correct 5 ms 2396 KB Correct
190 Correct 645 ms 60292 KB Correct
191 Correct 549 ms 13876 KB Correct
192 Correct 54 ms 1116 KB Correct
193 Correct 153 ms 12560 KB Correct
194 Correct 420 ms 11024 KB Correct
195 Correct 520 ms 49624 KB Correct
196 Correct 652 ms 62984 KB Correct
197 Correct 271 ms 4168 KB Correct
198 Correct 202 ms 3152 KB Correct
199 Correct 462 ms 43080 KB Correct
200 Correct 599 ms 46892 KB Correct
201 Correct 208 ms 44248 KB Correct
202 Correct 210 ms 44240 KB Correct
203 Correct 208 ms 44224 KB Correct
204 Correct 211 ms 44152 KB Correct
205 Correct 200 ms 44152 KB Correct
206 Correct 225 ms 44732 KB Correct
207 Correct 240 ms 44172 KB Correct
208 Correct 255 ms 44560 KB Correct
209 Correct 275 ms 29564 KB Correct
210 Correct 274 ms 29224 KB Correct
211 Correct 145 ms 42660 KB Correct
212 Correct 115 ms 35292 KB Correct
213 Correct 121 ms 38908 KB Correct
214 Correct 13 ms 856 KB Correct
215 Correct 8 ms 1884 KB Correct
216 Correct 9 ms 1624 KB Correct
217 Correct 12 ms 1884 KB Correct
218 Correct 862 ms 64816 KB Correct
219 Correct 698 ms 19016 KB Correct
220 Correct 115 ms 10580 KB Correct
221 Correct 935 ms 64868 KB Correct
222 Correct 748 ms 66004 KB Correct
223 Correct 303 ms 4176 KB Correct
224 Correct 715 ms 62452 KB Correct
225 Correct 156 ms 39464 KB Correct
226 Correct 117 ms 38696 KB Correct
227 Correct 123 ms 34000 KB Correct
228 Correct 66 ms 33416 KB Correct
229 Correct 111 ms 38112 KB Correct
230 Correct 127 ms 40680 KB Correct
231 Correct 146 ms 33996 KB Correct
232 Correct 113 ms 42024 KB Correct
233 Correct 136 ms 41644 KB Correct
234 Correct 113 ms 41036 KB Correct
235 Correct 123 ms 40824 KB Correct
236 Correct 0 ms 360 KB Correct
237 Correct 11 ms 1176 KB Correct
238 Correct 5 ms 520 KB Correct
239 Correct 5 ms 1568 KB Correct
240 Correct 3 ms 1680 KB Correct
241 Correct 8 ms 2396 KB Correct
242 Correct 5 ms 1372 KB Correct
243 Correct 8 ms 1580 KB Correct
244 Correct 12 ms 1368 KB Correct
245 Correct 7 ms 1884 KB Correct
246 Correct 5 ms 1628 KB Correct
247 Correct 7 ms 2396 KB Correct
248 Correct 8 ms 2396 KB Correct
249 Correct 4 ms 2396 KB Correct
250 Correct 738 ms 60352 KB Correct
251 Correct 608 ms 13888 KB Correct
252 Correct 48 ms 1112 KB Correct
253 Correct 160 ms 12476 KB Correct
254 Correct 415 ms 11256 KB Correct
255 Correct 586 ms 49596 KB Correct
256 Correct 663 ms 62980 KB Correct
257 Correct 288 ms 3924 KB Correct
258 Correct 233 ms 3152 KB Correct
259 Correct 535 ms 43088 KB Correct
260 Correct 605 ms 46896 KB Correct
261 Correct 252 ms 44256 KB Correct
262 Correct 256 ms 44316 KB Correct
263 Correct 217 ms 44288 KB Correct
264 Correct 206 ms 44148 KB Correct
265 Correct 251 ms 44108 KB Correct
266 Correct 236 ms 44656 KB Correct
267 Correct 235 ms 44452 KB Correct
268 Correct 206 ms 44452 KB Correct
269 Correct 279 ms 29796 KB Correct
270 Correct 248 ms 29144 KB Correct
271 Correct 186 ms 42860 KB Correct
272 Correct 97 ms 35192 KB Correct
273 Correct 152 ms 38908 KB Correct
274 Correct 9 ms 860 KB Correct
275 Correct 8 ms 1884 KB Correct
276 Correct 10 ms 1628 KB Correct
277 Correct 10 ms 1884 KB Correct
278 Correct 742 ms 64748 KB Correct
279 Correct 685 ms 19004 KB Correct
280 Correct 97 ms 10704 KB Correct
281 Correct 781 ms 64868 KB Correct
282 Correct 773 ms 65940 KB Correct
283 Correct 315 ms 4168 KB Correct
284 Correct 717 ms 62132 KB Correct
285 Correct 0 ms 348 KB Correct
286 Correct 0 ms 348 KB Correct
287 Correct 0 ms 344 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 63 ms 23492 KB Correct
293 Correct 2 ms 1112 KB Correct
294 Correct 18 ms 2652 KB Correct
295 Correct 23 ms 2384 KB Correct
296 Correct 15 ms 2192 KB Correct
297 Correct 11 ms 2136 KB Correct
298 Correct 881 ms 68464 KB Correct
299 Correct 909 ms 42968 KB Correct
300 Correct 287 ms 4804 KB Correct
301 Correct 286 ms 4172 KB Correct
302 Correct 300 ms 4176 KB Correct
303 Correct 755 ms 67692 KB Correct
304 Correct 795 ms 74232 KB Correct
305 Correct 841 ms 72324 KB Correct
306 Correct 861 ms 65648 KB Correct
307 Correct 629 ms 45868 KB Correct