Submission #267075

# Submission time Handle Problem Language Result Execution time Memory
267075 2020-08-15T19:07:33 Z ChrisT Interval Collection (CCO20_day2problem2) C++17
25 / 25
4700 ms 218816 KB
#include <bits/stdc++.h>

using namespace std;

struct node
{
    int maxl, minr, ans;
};

vector<node> seg;
vector<multiset<int>> lp, rp;
multiset<pair<int, int>> byl, byr;

node combine(node a, node b)
{
    node c;
    c.maxl=max(a.maxl, b.maxl);
    c.minr=min(a.minr, b.minr);
    c.ans=min(a.ans, b.ans);
    if(b.minr!=0x3f3f3f3f && a.maxl!=-0x3f3f3f3f)
        c.ans=min(c.ans, b.minr-a.maxl);
    return c;
}

void build(int idx, int begin, int end)
{
    if(begin==end)
        seg[idx].maxl=-0x3f3f3f3f, seg[idx].minr=0x3f3f3f3f, seg[idx].ans=0x3f3f3f3f;
    else
    {
        int mid=(begin+end)/2;
        build(idx*2, begin, mid);
        build(idx*2+1, mid+1, end);
        seg[idx]=combine(seg[idx*2], seg[idx*2+1]);
    }
}

void update(int idx, int begin, int end, int x, node v)
{
    if(x<begin || end<x)
        return;
    if(begin==end)
        seg[idx]=v;
    else
    {
        int mid=(begin+end)/2;
        update(idx*2, begin, mid, x, v);
        update(idx*2+1, mid+1, end, x, v);
        seg[idx]=combine(seg[idx*2], seg[idx*2+1]);
    }
}

void recalc(int x)
{
    node n;
    if(lp[x].empty())
        n.maxl=-0x3f3f3f3f;
    else
        n.maxl=*lp[x].rbegin();
    if(rp[x].empty())
        n.minr=0x3f3f3f3f;
    else
        n.minr=*rp[x].begin();
    if(n.minr!=0x3f3f3f3f && n.maxl!=-0x3f3f3f3f)
        n.ans=n.minr-n.maxl;
    else
        n.ans=0x3f3f3f3f;
    update(1, 1, seg.size()/2, x, n);
}

int get_ans()
{
    if(seg[1].ans>=0x3f3f3f3f)
    {
        int r=-byl.rbegin()->second;
        int l=-byr.begin()->second;
        return r-l;
    }
    return seg[1].ans;
}

void init(int n)
{
    int lg=0;
    while((1<<lg)<n)
        lg++;
    seg.resize(1<<(lg+1));
    lp.resize(n+1);
    rp.resize(n+1);
    build(1, 1, 1<<lg);
}

int add_interval(int l, int r)
{
    byl.insert({l, -r});
    byr.insert({r, -l});
    lp[r].insert(l);
    rp[l].insert(r);
    recalc(l);
    recalc(r);
    return get_ans();
}

int remove_interval(int l, int r)
{
    byl.erase(byl.find({l, -r}));
    byr.erase(byr.find({r, -l}));
    lp[r].erase(lp[r].find(l));
    rp[l].erase(rp[l].find(r));
    recalc(l);
    recalc(r);
    return get_ans();
}

