Submission #293997

# Submission time Handle Problem Language Result Execution time Memory
293997 2020-09-08T14:19:15 Z crossing0ver Interval Collection (CCO20_day2problem2) C++17
25 / 25
3279 ms 386628 KB
#include<bits/stdc++.h>
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define pb push_back
using namespace std;
const int N = 1e6+6,inf = 1e8;
int F[N],ANS[N];
vector<pii> Q[N*4];
int l1,r1,QL,QR;
void qer(int v,int tl,int tr) {
    if (l1 > tr || r1 < tl) return;
    if (l1 <= tl && r1  >= tr) {
        Q[v].pb({QL,QR});
        return;
    }
    int tm = (tl + tr)/2;
    qer(v*2,tl,tm);
    qer(v*2+1,tm+1,tr);
}
int cans=INT_MAX;
int t[2][4*N],timer;
int *H[100000000];
int val[100000000];
void change(int&x,int c) {
    H[++timer] = &x;
    val[timer] = x;
    x = c;
}
void rollback() {
    (*H[timer--]) = val[timer];
}
bool type;
int VAL,pos,L,R;
int BIT[2][N];
const int REV = 1e6+1;
void add1(int pos,int val,bool type) {
    if (type) {
    for (;pos <= 1e6; pos += pos&-pos)
        if (BIT[1][pos] < val)
            change(BIT[1][pos],val);
    }
    else {
        for (;pos <= 1e6; pos += pos&-pos)
        if (BIT[0][pos] > val)
            change(BIT[0][pos],val);
    }
}
int get1(int pos,bool type) {
    if (type == 0) {
        int s = inf;
    for (;pos;pos -= pos&-pos)
        s = min(s,BIT[0][pos]);
        return s;
    }else {
            int s = -inf;
    for (;pos;pos -= pos&-pos)
        s = max(s,BIT[1][pos]);
        return s;
    }
}
int L1=-inf,R1=inf,AR1[N],AL1[N],HANS=inf;

void dfs(int v,int tl,int tr) {
    int in_ans = cans;
    int start_time = timer;
    for (auto& i1 : Q[v]) {
        int l = i1.fi;
        int r = i1.se;
        if (R1 > r)
            change(R1,r);
        if (L1 < l)
            change(L1,l);
        if (AR1[l] > r)
            change(AR1[l],r);
        if (AL1[r] < l)
            change(AL1[r],l);
        {
        int l2 = L1;
        int r2 = R1;
        int len = max(0,r2 - l2);
        if (len) {
        int r3 = AR1[l2];
        int l3 = AL1[r2];
        change(HANS,r3-l3);
        add1(REV-l,r,0); // l-ze patara r-ebshi udidesi l, r-ze did l-ebshi umciresi r
        add1(r,l,1);
        continue;
        }
        }
        if (cans > r - l) {
        cans = min(cans, -l + get1(REV - r,0));
        }
        if (cans > r - l)
        cans = min(cans, r - get1(l,1));
        add1(REV-l,r,0); // l-ze patara r-ebshi udidesi l, r-ze did l-ebshi umciresi r
        add1(r,l,1);
    }
    if (tl != tr) {
        int tm = (tl + tr)/2;
        dfs(v*2,tl,tm);
        dfs(v*2+1,tm+1,tr);
    }else {
                if (cans > 1000000)
                ANS[tl] = HANS;
        else
            ANS[tl] = cans;
    }
    while(start_time != timer)
        rollback();
    cans = in_ans;
}
main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int q;
    cin >> q;
    for (int i =  0; i < N; i++)
        AR1[i] = BIT[0][i] = inf,AL1[i] = BIT[1][i]=-inf;
    for (int i = 0; i < 4*N;i ++)
        t[0][i] = inf, t[1][i] = -inf;
    vector<pair<pii,char> > query(q+1);
    vector<pii> t(q);
    for (int i = 1; i <= q; i++) {
        char c;
        int l,r;
        cin >> c >> l >> r;
        query[i] = {{l,r},c};
        t[i-1] = {l,r};
    }
    sort(all(t));
    t.resize(unique(all(t)) - t.begin());
    map<pii,int> ID;
    for (int i = 0; i < t.size(); i++) {
        ID[t[i]] = i;
    }
    set<int> cnt[1000005];
    for (int i = 1; i <= q; i++) {
            char c=  query[i].se;
    int l = query[i].fi.fi;
    int r = query[i].fi.se;
    int id = ID[{l,r}];
        if (c == 'A')
                cnt[id].insert(i);
                else {
                        l1=*cnt[id].begin();
                        r1 = i-1;
                        QL= l;
                        QR = r;
            qer(1,1,q);
            cnt[id].erase(cnt[id].begin());
        }
            F[i] = 1;
        }
        for (int i= 0; i < t.size(); i++)
            for (int j : cnt[i]) {
                l1 = j;
                r1 = q;
                QL = t[i].fi;
                QR = t[i].se;
                qer(1,1,q);
            }
        dfs(1,1,q);
        for (int i = 1; i <= q; i++)
            cout << ANS[i] <<'\n';
}

Compilation message

Main.cpp: In function 'void rollback()':
Main.cpp:38:14: warning: operation on 'timer' may be undefined [-Wsequence-point]
   38 |     (*H[timer--]) = val[timer];
      |         ~~~~~^~
Main.cpp:38:14: warning: operation on 'timer' may be undefined [-Wsequence-point]
Main.cpp: In function 'int get1(int, bool)':
Main.cpp:59:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   59 |     for (;pos;pos -= pos&-pos)
      |     ^~~