int main()
{
    int n, q;
    scanf("%d", &q);
    n = 1000000;
    init(n);
    for(int i=0; i<q; i++)
    {
        char t;
        int l, r;
        scanf(" %c%d%d", &t, &l, &r);
        if(t=='A')
            printf("%d\n", add_interval(l, r));
        else
            printf("%d\n", remove_interval(l, r));
    }
    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:118:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  118 |     scanf("%d", &q);
      |     ~~~~~^~~~~~~~~~
Main.cpp:125:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  125 |         scanf(" %c%d%d", &t, &l, &r);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 131 ms 118904 KB Output is correct
2 Correct 113 ms 118904 KB Output is correct
3 Correct 109 ms 118844 KB Output is correct
4 Correct 107 ms 118904 KB Output is correct
5 Correct 118 ms 118928 KB Output is correct
6 Correct 107 ms 118904 KB Output is correct
7 Correct 110 ms 118948 KB Output is correct
8 Correct 104 ms 118956 KB Output is correct
9 Correct 114 ms 118988 KB Output is correct
10 Correct 104 ms 118904 KB Output is correct
11 Correct 109 ms 118940 KB Output is correct
12 Correct 109 ms 118988 KB Output is correct
13 Correct 114 ms 119032 KB Output is correct
14 Correct 106 ms 119012 KB Output is correct
15 Correct 113 ms 119012 KB Output is correct
16 Correct 127 ms 119016 KB Output is correct
17 Correct 117 ms 118952 KB Output is correct
18 Correct 106 ms 118932 KB Output is correct
19 Correct 106 ms 118904 KB Output is correct
20 Correct 114 ms 118964 KB Output is correct
21 Correct 107 ms 118940 KB Output is correct
22 Correct 120 ms 118932 KB Output is correct
23 Correct 103 ms 118936 KB Output is correct
24 Correct 117 ms 118880 KB Output is correct
25 Correct 104 ms 118936 KB Output is correct
26 Correct 130 ms 118936 KB Output is correct
27 Correct 105 ms 118936 KB Output is correct
28 Correct 132 ms 119004 KB Output is correct
29 Correct 128 ms 118904 KB Output is correct
30 Correct 120 ms 118904 KB Output is correct
31 Correct 123 ms 118964 KB Output is correct
32 Correct 107 ms 119032 KB Output is correct
33 Correct 127 ms 118864 KB Output is correct
34 Correct 106 ms 118940 KB Output is correct
35 Correct 116 ms 118824 KB Output is correct
36 Correct 110 ms 118936 KB Output is correct
37 Correct 111 ms 118904 KB Output is correct
38 Correct 117 ms 118940 KB Output is correct
39 Correct 109 ms 118904 KB Output is correct
40 Correct 116 ms 118884 KB Output is correct
41 Correct 120 ms 118984 KB Output is correct
42 Correct 108 ms 118820 KB Output is correct
43 Correct 112 ms 118944 KB Output is correct
44 Correct 130 ms 118936 KB Output is correct
45 Correct 114 ms 118904 KB Output is correct
46 Correct 110 ms 118904 KB Output is correct
47 Correct 114 ms 118936 KB Output is correct
48 Correct 118 ms 118940 KB Output is correct
49 Correct 113 ms 118944 KB Output is correct
50 Correct 106 ms 118904 KB Output is correct
51 Correct 107 ms 118972 KB Output is correct
52 Correct 104 ms 119000 KB Output is correct
53 Correct 104 ms 118884 KB Output is correct
54 Correct 109 ms 118904 KB Output is correct
55 Correct 103 ms 118904 KB Output is correct
56 Correct 110 ms 118980 KB Output is correct
57 Correct 111 ms 118936 KB Output is correct
58 Correct 110 ms 118880 KB Output is correct
59 Correct 124 ms 118904 KB Output is correct
60 Correct 124 ms 119032 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 131 ms 118904 KB Output is correct
2 Correct 113 ms 118904 KB Output is correct
3 Correct 109 ms 118844 KB Output is correct
4 Correct 107 ms 118904 KB Output is correct
5 Correct 118 ms 118928 KB Output is correct
6 Correct 107 ms 118904 KB Output is correct
7 Correct 110 ms 118948 KB Output is correct
8 Correct 104 ms 118956 KB Output is correct
9 Correct 114 ms 118988 KB Output is correct
10 Correct 104 ms 118904 KB Output is correct
11 Correct 109 ms 118940 KB Output is correct
12 Correct 109 ms 118988 KB Output is correct
13 Correct 114 ms 119032 KB Output is correct
14 Correct 106 ms 119012 KB Output is correct
15 Correct 113 ms 119012 KB Output is correct
16 Correct 127 ms 119016 KB Output is correct
17 Correct 117 ms 118952 KB Output is correct
18 Correct 106 ms 118932 KB Output is correct
19 Correct 106 ms 118904 KB Output is correct
20 Correct 114 ms 118964 KB Output is correct
21 Correct 107 ms 118940 KB Output is correct
22 Correct 120 ms 118932 KB Output is correct
23 Correct 103 ms 118936 KB Output is correct
24 Correct 117 ms 118880 KB Output is correct
25 Correct 104 ms 118936 KB Output is correct
26 Correct 130 ms 118936 KB Output is correct
27 Correct 105 ms 118936 KB Output is correct
28 Correct 132 ms 119004 KB Output is correct
29 Correct 128 ms 118904 KB Output is correct
30 Correct 120 ms 118904 KB Output is correct
31 Correct 123 ms 118964 KB Output is correct
32 Correct 107 ms 119032 KB Output is correct
33 Correct 127 ms 118864 KB Output is correct
34 Correct 106 ms 118940 KB Output is correct
35 Correct 116 ms 118824 KB Output is correct
36 Correct 110 ms 118936 KB Output is correct
37 Correct 111 ms 118904 KB Output is correct
38 Correct 117 ms 118940 KB Output is correct
39 Correct 109 ms 118904 KB Output is correct
40 Correct 116 ms 118884 KB Output is correct
41 Correct 120 ms 118984 KB Output is correct
42 Correct 108 ms 118820 KB Output is correct
43 Correct 112 ms 118944 KB Output is correct
44 Correct 130 ms 118936 KB Output is correct
45 Correct 114 ms 118904 KB Output is correct
46 Correct 110 ms 118904 KB Output is correct
47 Correct 114 ms 118936 KB Output is correct
48 Correct 118 ms 118940 KB Output is correct
49 Correct 113 ms 118944 KB Output is correct
50 Correct 106 ms 118904 KB Output is correct
51 Correct 107 ms 118972 KB Output is correct
52 Correct 104 ms 119000 KB Output is correct
53 Correct 104 ms 118884 KB Output is correct
54 Correct 109 ms 118904 KB Output is correct
55 Correct 103 ms 118904 KB Output is correct
56 Correct 110 ms 118980 KB Output is correct
57 Correct 111 ms 118936 KB Output is correct
58 Correct 110 ms 118880 KB Output is correct
59 Correct 124 ms 118904 KB Output is correct
60 Correct 124 ms 119032 KB Output is correct
61 Correct 109 ms 118904 KB Output is correct
62 Correct 124 ms 118904 KB Output is correct
63 Correct 127 ms 118880 KB Output is correct
64 Correct 165 ms 120092 KB Output is correct
65 Correct 156 ms 119216 KB Output is correct
66 Correct 140 ms 119008 KB Output is correct
67 Correct 153 ms 118900 KB Output is correct
68 Correct 153 ms 120092 KB Output is correct
69 Correct 146 ms 119220 KB Output is correct
70 Correct 147 ms 119064 KB Output is correct
71 Correct 152 ms 119008 KB Output is correct
72 Correct 165 ms 120736 KB Output is correct
73 Correct 165 ms 120388 KB Output is correct
74 Correct 156 ms 120352 KB Output is correct
75 Correct 160 ms 120208 KB Output is correct
76 Correct 178 ms 121212 KB Output is correct
77 Correct 156 ms 121208 KB Output is correct
78 Correct 154 ms 121208 KB Output is correct
79 Correct 172 ms 121348 KB Output is correct
80 Correct 171 ms 120008 KB Output is correct
81 Correct 154 ms 119128 KB Output is correct
82 Correct 132 ms 118992 KB Output is correct
83 Correct 157 ms 118964 KB Output is correct
84 Correct 171 ms 120088 KB Output is correct
85 Correct 150 ms 119256 KB Output is correct
86 Correct 150 ms 119068 KB Output is correct
87 Correct 155 ms 118936 KB Output is correct
88 Correct 183 ms 120788 KB Output is correct
89 Correct 156 ms 120356 KB Output is correct
90 Correct 161 ms 120324 KB Output is correct
91 Correct 178 ms 120304 KB Output is correct
92 Correct 182 ms 121336 KB Output is correct
93 Correct 170 ms 121176 KB Output is correct
94 Correct 185 ms 121168 KB Output is correct
95 Correct 151 ms 121236 KB Output is correct
96 Correct 145 ms 118904 KB Output is correct
97 Correct 133 ms 118936 KB Output is correct
98 Correct 136 ms 118964 KB Output is correct
99 Correct 158 ms 119020 KB Output is correct
100 Correct 172 ms 119052 KB Output is correct
101 Correct 143 ms 118912 KB Output is correct
102 Correct 165 ms 118940 KB Output is correct
103 Correct 139 ms 118892 KB Output is correct
104 Correct 158 ms 120108 KB Output is correct
105 Correct 165 ms 119216 KB Output is correct
106 Correct 143 ms 119156 KB Output is correct
107 Correct 132 ms 119008 KB Output is correct
108 Correct 151 ms 120088 KB Output is correct
109 Correct 155 ms 119280 KB Output is correct
110 Correct 141 ms 118940 KB Output is correct
111 Correct 134 ms 119000 KB Output is correct
112 Correct 130 ms 120136 KB Output is correct
113 Correct 146 ms 120020 KB Output is correct
114 Correct 130 ms 120112 KB Output is correct
115 Correct 156 ms 120116 KB Output is correct
116 Correct 124 ms 120124 KB Output is correct
117 Correct 133 ms 120064 KB Output is correct
118 Correct 136 ms 120056 KB Output is correct
119 Correct 182 ms 120084 KB Output is correct
120 Correct 135 ms 120056 KB Output is correct
121 Correct 143 ms 120096 KB Output is correct
122 Correct 131 ms 121196 KB Output is correct
123 Correct 139 ms 121208 KB Output is correct
124 Correct 125 ms 119188 KB Output is correct
125 Correct 125 ms 119044 KB Output is correct
126 Correct 128 ms 119016 KB Output is correct
127 Correct 129 ms 119416 KB Output is correct
128 Correct 150 ms 119032 KB Output is correct
129 Correct 118 ms 118968 KB Output is correct
130 Correct 134 ms 119556 KB Output is correct
131 Correct 137 ms 119096 KB Output is correct
132 Correct 125 ms 118976 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 131 ms 118904 KB Output is correct
2 Correct 113 ms 118904 KB Output is correct
3 Correct 109 ms 118844 KB Output is correct
4 Correct 107 ms 118904 KB Output is correct
5 Correct 118 ms 118928 KB Output is correct
6 Correct 107 ms 118904 KB Output is correct
7 Correct 110 ms 118948 KB Output is correct
8 Correct 104 ms 118956 KB Output is correct
9 Correct 114 ms 118988 KB Output is correct
10 Correct 104 ms 118904 KB Output is correct
11 Correct 109 ms 118940 KB Output is correct
12 Correct 109 ms 118988 KB Output is correct
13 Correct 114 ms 119032 KB Output is correct
14 Correct 106 ms 119012 KB Output is correct
15 Correct 113 ms 119012 KB Output is correct
16 Correct 127 ms 119016 KB Output is correct
17 Correct 117 ms 118952 KB Output is correct
18 Correct 106 ms 118932 KB Output is correct
19 Correct 106 ms 118904 KB Output is correct
20 Correct 114 ms 118964 KB Output is correct
21 Correct 107 ms 118940 KB Output is correct
22 Correct 120 ms 118932 KB Output is correct
23 Correct 103 ms 118936 KB Output is correct
24 Correct 117 ms 118880 KB Output is correct
25 Correct 104 ms 118936 KB Output is correct
26 Correct 130 ms 118936 KB Output is correct
27 Correct 105 ms 118936 KB Output is correct
28 Correct 132 ms 119004 KB Output is correct
29 Correct 128 ms 118904 KB Output is correct
30 Correct 120 ms 118904 KB Output is correct
31 Correct 123 ms 118964 KB Output is correct
32 Correct 107 ms 119032 KB Output is correct
33 Correct 127 ms 118864 KB Output is correct
34 Correct 106 ms 118940 KB Output is correct
35 Correct 116 ms 118824 KB Output is correct
36 Correct 110 ms 118936 KB Output is correct
37 Correct 111 ms 118904 KB Output is correct
38 Correct 117 ms 118940 KB Output is correct
39 Correct 109 ms 118904 KB Output is correct
40 Correct 116 ms 118884 KB Output is correct
41 Correct 120 ms 118984 KB Output is correct
42 Correct 108 ms 118820 KB Output is correct
43 Correct 112 ms 118944 KB Output is correct
44 Correct 130 ms 118936 KB Output is correct
45 Correct 114 ms 118904 KB Output is correct
46 Correct 110 ms 118904 KB Output is correct
47 Correct 114 ms 118936 KB Output is correct
48 Correct 118 ms 118940 KB Output is correct
49 Correct 113 ms 118944 KB Output is correct
50 Correct 106 ms 118904 KB Output is correct
51 Correct 107 ms 118972 KB Output is correct
52 Correct 104 ms 119000 KB Output is correct
53 Correct 104 ms 118884 KB Output is correct
54 Correct 109 ms 118904 KB Output is correct
55 Correct 103 ms 118904 KB Output is correct
56 Correct 110 ms 118980 KB Output is correct
57 Correct 111 ms 118936 KB Output is correct
58 Correct 110 ms 118880 KB Output is correct
59 Correct 124 ms 118904 KB Output is correct
60 Correct 124 ms 119032 KB Output is correct
61 Correct 109 ms 118904 KB Output is correct
62 Correct 124 ms 118904 KB Output is correct
63 Correct 127 ms 118880 KB Output is correct
64 Correct 165 ms 120092 KB Output is correct
65 Correct 156 ms 119216 KB Output is correct
66 Correct 140 ms 119008 KB Output is correct
67 Correct 153 ms 118900 KB Output is correct
68 Correct 153 ms 120092 KB Output is correct
69 Correct 146 ms 119220 KB Output is correct
70 Correct 147 ms 119064 KB Output is correct
71 Correct 152 ms 119008 KB Output is correct
72 Correct 165 ms 120736 KB Output is correct
73 Correct 165 ms 120388 KB Output is correct
74 Correct 156 ms 120352 KB Output is correct
75 Correct 160 ms 120208 KB Output is correct
76 Correct 178 ms 121212 KB Output is correct
77 Correct 156 ms 121208 KB Output is correct
78 Correct 154 ms 121208 KB Output is correct
79 Correct 172 ms 121348 KB Output is correct
80 Correct 171 ms 120008 KB Output is correct
81 Correct 154 ms 119128 KB Output is correct
82 Correct 132 ms 118992 KB Output is correct
83 Correct 157 ms 118964 KB Output is correct
84 Correct 171 ms 120088 KB Output is correct
85 Correct 150 ms 119256 KB Output is correct
86 Correct 150 ms 119068 KB Output is correct
87 Correct 155 ms 118936 KB Output is correct
88 Correct 183 ms 120788 KB Output is correct
89 Correct 156 ms 120356 KB Output is correct
90 Correct 161 ms 120324 KB Output is correct
91 Correct 178 ms 120304 KB Output is correct
92 Correct 182 ms 121336 KB Output is correct
93 Correct 170 ms 121176 KB Output is correct
94 Correct 185 ms 121168 KB Output is correct
95 Correct 151 ms 121236 KB Output is correct
96 Correct 145 ms 118904 KB Output is correct
97 Correct 133 ms 118936 KB Output is correct
98 Correct 136 ms 118964 KB Output is correct
99 Correct 158 ms 119020 KB Output is correct
100 Correct 172 ms 119052 KB Output is correct
101 Correct 143 ms 118912 KB Output is correct
102 Correct 165 ms 118940 KB Output is correct
103 Correct 139 ms 118892 KB Output is correct
104 Correct 158 ms 120108 KB Output is correct
105 Correct 165 ms 119216 KB Output is correct
106 Correct 143 ms 119156 KB Output is correct
107 Correct 132 ms 119008 KB Output is correct
108 Correct 151 ms 120088 KB Output is correct
109 Correct 155 ms 119280 KB Output is correct
110 Correct 141 ms 118940 KB Output is correct
111 Correct 134 ms 119000 KB Output is correct
112 Correct 130 ms 120136 KB Output is correct
113 Correct 146 ms 120020 KB Output is correct
114 Correct 130 ms 120112 KB Output is correct
115 Correct 156 ms 120116 KB Output is correct
116 Correct 124 ms 120124 KB Output is correct
117 Correct 133 ms 120064 KB Output is correct
118 Correct 136 ms 120056 KB Output is correct
119 Correct 182 ms 120084 KB Output is correct
120 Correct 135 ms 120056 KB Output is correct
121 Correct 143 ms 120096 KB Output is correct
122 Correct 131 ms 121196 KB Output is correct
123 Correct 139 ms 121208 KB Output is correct
124 Correct 125 ms 119188 KB Output is correct
125 Correct 125 ms 119044 KB Output is correct
126 Correct 128 ms 119016 KB Output is correct
127 Correct 129 ms 119416 KB Output is correct
128 Correct 150 ms 119032 KB Output is correct
129 Correct 118 ms 118968 KB Output is correct
130 Correct 134 ms 119556 KB Output is correct
131 Correct 137 ms 119096 KB Output is correct
132 Correct 125 ms 118976 KB Output is correct
133 Correct 399 ms 123768 KB Output is correct
134 Correct 301 ms 120096 KB Output is correct
135 Correct 294 ms 119288 KB Output is correct
136 Correct 256 ms 119304 KB Output is correct
137 Correct 375 ms 123912 KB Output is correct
138 Correct 395 ms 120092 KB Output is correct
139 Correct 279 ms 119416 KB Output is correct
140 Correct 241 ms 119280 KB Output is correct
141 Correct 365 ms 126584 KB Output is correct
142 Correct 380 ms 125108 KB Output is correct
143 Correct 352 ms 124824 KB Output is correct
144 Correct 358 ms 124796 KB Output is correct
145 Correct 364 ms 128500 KB Output is correct
146 Correct 443 ms 128580 KB Output is correct
147 Correct 376 ms 128500 KB Output is correct
148 Correct 404 ms 128556 KB Output is correct
149 Correct 364 ms 123912 KB Output is correct
150 Correct 283 ms 120056 KB Output is correct
151 Correct 280 ms 119312 KB Output is correct
152 Correct 300 ms 119288 KB Output is correct
153 Correct 322 ms 123848 KB Output is correct
154 Correct 273 ms 120084 KB Output is correct
155 Correct 258 ms 119336 KB Output is correct
156 Correct 255 ms 119328 KB Output is correct
157 Correct 341 ms 126712 KB Output is correct
158 Correct 340 ms 125064 KB Output is correct
159 Correct 375 ms 124880 KB Output is correct
160 Correct 356 ms 124768 KB Output is correct
161 Correct 370 ms 128436 KB Output is correct
162 Correct 380 ms 128536 KB Output is correct
163 Correct 502 ms 128504 KB Output is correct
164 Correct 399 ms 128472 KB Output is correct
165 Correct 210 ms 119372 KB Output is correct
166 Correct 249 ms 119292 KB Output is correct
167 Correct 264 ms 119312 KB Output is correct
168 Correct 217 ms 119288 KB Output is correct
169 Correct 270 ms 119288 KB Output is correct
170 Correct 302 ms 119312 KB Output is correct
171 Correct 230 ms 119264 KB Output is correct
172 Correct 238 ms 119288 KB Output is correct
173 Correct 339 ms 123900 KB Output is correct
174 Correct 314 ms 120200 KB Output is correct
175 Correct 274 ms 119400 KB Output is correct
176 Correct 247 ms 119292 KB Output is correct
177 Correct 322 ms 123964 KB Output is correct
178 Correct 335 ms 120204 KB Output is correct
179 Correct 280 ms 119324 KB Output is correct
180 Correct 261 ms 119320 KB Output is correct
181 Correct 228 ms 123928 KB Output is correct
182 Correct 332 ms 123952 KB Output is correct
183 Correct 211 ms 123892 KB Output is correct
184 Correct 257 ms 123964 KB Output is correct
185 Correct 239 ms 123896 KB Output is correct
186 Correct 295 ms 123908 KB Output is correct
187 Correct 243 ms 123872 KB Output is correct
188 Correct 261 ms 123908 KB Output is correct
189 Correct 248 ms 124024 KB Output is correct
190 Correct 314 ms 124028 KB Output is correct
191 Correct 266 ms 128888 KB Output is correct
192 Correct 237 ms 128624 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 559 ms 157280 KB Output is correct
2 Correct 623 ms 157304 KB Output is correct
3 Correct 1089 ms 195168 KB Output is correct
4 Correct 1016 ms 195048 KB Output is correct
5 Correct 1251 ms 214024 KB Output is correct
6 Correct 1348 ms 213884 KB Output is correct
7 Correct 1555 ms 123068 KB Output is correct
8 Correct 1204 ms 120828 KB Output is correct
9 Correct 1133 ms 120600 KB Output is correct
10 Correct 1826 ms 126088 KB Output is correct
11 Correct 1150 ms 120948 KB Output is correct
12 Correct 1118 ms 120580 KB Output is correct
13 Correct 1903 ms 127352 KB Output is correct
14 Correct 1104 ms 120956 KB Output is correct
15 Correct 1198 ms 120612 KB Output is correct
16 Correct 1220 ms 120760 KB Output is correct
17 Correct 1122 ms 120796 KB Output is correct
18 Correct 1202 ms 120796 KB Output is correct
19 Correct 1112 ms 120824 KB Output is correct
20 Correct 1181 ms 120796 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 131 ms 118904 KB Output is correct
2 Correct 113 ms 118904 KB Output is correct
3 Correct 109 ms 118844 KB Output is correct
4 Correct 107 ms 118904 KB Output is correct
5 Correct 118 ms 118928 KB Output is correct
6 Correct 107 ms 118904 KB Output is correct
7 Correct 110 ms 118948 KB Output is correct
8 Correct 104 ms 118956 KB Output is correct
9 Correct 114 ms 118988 KB Output is correct
10 Correct 104 ms 118904 KB Output is correct
11 Correct 109 ms 118940 KB Output is correct
12 Correct 109 ms 118988 KB Output is correct
13 Correct 114 ms 119032 KB Output is correct
14 Correct 106 ms 119012 KB Output is correct
15 Correct 113 ms 119012 KB Output is correct
16 Correct 127 ms 119016 KB Output is correct
17 Correct 117 ms 118952 KB Output is correct
18 Correct 106 ms 118932 KB Output is correct
19 Correct 106 ms 118904 KB Output is correct
20 Correct 114 ms 118964 KB Output is correct
21 Correct 107 ms 118940 KB Output is correct
22 Correct 120 ms 118932 KB Output is correct
23 Correct 103 ms 118936 KB Output is correct
24 Correct 117 ms 118880 KB Output is correct
25 Correct 104 ms 118936 KB Output is correct
26 Correct 130 ms 118936 KB Output is correct
27 Correct 105 ms 118936 KB Output is correct
28 Correct 132 ms 119004 KB Output is correct
29 Correct 128 ms 118904 KB Output is correct
30 Correct 120 ms 118904 KB Output is correct
31 Correct 123 ms 118964 KB Output is correct
32 Correct 107 ms 119032 KB Output is correct
33 Correct 127 ms 118864 KB Output is correct
34 Correct 106 ms 118940 KB Output is correct
35 Correct 116 ms 118824 KB Output is correct
36 Correct 110 ms 118936 KB Output is correct
37 Correct 111 ms 118904 KB Output is correct
38 Correct 117 ms 118940 KB Output is correct
39 Correct 109 ms 118904 KB Output is correct
40 Correct 116 ms 118884 KB Output is correct
41 Correct 120 ms 118984 KB Output is correct
42 Correct 108 ms 118820 KB Output is correct
43 Correct 112 ms 118944 KB Output is correct
44 Correct 130 ms 118936 KB Output is correct
45 Correct 114 ms 118904 KB Output is correct
46 Correct 110 ms 118904 KB Output is correct
47 Correct 114 ms 118936 KB Output is correct
48 Correct 118 ms 118940 KB Output is correct
49 Correct 113 ms 118944 KB Output is correct
50 Correct 106 ms 118904 KB Output is correct
51 Correct 107 ms 118972 KB Output is correct
52 Correct 104 ms 119000 KB Output is correct
53 Correct 104 ms 118884 KB Output is correct
54 Correct 109 ms 118904 KB Output is correct
55 Correct 103 ms 118904 KB Output is correct
56 Correct 110 ms 118980 KB Output is correct
57 Correct 111 ms 118936 KB Output is correct
58 Correct 110 ms 118880 KB Output is correct
59 Correct 124 ms 118904 KB Output is correct
60 Correct 124 ms 119032 KB Output is correct
61 Correct 109 ms 118904 KB Output is correct
62 Correct 124 ms 118904 KB Output is correct
63 Correct 127 ms 118880 KB Output is correct
64 Correct 165 ms 120092 KB Output is correct
65 Correct 156 ms 119216 KB Output is correct
66 Correct 140 ms 119008 KB Output is correct
67 Correct 153 ms 118900 KB Output is correct
68 Correct 153 ms 120092 KB Output is correct
69 Correct 146 ms 119220 KB Output is correct
70 Correct 147 ms 119064 KB Output is correct
71 Correct 152 ms 119008 KB Output is correct
72 Correct 165 ms 120736 KB Output is correct
73 Correct 165 ms 120388 KB Output is correct
74 Correct 156 ms 120352 KB Output is correct
75 Correct 160 ms 120208 KB Output is correct
76 Correct 178 ms 121212 KB Output is correct
77 Correct 156 ms 121208 KB Output is correct
78 Correct 154 ms 121208 KB Output is correct
79 Correct 172 ms 121348 KB Output is correct
80 Correct 171 ms 120008 KB Output is correct
81 Correct 154 ms 119128 KB Output is correct
82 Correct 132 ms 118992 KB Output is correct
83 Correct 157 ms 118964 KB Output is correct
84 Correct 171 ms 120088 KB Output is correct
85 Correct 150 ms 119256 KB Output is correct
86 Correct 150 ms 119068 KB Output is correct
87 Correct 155 ms 118936 KB Output is correct
88 Correct 183 ms 120788 KB Output is correct
89 Correct 156 ms 120356 KB Output is correct
90 Correct 161 ms 120324 KB Output is correct
91 Correct 178 ms 120304 KB Output is correct
92 Correct 182 ms 121336 KB Output is correct
93 Correct 170 ms 121176 KB Output is correct
94 Correct 185 ms 121168 KB Output is correct
95 Correct 151 ms 121236 KB Output is correct
96 Correct 145 ms 118904 KB Output is correct
97 Correct 133 ms 118936 KB Output is correct
98 Correct 136 ms 118964 KB Output is correct
99 Correct 158 ms 119020 KB Output is correct
100 Correct 172 ms 119052 KB Output is correct
101 Correct 143 ms 118912 KB Output is correct
102 Correct 165 ms 118940 KB Output is correct
103 Correct 139 ms 118892 KB Output is correct
104 Correct 158 ms 120108 KB Output is correct
105 Correct 165 ms 119216 KB Output is correct
106 Correct 143 ms 119156 KB Output is correct
107 Correct 132 ms 119008 KB Output is correct
108 Correct 151 ms 120088 KB Output is correct
109 Correct 155 ms 119280 KB Output is correct
110 Correct 141 ms 118940 KB Output is correct
111 Correct 134 ms 119000 KB Output is correct
112 Correct 130 ms 120136 KB Output is correct
113 Correct 146 ms 120020 KB Output is correct
114 Correct 130 ms 120112 KB Output is correct
115 Correct 156 ms 120116 KB Output is correct
116 Correct 124 ms 120124 KB Output is correct
117 Correct 133 ms 120064 KB Output is correct
118 Correct 136 ms 120056 KB Output is correct
119 Correct 182 ms 120084 KB Output is correct
120 Correct 135 ms 120056 KB Output is correct
121 Correct 143 ms 120096 KB Output is correct
122 Correct 131 ms 121196 KB Output is correct
123 Correct 139 ms 121208 KB Output is correct
124 Correct 125 ms 119188 KB Output is correct
125 Correct 125 ms 119044 KB Output is correct
126 Correct 128 ms 119016 KB Output is correct
127 Correct 129 ms 119416 KB Output is correct
128 Correct 150 ms 119032 KB Output is correct
129 Correct 118 ms 118968 KB Output is correct
130 Correct 134 ms 119556 KB Output is correct
131 Correct 137 ms 119096 KB Output is correct
132 Correct 125 ms 118976 KB Output is correct
133 Correct 399 ms 123768 KB Output is correct
134 Correct 301 ms 120096 KB Output is correct
135 Correct 294 ms 119288 KB Output is correct
136 Correct 256 ms 119304 KB Output is correct
137 Correct 375 ms 123912 KB Output is correct
138 Correct 395 ms 120092 KB Output is correct
139 Correct 279 ms 119416 KB Output is correct
140 Correct 241 ms 119280 KB Output is correct
141 Correct 365 ms 126584 KB Output is correct
142 Correct 380 ms 125108 KB Output is correct
143 Correct 352 ms 124824 KB Output is correct
144 Correct 358 ms 124796 KB Output is correct
145 Correct 364 ms 128500 KB Output is correct
146 Correct 443 ms 128580 KB Output is correct
147 Correct 376 ms 128500 KB Output is correct
148 Correct 404 ms 128556 KB Output is correct
149 Correct 364 ms 123912 KB Output is correct
150 Correct 283 ms 120056 KB Output is correct
151 Correct 280 ms 119312 KB Output is correct
152 Correct 300 ms 119288 KB Output is correct
153 Correct 322 ms 123848 KB Output is correct
154 Correct 273 ms 120084 KB Output is correct
155 Correct 258 ms 119336 KB Output is correct
156 Correct 255 ms 119328 KB Output is correct
157 Correct 341 ms 126712 KB Output is correct
158 Correct 340 ms 125064 KB Output is correct
159 Correct 375 ms 124880 KB Output is correct
160 Correct 356 ms 124768 KB Output is correct
161 Correct 370 ms 128436 KB Output is correct
162 Correct 380 ms 128536 KB Output is correct
163 Correct 502 ms 128504 KB Output is correct
164 Correct 399 ms 128472 KB Output is correct
165 Correct 210 ms 119372 KB Output is correct
166 Correct 249 ms 119292 KB Output is correct
167 Correct 264 ms 119312 KB Output is correct
168 Correct 217 ms 119288 KB Output is correct
169 Correct 270 ms 119288 KB Output is correct
170 Correct 302 ms 119312 KB Output is correct
171 Correct 230 ms 119264 KB Output is correct
172 Correct 238 ms 119288 KB Output is correct
173 Correct 339 ms 123900 KB Output is correct
174 Correct 314 ms 120200 KB Output is correct
175 Correct 274 ms 119400 KB Output is correct
176 Correct 247 ms 119292 KB Output is correct
177 Correct 322 ms 123964 KB Output is correct
178 Correct 335 ms 120204 KB Output is correct
179 Correct 280 ms 119324 KB Output is correct
180 Correct 261 ms 119320 KB Output is correct
181 Correct 228 ms 123928 KB Output is correct
182 Correct 332 ms 123952 KB Output is correct
183 Correct 211 ms 123892 KB Output is correct
184 Correct 257 ms 123964 KB Output is correct
185 Correct 239 ms 123896 KB Output is correct
186 Correct 295 ms 123908 KB Output is correct
187 Correct 243 ms 123872 KB Output is correct
188 Correct 261 ms 123908 KB Output is correct
189 Correct 248 ms 124024 KB Output is correct
190 Correct 314 ms 124028 KB Output is correct
191 Correct 266 ms 128888 KB Output is correct
192 Correct 237 ms 128624 KB Output is correct
193 Correct 559 ms 157280 KB Output is correct
194 Correct 623 ms 157304 KB Output is correct
195 Correct 1089 ms 195168 KB Output is correct
196 Correct 1016 ms 195048 KB Output is correct
197 Correct 1251 ms 214024 KB Output is correct
198 Correct 1348 ms 213884 KB Output is correct
199 Correct 1555 ms 123068 KB Output is correct
200 Correct 1204 ms 120828 KB Output is correct
201 Correct 1133 ms 120600 KB Output is correct
202 Correct 1826 ms 126088 KB Output is correct
203 Correct 1150 ms 120948 KB Output is correct
204 Correct 1118 ms 120580 KB Output is correct
205 Correct 1903 ms 127352 KB Output is correct
206 Correct 1104 ms 120956 KB Output is correct
207 Correct 1198 ms 120612 KB Output is correct
208 Correct 1220 ms 120760 KB Output is correct
209 Correct 1122 ms 120796 KB Output is correct
210 Correct 1202 ms 120796 KB Output is correct
211 Correct 1112 ms 120824 KB Output is correct
212 Correct 1181 ms 120796 KB Output is correct
213 Correct 3200 ms 168164 KB Output is correct
214 Correct 2709 ms 130792 KB Output is correct
215 Correct 2017 ms 122788 KB Output is correct
216 Correct 1887 ms 122360 KB Output is correct
217 Correct 4331 ms 168068 KB Output is correct
218 Correct 2970 ms 131260 KB Output is correct
219 Correct 2009 ms 122884 KB Output is correct
220 Correct 1589 ms 122120 KB Output is correct
221 Correct 4700 ms 196196 KB Output is correct
222 Correct 3526 ms 181188 KB Output is correct
223 Correct 3372 ms 178140 KB Output is correct
224 Correct 3400 ms 177556 KB Output is correct
225 Correct 4285 ms 216604 KB Output is correct
226 Correct 3918 ms 218816 KB Output is correct
227 Correct 3538 ms 216352 KB Output is correct
228 Correct 3667 ms 216144 KB Output is correct
229 Correct 3249 ms 167908 KB Output is correct
230 Correct 2871 ms 130368 KB Output is correct
231 Correct 2395 ms 122712 KB Output is correct
232 Correct 1846 ms 122196 KB Output is correct
233 Correct 4021 ms 168380 KB Output is correct
234 Correct 2751 ms 131048 KB Output is correct
235 Correct 1934 ms 123384 KB Output is correct
236 Correct 1697 ms 122612 KB Output is correct
237 Correct 3555 ms 196576 KB Output is correct
238 Correct 3558 ms 181364 KB Output is correct
239 Correct 3452 ms 178020 KB Output is correct
240 Correct 3426 ms 177272 KB Output is correct
241 Correct 3765 ms 214836 KB Output is correct
242 Correct 3923 ms 214804 KB Output is correct
243 Correct 3636 ms 214876 KB Output is correct
244 Correct 3735 ms 214696 KB Output is correct
245 Correct 1445 ms 122364 KB Output is correct
246 Correct 1358 ms 122420 KB Output is correct
247 Correct 1424 ms 122408 KB Output is correct
248 Correct 1451 ms 122364 KB Output is correct
249 Correct 1649 ms 122360 KB Output is correct
250 Correct 1871 ms 122352 KB Output is correct
251 Correct 2028 ms 122176 KB Output is correct
252 Correct 1604 ms 122436 KB Output is correct
253 Correct 3176 ms 168040 KB Output is correct
254 Correct 2853 ms 130664 KB Output is correct
255 Correct 2460 ms 123636 KB Output is correct
256 Correct 1447 ms 123148 KB Output is correct
257 Correct 4205 ms 168740 KB Output is correct
258 Correct 3149 ms 131472 KB Output is correct
259 Correct 2217 ms 123600 KB Output is correct
260 Correct 1891 ms 123052 KB Output is correct
261 Correct 1901 ms 170136 KB Output is correct
262 Correct 2544 ms 170208 KB Output is correct
263 Correct 1231 ms 170108 KB Output is correct
264 Correct 2383 ms 170080 KB Output is correct
265 Correct 1692 ms 169944 KB Output is correct
266 Correct 2343 ms 169404 KB Output is correct
267 Correct 1182 ms 169400 KB Output is correct
268 Correct 2041 ms 169516 KB Output is correct
269 Correct 1334 ms 213812 KB Output is correct
270 Correct 1295 ms 213800 KB Output is correct
271 Correct 1520 ms 123844 KB Output is correct
272 Correct 1145 ms 120824 KB Output is correct
273 Correct 1722 ms 127308 KB Output is correct
274 Correct 1150 ms 120972 KB Output is correct
275 Correct 1181 ms 169384 KB Output is correct