Main.cpp:61:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   61 |         return s;
      |         ^~~~~~
Main.cpp:64:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   64 |     for (;pos;pos -= pos&-pos)
      |     ^~~
Main.cpp:66:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   66 |         return s;
      |         ^~~~~~
Main.cpp: At global scope:
Main.cpp:120:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
  120 | main() {
      |      ^
Main.cpp: In function 'int main()':
Main.cpp:142:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  142 |     for (int i = 0; i < t.size(); i++) {
      |                     ~~^~~~~~~~~~
Main.cpp:163:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  163 |         for (int i= 0; i < t.size(); i++)
      |                        ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 125 ms 188408 KB Output is correct
2 Correct 124 ms 188280 KB Output is correct
3 Correct 122 ms 188284 KB Output is correct
4 Correct 129 ms 188280 KB Output is correct
5 Correct 125 ms 188408 KB Output is correct
6 Correct 124 ms 188280 KB Output is correct
7 Correct 124 ms 188280 KB Output is correct
8 Correct 122 ms 188280 KB Output is correct
9 Correct 129 ms 188408 KB Output is correct
10 Correct 125 ms 188440 KB Output is correct
11 Correct 122 ms 188380 KB Output is correct
12 Correct 122 ms 188408 KB Output is correct
13 Correct 122 ms 188600 KB Output is correct
14 Correct 124 ms 188408 KB Output is correct
15 Correct 121 ms 188408 KB Output is correct
16 Correct 124 ms 188536 KB Output is correct
17 Correct 124 ms 188408 KB Output is correct
18 Correct 121 ms 188320 KB Output is correct
19 Correct 131 ms 188280 KB Output is correct
20 Correct 126 ms 188280 KB Output is correct
21 Correct 126 ms 188408 KB Output is correct
22 Correct 121 ms 188280 KB Output is correct
23 Correct 125 ms 188280 KB Output is correct
24 Correct 123 ms 188408 KB Output is correct
25 Correct 130 ms 188408 KB Output is correct
26 Correct 118 ms 188408 KB Output is correct
27 Correct 118 ms 188408 KB Output is correct
28 Correct 121 ms 188408 KB Output is correct
29 Correct 133 ms 188408 KB Output is correct
30 Correct 128 ms 188420 KB Output is correct
31 Correct 132 ms 188440 KB Output is correct
32 Correct 130 ms 188424 KB Output is correct
33 Correct 123 ms 188316 KB Output is correct
34 Correct 127 ms 188308 KB Output is correct
35 Correct 121 ms 188260 KB Output is correct
36 Correct 123 ms 188284 KB Output is correct
37 Correct 123 ms 188280 KB Output is correct
38 Correct 121 ms 188280 KB Output is correct
39 Correct 122 ms 188284 KB Output is correct
40 Correct 119 ms 188280 KB Output is correct
41 Correct 122 ms 188408 KB Output is correct
42 Correct 122 ms 188280 KB Output is correct
43 Correct 123 ms 188252 KB Output is correct
44 Correct 124 ms 188280 KB Output is correct
45 Correct 121 ms 188408 KB Output is correct
46 Correct 124 ms 188280 KB Output is correct
47 Correct 121 ms 188352 KB Output is correct
48 Correct 120 ms 188408 KB Output is correct
49 Correct 124 ms 188408 KB Output is correct
50 Correct 124 ms 188280 KB Output is correct
51 Correct 127 ms 188408 KB Output is correct
52 Correct 126 ms 188280 KB Output is correct
53 Correct 124 ms 188408 KB Output is correct
54 Correct 123 ms 188280 KB Output is correct
55 Correct 122 ms 188408 KB Output is correct
56 Correct 125 ms 188280 KB Output is correct
57 Correct 122 ms 188408 KB Output is correct
58 Correct 123 ms 188280 KB Output is correct
59 Correct 121 ms 188408 KB Output is correct
60 Correct 122 ms 188408 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 125 ms 188408 KB Output is correct
2 Correct 124 ms 188280 KB Output is correct
3 Correct 122 ms 188284 KB Output is correct
4 Correct 129 ms 188280 KB Output is correct
5 Correct 125 ms 188408 KB Output is correct
6 Correct 124 ms 188280 KB Output is correct
7 Correct 124 ms 188280 KB Output is correct
8 Correct 122 ms 188280 KB Output is correct
9 Correct 129 ms 188408 KB Output is correct
10 Correct 125 ms 188440 KB Output is correct
11 Correct 122 ms 188380 KB Output is correct
12 Correct 122 ms 188408 KB Output is correct
13 Correct 122 ms 188600 KB Output is correct
14 Correct 124 ms 188408 KB Output is correct
15 Correct 121 ms 188408 KB Output is correct
16 Correct 124 ms 188536 KB Output is correct
17 Correct 124 ms 188408 KB Output is correct
18 Correct 121 ms 188320 KB Output is correct
19 Correct 131 ms 188280 KB Output is correct
20 Correct 126 ms 188280 KB Output is correct
21 Correct 126 ms 188408 KB Output is correct
22 Correct 121 ms 188280 KB Output is correct
23 Correct 125 ms 188280 KB Output is correct
24 Correct 123 ms 188408 KB Output is correct
25 Correct 130 ms 188408 KB Output is correct
26 Correct 118 ms 188408 KB Output is correct
27 Correct 118 ms 188408 KB Output is correct
28 Correct 121 ms 188408 KB Output is correct
29 Correct 133 ms 188408 KB Output is correct
30 Correct 128 ms 188420 KB Output is correct
31 Correct 132 ms 188440 KB Output is correct
32 Correct 130 ms 188424 KB Output is correct
33 Correct 123 ms 188316 KB Output is correct
34 Correct 127 ms 188308 KB Output is correct
35 Correct 121 ms 188260 KB Output is correct
36 Correct 123 ms 188284 KB Output is correct
37 Correct 123 ms 188280 KB Output is correct
38 Correct 121 ms 188280 KB Output is correct
39 Correct 122 ms 188284 KB Output is correct
40 Correct 119 ms 188280 KB Output is correct
41 Correct 122 ms 188408 KB Output is correct
42 Correct 122 ms 188280 KB Output is correct
43 Correct 123 ms 188252 KB Output is correct
44 Correct 124 ms 188280 KB Output is correct
45 Correct 121 ms 188408 KB Output is correct
46 Correct 124 ms 188280 KB Output is correct
47 Correct 121 ms 188352 KB Output is correct
48 Correct 120 ms 188408 KB Output is correct
49 Correct 124 ms 188408 KB Output is correct
50 Correct 124 ms 188280 KB Output is correct
51 Correct 127 ms 188408 KB Output is correct
52 Correct 126 ms 188280 KB Output is correct
53 Correct 124 ms 188408 KB Output is correct
54 Correct 123 ms 188280 KB Output is correct
55 Correct 122 ms 188408 KB Output is correct
56 Correct 125 ms 188280 KB Output is correct
57 Correct 122 ms 188408 KB Output is correct
58 Correct 123 ms 188280 KB Output is correct
59 Correct 121 ms 188408 KB Output is correct
60 Correct 122 ms 188408 KB Output is correct
61 Correct 121 ms 188408 KB Output is correct
62 Correct 121 ms 188388 KB Output is correct
63 Correct 129 ms 188224 KB Output is correct
64 Correct 157 ms 191736 KB Output is correct
65 Correct 150 ms 190456 KB Output is correct
66 Correct 151 ms 190152 KB Output is correct
67 Correct 135 ms 189560 KB Output is correct
68 Correct 158 ms 191736 KB Output is correct
69 Correct 153 ms 190584 KB Output is correct
70 Correct 151 ms 190072 KB Output is correct
71 Correct 147 ms 189944 KB Output is correct
72 Correct 163 ms 192504 KB Output is correct
73 Correct 161 ms 192120 KB Output is correct
74 Correct 159 ms 192120 KB Output is correct
75 Correct 160 ms 191992 KB Output is correct
76 Correct 161 ms 193040 KB Output is correct
77 Correct 161 ms 193016 KB Output is correct
78 Correct 162 ms 193016 KB Output is correct
79 Correct 163 ms 193016 KB Output is correct
80 Correct 158 ms 191800 KB Output is correct
81 Correct 149 ms 190456 KB Output is correct
82 Correct 149 ms 190064 KB Output is correct
83 Correct 137 ms 189560 KB Output is correct
84 Correct 160 ms 191736 KB Output is correct
85 Correct 154 ms 190456 KB Output is correct
86 Correct 148 ms 190200 KB Output is correct
87 Correct 144 ms 189944 KB Output is correct
88 Correct 157 ms 192504 KB Output is correct
89 Correct 160 ms 192120 KB Output is correct
90 Correct 156 ms 191992 KB Output is correct
91 Correct 165 ms 191864 KB Output is correct
92 Correct 162 ms 193016 KB Output is correct
93 Correct 161 ms 193016 KB Output is correct
94 Correct 157 ms 193016 KB Output is correct
95 Correct 163 ms 192888 KB Output is correct
96 Correct 138 ms 189688 KB Output is correct
97 Correct 134 ms 189560 KB Output is correct
98 Correct 135 ms 189560 KB Output is correct
99 Correct 136 ms 189560 KB Output is correct
100 Correct 145 ms 189944 KB Output is correct
101 Correct 146 ms 189816 KB Output is correct
102 Correct 156 ms 189944 KB Output is correct
103 Correct 141 ms 189560 KB Output is correct
104 Correct 162 ms 191608 KB Output is correct
105 Correct 152 ms 190472 KB Output is correct
106 Correct 147 ms 189996 KB Output is correct
107 Correct 137 ms 189560 KB Output is correct
108 Correct 153 ms 191096 KB Output is correct
109 Correct 150 ms 190356 KB Output is correct
110 Correct 146 ms 189944 KB Output is correct
111 Correct 139 ms 189552 KB Output is correct
112 Correct 147 ms 191352 KB Output is correct
113 Correct 146 ms 191224 KB Output is correct
114 Correct 148 ms 191352 KB Output is correct
115 Correct 146 ms 191096 KB Output is correct
116 Correct 145 ms 191352 KB Output is correct
117 Correct 146 ms 191352 KB Output is correct
118 Correct 146 ms 191352 KB Output is correct
119 Correct 149 ms 191224 KB Output is correct
120 Correct 140 ms 191352 KB Output is correct
121 Correct 145 ms 191352 KB Output is correct
122 Correct 160 ms 193528 KB Output is correct
123 Correct 155 ms 193272 KB Output is correct
124 Correct 156 ms 190392 KB Output is correct
125 Correct 140 ms 189944 KB Output is correct
126 Correct 143 ms 189816 KB Output is correct
127 Correct 149 ms 190532 KB Output is correct
128 Correct 142 ms 190072 KB Output is correct
129 Correct 140 ms 189816 KB Output is correct
130 Correct 150 ms 190712 KB Output is correct
131 Correct 144 ms 189944 KB Output is correct
132 Correct 143 ms 189868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 125 ms 188408 KB Output is correct
2 Correct 124 ms 188280 KB Output is correct
3 Correct 122 ms 188284 KB Output is correct
4 Correct 129 ms 188280 KB Output is correct
5 Correct 125 ms 188408 KB Output is correct
6 Correct 124 ms 188280 KB Output is correct
7 Correct 124 ms 188280 KB Output is correct
8 Correct 122 ms 188280 KB Output is correct
9 Correct 129 ms 188408 KB Output is correct
10 Correct 125 ms 188440 KB Output is correct
11 Correct 122 ms 188380 KB Output is correct
12 Correct 122 ms 188408 KB Output is correct
13 Correct 122 ms 188600 KB Output is correct
14 Correct 124 ms 188408 KB Output is correct
15 Correct 121 ms 188408 KB Output is correct
16 Correct 124 ms 188536 KB Output is correct
17 Correct 124 ms 188408 KB Output is correct
18 Correct 121 ms 188320 KB Output is correct
19 Correct 131 ms 188280 KB Output is correct
20 Correct 126 ms 188280 KB Output is correct
21 Correct 126 ms 188408 KB Output is correct
22 Correct 121 ms 188280 KB Output is correct
23 Correct 125 ms 188280 KB Output is correct
24 Correct 123 ms 188408 KB Output is correct
25 Correct 130 ms 188408 KB Output is correct
26 Correct 118 ms 188408 KB Output is correct
27 Correct 118 ms 188408 KB Output is correct
28 Correct 121 ms 188408 KB Output is correct
29 Correct 133 ms 188408 KB Output is correct
30 Correct 128 ms 188420 KB Output is correct
31 Correct 132 ms 188440 KB Output is correct
32 Correct 130 ms 188424 KB Output is correct
33 Correct 123 ms 188316 KB Output is correct
34 Correct 127 ms 188308 KB Output is correct
35 Correct 121 ms 188260 KB Output is correct
36 Correct 123 ms 188284 KB Output is correct
37 Correct 123 ms 188280 KB Output is correct
38 Correct 121 ms 188280 KB Output is correct
39 Correct 122 ms 188284 KB Output is correct
40 Correct 119 ms 188280 KB Output is correct
41 Correct 122 ms 188408 KB Output is correct
42 Correct 122 ms 188280 KB Output is correct
43 Correct 123 ms 188252 KB Output is correct
44 Correct 124 ms 188280 KB Output is correct
45 Correct 121 ms 188408 KB Output is correct
46 Correct 124 ms 188280 KB Output is correct
47 Correct 121 ms 188352 KB Output is correct
48 Correct 120 ms 188408 KB Output is correct
49 Correct 124 ms 188408 KB Output is correct
50 Correct 124 ms 188280 KB Output is correct
51 Correct 127 ms 188408 KB Output is correct
52 Correct 126 ms 188280 KB Output is correct
53 Correct 124 ms 188408 KB Output is correct
54 Correct 123 ms 188280 KB Output is correct
55 Correct 122 ms 188408 KB Output is correct
56 Correct 125 ms 188280 KB Output is correct
57 Correct 122 ms 188408 KB Output is correct
58 Correct 123 ms 188280 KB Output is correct
59 Correct 121 ms 188408 KB Output is correct
60 Correct 122 ms 188408 KB Output is correct
61 Correct 121 ms 188408 KB Output is correct
62 Correct 121 ms 188388 KB Output is correct
63 Correct 129 ms 188224 KB Output is correct
64 Correct 157 ms 191736 KB Output is correct
65 Correct 150 ms 190456 KB Output is correct
66 Correct 151 ms 190152 KB Output is correct
67 Correct 135 ms 189560 KB Output is correct
68 Correct 158 ms 191736 KB Output is correct
69 Correct 153 ms 190584 KB Output is correct
70 Correct 151 ms 190072 KB Output is correct
71 Correct 147 ms 189944 KB Output is correct
72 Correct 163 ms 192504 KB Output is correct
73 Correct 161 ms 192120 KB Output is correct
74 Correct 159 ms 192120 KB Output is correct
75 Correct 160 ms 191992 KB Output is correct
76 Correct 161 ms 193040 KB Output is correct
77 Correct 161 ms 193016 KB Output is correct
78 Correct 162 ms 193016 KB Output is correct
79 Correct 163 ms 193016 KB Output is correct
80 Correct 158 ms 191800 KB Output is correct
81 Correct 149 ms 190456 KB Output is correct
82 Correct 149 ms 190064 KB Output is correct
83 Correct 137 ms 189560 KB Output is correct
84 Correct 160 ms 191736 KB Output is correct
85 Correct 154 ms 190456 KB Output is correct
86 Correct 148 ms 190200 KB Output is correct
87 Correct 144 ms 189944 KB Output is correct
88 Correct 157 ms 192504 KB Output is correct
89 Correct 160 ms 192120 KB Output is correct
90 Correct 156 ms 191992 KB Output is correct
91 Correct 165 ms 191864 KB Output is correct
92 Correct 162 ms 193016 KB Output is correct
93 Correct 161 ms 193016 KB Output is correct
94 Correct 157 ms 193016 KB Output is correct
95 Correct 163 ms 192888 KB Output is correct
96 Correct 138 ms 189688 KB Output is correct
97 Correct 134 ms 189560 KB Output is correct
98 Correct 135 ms 189560 KB Output is correct
99 Correct 136 ms 189560 KB Output is correct
100 Correct 145 ms 189944 KB Output is correct
101 Correct 146 ms 189816 KB Output is correct
102 Correct 156 ms 189944 KB Output is correct
103 Correct 141 ms 189560 KB Output is correct
104 Correct 162 ms 191608 KB Output is correct
105 Correct 152 ms 190472 KB Output is correct
106 Correct 147 ms 189996 KB Output is correct
107 Correct 137 ms 189560 KB Output is correct
108 Correct 153 ms 191096 KB Output is correct
109 Correct 150 ms 190356 KB Output is correct
110 Correct 146 ms 189944 KB Output is correct
111 Correct 139 ms 189552 KB Output is correct
112 Correct 147 ms 191352 KB Output is correct
113 Correct 146 ms 191224 KB Output is correct
114 Correct 148 ms 191352 KB Output is correct
115 Correct 146 ms 191096 KB Output is correct
116 Correct 145 ms 191352 KB Output is correct
117 Correct 146 ms 191352 KB Output is correct
118 Correct 146 ms 191352 KB Output is correct
119 Correct 149 ms 191224 KB Output is correct
120 Correct 140 ms 191352 KB Output is correct
121 Correct 145 ms 191352 KB Output is correct
122 Correct 160 ms 193528 KB Output is correct
123 Correct 155 ms 193272 KB Output is correct
124 Correct 156 ms 190392 KB Output is correct
125 Correct 140 ms 189944 KB Output is correct
126 Correct 143 ms 189816 KB Output is correct
127 Correct 149 ms 190532 KB Output is correct
128 Correct 142 ms 190072 KB Output is correct
129 Correct 140 ms 189816 KB Output is correct
130 Correct 150 ms 190712 KB Output is correct
131 Correct 144 ms 189944 KB Output is correct
132 Correct 143 ms 189868 KB Output is correct
133 Correct 325 ms 202744 KB Output is correct
134 Correct 301 ms 197996 KB Output is correct
135 Correct 260 ms 196488 KB Output is correct
136 Correct 202 ms 194424 KB Output is correct
137 Correct 311 ms 202912 KB Output is correct
138 Correct 298 ms 197880 KB Output is correct
139 Correct 263 ms 196472 KB Output is correct
140 Correct 243 ms 195448 KB Output is correct
141 Correct 373 ms 205788 KB Output is correct
142 Correct 355 ms 204248 KB Output is correct
143 Correct 327 ms 203872 KB Output is correct
144 Correct 317 ms 203804 KB Output is correct
145 Correct 345 ms 207452 KB Output is correct
146 Correct 367 ms 207556 KB Output is correct
147 Correct 357 ms 207732 KB Output is correct
148 Correct 341 ms 207544 KB Output is correct
149 Correct 313 ms 202672 KB Output is correct
150 Correct 298 ms 197984 KB Output is correct
151 Correct 253 ms 196472 KB Output is correct
152 Correct 200 ms 194296 KB Output is correct
153 Correct 306 ms 202616 KB Output is correct
154 Correct 277 ms 197752 KB Output is correct
155 Correct 253 ms 196344 KB Output is correct
156 Correct 235 ms 195448 KB Output is correct
157 Correct 324 ms 205812 KB Output is correct
158 Correct 320 ms 204280 KB Output is correct
159 Correct 318 ms 203768 KB Output is correct
160 Correct 315 ms 203648 KB Output is correct
161 Correct 338 ms 207224 KB Output is correct
162 Correct 339 ms 207220 KB Output is correct
163 Correct 342 ms 207352 KB Output is correct
164 Correct 331 ms 207348 KB Output is correct
165 Correct 190 ms 193656 KB Output is correct
166 Correct 185 ms 193656 KB Output is correct
167 Correct 188 ms 193656 KB Output is correct
168 Correct 187 ms 193656 KB Output is correct
169 Correct 244 ms 195704 KB Output is correct
170 Correct 238 ms 195096 KB Output is correct
171 Correct 231 ms 194936 KB Output is correct
172 Correct 199 ms 193912 KB Output is correct
173 Correct 332 ms 202104 KB Output is correct
174 Correct 285 ms 197752 KB Output is correct
175 Correct 254 ms 196088 KB Output is correct
176 Correct 208 ms 194040 KB Output is correct
177 Correct 308 ms 199800 KB Output is correct
178 Correct 300 ms 197232 KB Output is correct
179 Correct 260 ms 195980 KB Output is correct
180 Correct 213 ms 193948 KB Output is correct
181 Correct 230 ms 201716 KB Output is correct
182 Correct 243 ms 201432 KB Output is correct
183 Correct 235 ms 201588 KB Output is correct
184 Correct 250 ms 201080 KB Output is correct
185 Correct 231 ms 201588 KB Output is correct
186 Correct 242 ms 201204 KB Output is correct
187 Correct 223 ms 201568 KB Output is correct
188 Correct 248 ms 201444 KB Output is correct
189 Correct 222 ms 201524 KB Output is correct
190 Correct 246 ms 201564 KB Output is correct
191 Correct 273 ms 209920 KB Output is correct
192 Correct 251 ms 208696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 760 ms 272612 KB Output is correct
2 Correct 678 ms 267900 KB Output is correct
3 Correct 1410 ms 352952 KB Output is correct
4 Correct 1256 ms 342232 KB Output is correct
5 Correct 1658 ms 386628 KB Output is correct
6 Correct 1594 ms 374700 KB Output is correct
7 Correct 2055 ms 262396 KB Output is correct
8 Correct 1483 ms 250196 KB Output is correct
9 Correct 1394 ms 248440 KB Output is correct
10 Correct 2089 ms 265700 KB Output is correct
11 Correct 1425 ms 250256 KB Output is correct
12 Correct 1380 ms 248592 KB Output is correct
13 Correct 2054 ms 267456 KB Output is correct
14 Correct 1456 ms 250404 KB Output is correct
15 Correct 1409 ms 248680 KB Output is correct
16 Correct 974 ms 238968 KB Output is correct
17 Correct 968 ms 238772 KB Output is correct
18 Correct 984 ms 238808 KB Output is correct
19 Correct 1026 ms 239120 KB Output is correct
20 Correct 986 ms 238956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 125 ms 188408 KB Output is correct
2 Correct 124 ms 188280 KB Output is correct
3 Correct 122 ms 188284 KB Output is correct
4 Correct 129 ms 188280 KB Output is correct
5 Correct 125 ms 188408 KB Output is correct
6 Correct 124 ms 188280 KB Output is correct
7 Correct 124 ms 188280 KB Output is correct
8 Correct 122 ms 188280 KB Output is correct
9 Correct 129 ms 188408 KB Output is correct
10 Correct 125 ms 188440 KB Output is correct
11 Correct 122 ms 188380 KB Output is correct
12 Correct 122 ms 188408 KB Output is correct
13 Correct 122 ms 188600 KB Output is correct
14 Correct 124 ms 188408 KB Output is correct
15 Correct 121 ms 188408 KB Output is correct
16 Correct 124 ms 188536 KB Output is correct
17 Correct 124 ms 188408 KB Output is correct
18 Correct 121 ms 188320 KB Output is correct
19 Correct 131 ms 188280 KB Output is correct
20 Correct 126 ms 188280 KB Output is correct
21 Correct 126 ms 188408 KB Output is correct
22 Correct 121 ms 188280 KB Output is correct
23 Correct 125 ms 188280 KB Output is correct
24 Correct 123 ms 188408 KB Output is correct
25 Correct 130 ms 188408 KB Output is correct
26 Correct 118 ms 188408 KB Output is correct
27 Correct 118 ms 188408 KB Output is correct
28 Correct 121 ms 188408 KB Output is correct
29 Correct 133 ms 188408 KB Output is correct
30 Correct 128 ms 188420 KB Output is correct
31 Correct 132 ms 188440 KB Output is correct
32 Correct 130 ms 188424 KB Output is correct
33 Correct 123 ms 188316 KB Output is correct
34 Correct 127 ms 188308 KB Output is correct
35 Correct 121 ms 188260 KB Output is correct
36 Correct 123 ms 188284 KB Output is correct
37 Correct 123 ms 188280 KB Output is correct
38 Correct 121 ms 188280 KB Output is correct
39 Correct 122 ms 188284 KB Output is correct
40 Correct 119 ms 188280 KB Output is correct
41 Correct 122 ms 188408 KB Output is correct
42 Correct 122 ms 188280 KB Output is correct
43 Correct 123 ms 188252 KB Output is correct
44 Correct 124 ms 188280 KB Output is correct
45 Correct 121 ms 188408 KB Output is correct
46 Correct 124 ms 188280 KB Output is correct
47 Correct 121 ms 188352 KB Output is correct
48 Correct 120 ms 188408 KB Output is correct
49 Correct 124 ms 188408 KB Output is correct
50 Correct 124 ms 188280 KB Output is correct
51 Correct 127 ms 188408 KB Output is correct
52 Correct 126 ms 188280 KB Output is correct
53 Correct 124 ms 188408 KB Output is correct
54 Correct 123 ms 188280 KB Output is correct
55 Correct 122 ms 188408 KB Output is correct
56 Correct 125 ms 188280 KB Output is correct
57 Correct 122 ms 188408 KB Output is correct
58 Correct 123 ms 188280 KB Output is correct
59 Correct 121 ms 188408 KB Output is correct
60 Correct 122 ms 188408 KB Output is correct
61 Correct 121 ms 188408 KB Output is correct
62 Correct 121 ms 188388 KB Output is correct
63 Correct 129 ms 188224 KB Output is correct
64 Correct 157 ms 191736 KB Output is correct
65 Correct 150 ms 190456 KB Output is correct
66 Correct 151 ms 190152 KB Output is correct
67 Correct 135 ms 189560 KB Output is correct
68 Correct 158 ms 191736 KB Output is correct
69 Correct 153 ms 190584 KB Output is correct
70 Correct 151 ms 190072 KB Output is correct
71 Correct 147 ms 189944 KB Output is correct
72 Correct 163 ms 192504 KB Output is correct
73 Correct 161 ms 192120 KB Output is correct
74 Correct 159 ms 192120 KB Output is correct
75 Correct 160 ms 191992 KB Output is correct
76 Correct 161 ms 193040 KB Output is correct
77 Correct 161 ms 193016 KB Output is correct
78 Correct 162 ms 193016 KB Output is correct
79 Correct 163 ms 193016 KB Output is correct
80 Correct 158 ms 191800 KB Output is correct
81 Correct 149 ms 190456 KB Output is correct
82 Correct 149 ms 190064 KB Output is correct
83 Correct 137 ms 189560 KB Output is correct
84 Correct 160 ms 191736 KB Output is correct
85 Correct 154 ms 190456 KB Output is correct
86 Correct 148 ms 190200 KB Output is correct
87 Correct 144 ms 189944 KB Output is correct
88 Correct 157 ms 192504 KB Output is correct
89 Correct 160 ms 192120 KB Output is correct
90 Correct 156 ms 191992 KB Output is correct
91 Correct 165 ms 191864 KB Output is correct
92 Correct 162 ms 193016 KB Output is correct
93 Correct 161 ms 193016 KB Output is correct
94 Correct 157 ms 193016 KB Output is correct
95 Correct 163 ms 192888 KB Output is correct
96 Correct 138 ms 189688 KB Output is correct
97 Correct 134 ms 189560 KB Output is correct
98 Correct 135 ms 189560 KB Output is correct
99 Correct 136 ms 189560 KB Output is correct
100 Correct 145 ms 189944 KB Output is correct
101 Correct 146 ms 189816 KB Output is correct
102 Correct 156 ms 189944 KB Output is correct
103 Correct 141 ms 189560 KB Output is correct
104 Correct 162 ms 191608 KB Output is correct
105 Correct 152 ms 190472 KB Output is correct
106 Correct 147 ms 189996 KB Output is correct
107 Correct 137 ms 189560 KB Output is correct
108 Correct 153 ms 191096 KB Output is correct
109 Correct 150 ms 190356 KB Output is correct
110 Correct 146 ms 189944 KB Output is correct
111 Correct 139 ms 189552 KB Output is correct
112 Correct 147 ms 191352 KB Output is correct
113 Correct 146 ms 191224 KB Output is correct
114 Correct 148 ms 191352 KB Output is correct
115 Correct 146 ms 191096 KB Output is correct
116 Correct 145 ms 191352 KB Output is correct
117 Correct 146 ms 191352 KB Output is correct
118 Correct 146 ms 191352 KB Output is correct
119 Correct 149 ms 191224 KB Output is correct
120 Correct 140 ms 191352 KB Output is correct
121 Correct 145 ms 191352 KB Output is correct
122 Correct 160 ms 193528 KB Output is correct
123 Correct 155 ms 193272 KB Output is correct
124 Correct 156 ms 190392 KB Output is correct
125 Correct 140 ms 189944 KB Output is correct
126 Correct 143 ms 189816 KB Output is correct
127 Correct 149 ms 190532 KB Output is correct
128 Correct 142 ms 190072 KB Output is correct
129 Correct 140 ms 189816 KB Output is correct
130 Correct 150 ms 190712 KB Output is correct
131 Correct 144 ms 189944 KB Output is correct
132 Correct 143 ms 189868 KB Output is correct
133 Correct 325 ms 202744 KB Output is correct
134 Correct 301 ms 197996 KB Output is correct
135 Correct 260 ms 196488 KB Output is correct
136 Correct 202 ms 194424 KB Output is correct
137 Correct 311 ms 202912 KB Output is correct
138 Correct 298 ms 197880 KB Output is correct
139 Correct 263 ms 196472 KB Output is correct
140 Correct 243 ms 195448 KB Output is correct
141 Correct 373 ms 205788 KB Output is correct
142 Correct 355 ms 204248 KB Output is correct
143 Correct 327 ms 203872 KB Output is correct
144 Correct 317 ms 203804 KB Output is correct
145 Correct 345 ms 207452 KB Output is correct
146 Correct 367 ms 207556 KB Output is correct
147 Correct 357 ms 207732 KB Output is correct
148 Correct 341 ms 207544 KB Output is correct
149 Correct 313 ms 202672 KB Output is correct
150 Correct 298 ms 197984 KB Output is correct
151 Correct 253 ms 196472 KB Output is correct
152 Correct 200 ms 194296 KB Output is correct
153 Correct 306 ms 202616 KB Output is correct
154 Correct 277 ms 197752 KB Output is correct
155 Correct 253 ms 196344 KB Output is correct
156 Correct 235 ms 195448 KB Output is correct
157 Correct 324 ms 205812 KB Output is correct
158 Correct 320 ms 204280 KB Output is correct
159 Correct 318 ms 203768 KB Output is correct
160 Correct 315 ms 203648 KB Output is correct
161 Correct 338 ms 207224 KB Output is correct
162 Correct 339 ms 207220 KB Output is correct
163 Correct 342 ms 207352 KB Output is correct
164 Correct 331 ms 207348 KB Output is correct
165 Correct 190 ms 193656 KB Output is correct
166 Correct 185 ms 193656 KB Output is correct
167 Correct 188 ms 193656 KB Output is correct
168 Correct 187 ms 193656 KB Output is correct
169 Correct 244 ms 195704 KB Output is correct
170 Correct 238 ms 195096 KB Output is correct
171 Correct 231 ms 194936 KB Output is correct
172 Correct 199 ms 193912 KB Output is correct
173 Correct 332 ms 202104 KB Output is correct
174 Correct 285 ms 197752 KB Output is correct
175 Correct 254 ms 196088 KB Output is correct
176 Correct 208 ms 194040 KB Output is correct
177 Correct 308 ms 199800 KB Output is correct
178 Correct 300 ms 197232 KB Output is correct
179 Correct 260 ms 195980 KB Output is correct
180 Correct 213 ms 193948 KB Output is correct
181 Correct 230 ms 201716 KB Output is correct
182 Correct 243 ms 201432 KB Output is correct
183 Correct 235 ms 201588 KB Output is correct
184 Correct 250 ms 201080 KB Output is correct
185 Correct 231 ms 201588 KB Output is correct
186 Correct 242 ms 201204 KB Output is correct
187 Correct 223 ms 201568 KB Output is correct
188 Correct 248 ms 201444 KB Output is correct
189 Correct 222 ms 201524 KB Output is correct
190 Correct 246 ms 201564 KB Output is correct
191 Correct 273 ms 209920 KB Output is correct
192 Correct 251 ms 208696 KB Output is correct
193 Correct 760 ms 272612 KB Output is correct
194 Correct 678 ms 267900 KB Output is correct
195 Correct 1410 ms 352952 KB Output is correct
196 Correct 1256 ms 342232 KB Output is correct
197 Correct 1658 ms 386628 KB Output is correct
198 Correct 1594 ms 374700 KB Output is correct
199 Correct 2055 ms 262396 KB Output is correct
200 Correct 1483 ms 250196 KB Output is correct
201 Correct 1394 ms 248440 KB Output is correct
202 Correct 2089 ms 265700 KB Output is correct
203 Correct 1425 ms 250256 KB Output is correct
204 Correct 1380 ms 248592 KB Output is correct
205 Correct 2054 ms 267456 KB Output is correct
206 Correct 1456 ms 250404 KB Output is correct
207 Correct 1409 ms 248680 KB Output is correct
208 Correct 974 ms 238968 KB Output is correct
209 Correct 968 ms 238772 KB Output is correct
210 Correct 984 ms 238808 KB Output is correct
211 Correct 1026 ms 239120 KB Output is correct
212 Correct 986 ms 238956 KB Output is correct
213 Correct 3052 ms 320996 KB Output is correct
214 Correct 2725 ms 277720 KB Output is correct
215 Correct 2300 ms 266088 KB Output is correct
216 Correct 1536 ms 250448 KB Output is correct
217 Correct 3279 ms 322120 KB Output is correct
218 Correct 2796 ms 279876 KB Output is correct
219 Correct 2362 ms 267544 KB Output is correct
220 Correct 1681 ms 254772 KB Output is correct
221 Correct 3059 ms 347248 KB Output is correct
222 Correct 3104 ms 332684 KB Output is correct
223 Correct 3037 ms 328776 KB Output is correct
224 Correct 3007 ms 328284 KB Output is correct
225 Correct 3058 ms 357836 KB Output is correct
226 Correct 3121 ms 356484 KB Output is correct
227 Correct 3215 ms 357964 KB Output is correct
228 Correct 3232 ms 358228 KB Output is correct
229 Correct 2894 ms 319328 KB Output is correct
230 Correct 2575 ms 276632 KB Output is correct
231 Correct 2202 ms 265236 KB Output is correct
232 Correct 1461 ms 249488 KB Output is correct
233 Correct 2880 ms 320044 KB Output is correct
234 Correct 2529 ms 278556 KB Output is correct
235 Correct 2248 ms 266872 KB Output is correct
236 Correct 1650 ms 254868 KB Output is correct
237 Correct 3168 ms 345512 KB Output is correct
238 Correct 3041 ms 329900 KB Output is correct
239 Correct 3079 ms 326796 KB Output is correct
240 Correct 3064 ms 326212 KB Output is correct
241 Correct 3205 ms 356212 KB Output is correct
242 Correct 3134 ms 356908 KB Output is correct
243 Correct 3131 ms 355836 KB Output is correct
244 Correct 3103 ms 355548 KB Output is correct
245 Correct 1064 ms 234676 KB Output is correct
246 Correct 1074 ms 234540 KB Output is correct
247 Correct 1066 ms 234616 KB Output is correct
248 Correct 1062 ms 234488 KB Output is correct
249 Correct 1689 ms 252168 KB Output is correct
250 Correct 1655 ms 253436 KB Output is correct
251 Correct 1706 ms 254452 KB Output is correct
252 Correct 1343 ms 243576 KB Output is correct
253 Correct 2892 ms 310792 KB Output is correct
254 Correct 2515 ms 276508 KB Output is correct
255 Correct 2180 ms 263664 KB Output is correct
256 Correct 1386 ms 244600 KB Output is correct
257 Correct 2635 ms 286448 KB Output is correct
258 Correct 2392 ms 269248 KB Output is correct
259 Correct 2094 ms 260340 KB Output is correct
260 Correct 1426 ms 243244 KB Output is correct
261 Correct 1397 ms 314544 KB Output is correct
262 Correct 2158 ms 312880 KB Output is correct
263 Correct 1134 ms 306736 KB Output is correct
264 Correct 1939 ms 302308 KB Output is correct
265 Correct 1406 ms 314580 KB Output is correct
266 Correct 2164 ms 313040 KB Output is correct
267 Correct 1090 ms 306900 KB Output is correct
268 Correct 1820 ms 302436 KB Output is correct
269 Correct 1655 ms 385944 KB Output is correct
270 Correct 1527 ms 373980 KB Output is correct
271 Correct 2035 ms 262324 KB Output is correct
272 Correct 1424 ms 249288 KB Output is correct
273 Correct 2092 ms 266680 KB Output is correct
274 Correct 1446 ms 249596 KB Output is correct
275 Correct 695 ms 255332 KB Output is correct