답안 #293973

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
293973 2020-09-08T14:12:22 Z crossing0ver Interval Collection (CCO20_day2problem2) C++17
25 / 25
5721 ms 522524 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;
void add(int v=1,int tl=1,int tr=1e6) {
    if (tl == tr) {
        if (!type) {
            if (VAL < t[0][v])
            change(t[0][v],VAL);
        }
        else if  (VAL > t[1][v])
            change(t[1][v],VAL);
        return;
    }
    int tm = (tl + tr)/2;
    if (pos <= tm)
    add(v*2,tl,tm);
    else add(v*2+1,tm+1,tr);
    if (!type)
        change(t[0][v],min(t[0][v*2],t[0][v*2+1]));
    else
         change(t[1][v],max(t[1][v*2],t[1][v*2+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 get(int v=1,int tl=1,int tr=1e6) {
    if (L> tr || R < tl) {
        if (type == 0) return inf;
        else return -inf;
    }
    if (L <= tl && R >= tr) return t[type][v];
    int tm = (tl + tr)/2;
    if (!type)
        return min(get(v*2,tl,tm),get(v*2+1,tm+1,tr));
    else return max(get(v*2,tl,tm),get(v*2+1,tm+1,tr));

}


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);
        pos = l;
        VAL = r;
        type = 0;
        add1(REV - pos,VAL,0); // l-ze patara r-ebshi udidesi l, r-ze did l-ebshi umciresi r
        add();
        pos = r;
        VAL = l;
        type = 1;
        add1(pos,VAL,1);
        continue;
        }
        }
        L = r;
        R = 1e6;
        type = 0;
        if (cans > r - l) {
        cans = min(cans, -l + get1(REV - L,0));
        }
        L = 1;
        R = l;type = 1;
        if (cans > r - l)
        cans = min(cans, r - get1(R,1));
        pos = l;
        VAL = r;
        type = 0;
        add1(REV-pos,VAL,0); // l-ze patara r-ebshi udidesi l, r-ze did l-ebshi umciresi r
     //   add1(REV - pos,r,0);
     add();
        pos = r;
        VAL = l;
        type = 1;
        add1(pos,VAL,1);
       // add1(pos,VAL,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:79:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   79 |     for (;pos;pos -= pos&-pos)
      |     ^~~
Main.cpp:81:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   81 |         return s;
      |         ^~~~~~
Main.cpp:84:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   84 |     for (;pos;pos -= pos&-pos)
      |     ^~~
Main.cpp:86:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   86 |         return s;
      |         ^~~~~~
Main.cpp: At global scope:
Main.cpp:175:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
  175 | main() {
      |      ^
Main.cpp: In function 'int main()':
Main.cpp:197: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]
  197 |     for (int i = 0; i < t.size(); i++) {
      |                     ~~^~~~~~~~~~
Main.cpp:218: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]
  218 |         for (int i= 0; i < t.size(); i++)
      |                        ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 120 ms 188408 KB Output is correct
2 Correct 121 ms 188280 KB Output is correct
3 Correct 118 ms 188408 KB Output is correct
4 Correct 131 ms 188280 KB Output is correct
5 Correct 131 ms 188408 KB Output is correct
6 Correct 133 ms 188280 KB Output is correct
7 Correct 119 ms 188356 KB Output is correct
8 Correct 130 ms 188280 KB Output is correct
9 Correct 131 ms 188536 KB Output is correct
10 Correct 131 ms 188412 KB Output is correct
11 Correct 131 ms 188408 KB Output is correct
12 Correct 130 ms 188408 KB Output is correct
13 Correct 129 ms 188556 KB Output is correct
14 Correct 119 ms 188536 KB Output is correct
15 Correct 124 ms 188580 KB Output is correct
16 Correct 121 ms 188536 KB Output is correct
17 Correct 128 ms 188412 KB Output is correct
18 Correct 119 ms 188408 KB Output is correct
19 Correct 121 ms 188280 KB Output is correct
20 Correct 117 ms 188280 KB Output is correct
21 Correct 125 ms 188408 KB Output is correct
22 Correct 117 ms 188408 KB Output is correct
23 Correct 115 ms 188284 KB Output is correct
24 Correct 127 ms 188280 KB Output is correct
25 Correct 116 ms 188536 KB Output is correct
26 Correct 119 ms 188408 KB Output is correct
27 Correct 120 ms 188412 KB Output is correct
28 Correct 119 ms 188408 KB Output is correct
29 Correct 122 ms 188536 KB Output is correct
30 Correct 124 ms 188536 KB Output is correct
31 Correct 121 ms 188664 KB Output is correct
32 Correct 128 ms 188536 KB Output is correct
33 Correct 123 ms 188280 KB Output is correct
34 Correct 117 ms 188280 KB Output is correct
35 Correct 120 ms 188280 KB Output is correct
36 Correct 120 ms 188280 KB Output is correct
37 Correct 122 ms 188264 KB Output is correct
38 Correct 121 ms 188360 KB Output is correct
39 Correct 117 ms 188280 KB Output is correct
40 Correct 122 ms 188280 KB Output is correct
41 Correct 120 ms 188408 KB Output is correct
42 Correct 116 ms 188336 KB Output is correct
43 Correct 118 ms 188280 KB Output is correct
44 Correct 120 ms 188284 KB Output is correct
45 Correct 121 ms 188408 KB Output is correct
46 Correct 119 ms 188280 KB Output is correct
47 Correct 117 ms 188280 KB Output is correct
48 Correct 115 ms 188280 KB Output is correct
49 Correct 123 ms 188408 KB Output is correct
50 Correct 117 ms 188408 KB Output is correct
51 Correct 120 ms 188408 KB Output is correct
52 Correct 118 ms 188408 KB Output is correct
53 Correct 116 ms 188412 KB Output is correct
54 Correct 119 ms 188408 KB Output is correct
55 Correct 118 ms 188408 KB Output is correct
56 Correct 119 ms 188408 KB Output is correct
57 Correct 119 ms 188408 KB Output is correct
58 Correct 115 ms 188536 KB Output is correct
59 Correct 122 ms 188536 KB Output is correct
60 Correct 117 ms 188540 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 120 ms 188408 KB Output is correct
2 Correct 121 ms 188280 KB Output is correct
3 Correct 118 ms 188408 KB Output is correct
4 Correct 131 ms 188280 KB Output is correct
5 Correct 131 ms 188408 KB Output is correct
6 Correct 133 ms 188280 KB Output is correct
7 Correct 119 ms 188356 KB Output is correct
8 Correct 130 ms 188280 KB Output is correct
9 Correct 131 ms 188536 KB Output is correct
10 Correct 131 ms 188412 KB Output is correct
11 Correct 131 ms 188408 KB Output is correct
12 Correct 130 ms 188408 KB Output is correct
13 Correct 129 ms 188556 KB Output is correct
14 Correct 119 ms 188536 KB Output is correct
15 Correct 124 ms 188580 KB Output is correct
16 Correct 121 ms 188536 KB Output is correct
17 Correct 128 ms 188412 KB Output is correct
18 Correct 119 ms 188408 KB Output is correct
19 Correct 121 ms 188280 KB Output is correct
20 Correct 117 ms 188280 KB Output is correct
21 Correct 125 ms 188408 KB Output is correct
22 Correct 117 ms 188408 KB Output is correct
23 Correct 115 ms 188284 KB Output is correct
24 Correct 127 ms 188280 KB Output is correct
25 Correct 116 ms 188536 KB Output is correct
26 Correct 119 ms 188408 KB Output is correct
27 Correct 120 ms 188412 KB Output is correct
28 Correct 119 ms 188408 KB Output is correct
29 Correct 122 ms 188536 KB Output is correct
30 Correct 124 ms 188536 KB Output is correct
31 Correct 121 ms 188664 KB Output is correct
32 Correct 128 ms 188536 KB Output is correct
33 Correct 123 ms 188280 KB Output is correct
34 Correct 117 ms 188280 KB Output is correct
35 Correct 120 ms 188280 KB Output is correct
36 Correct 120 ms 188280 KB Output is correct
37 Correct 122 ms 188264 KB Output is correct
38 Correct 121 ms 188360 KB Output is correct
39 Correct 117 ms 188280 KB Output is correct
40 Correct 122 ms 188280 KB Output is correct
41 Correct 120 ms 188408 KB Output is correct
42 Correct 116 ms 188336 KB Output is correct
43 Correct 118 ms 188280 KB Output is correct
44 Correct 120 ms 188284 KB Output is correct
45 Correct 121 ms 188408 KB Output is correct
46 Correct 119 ms 188280 KB Output is correct
47 Correct 117 ms 188280 KB Output is correct
48 Correct 115 ms 188280 KB Output is correct
49 Correct 123 ms 188408 KB Output is correct
50 Correct 117 ms 188408 KB Output is correct
51 Correct 120 ms 188408 KB Output is correct
52 Correct 118 ms 188408 KB Output is correct
53 Correct 116 ms 188412 KB Output is correct
54 Correct 119 ms 188408 KB Output is correct
55 Correct 118 ms 188408 KB Output is correct
56 Correct 119 ms 188408 KB Output is correct
57 Correct 119 ms 188408 KB Output is correct
58 Correct 115 ms 188536 KB Output is correct
59 Correct 122 ms 188536 KB Output is correct
60 Correct 117 ms 188540 KB Output is correct
61 Correct 116 ms 188288 KB Output is correct
62 Correct 124 ms 188408 KB Output is correct
63 Correct 130 ms 188280 KB Output is correct
64 Correct 205 ms 193272 KB Output is correct
65 Correct 195 ms 190844 KB Output is correct
66 Correct 205 ms 190072 KB Output is correct
67 Correct 142 ms 189560 KB Output is correct
68 Correct 205 ms 193400 KB Output is correct
69 Correct 192 ms 190840 KB Output is correct
70 Correct 203 ms 190200 KB Output is correct
71 Correct 156 ms 189944 KB Output is correct
72 Correct 199 ms 194936 KB Output is correct
73 Correct 192 ms 194040 KB Output is correct
74 Correct 203 ms 194040 KB Output is correct
75 Correct 192 ms 193656 KB Output is correct
76 Correct 202 ms 195960 KB Output is correct
77 Correct 217 ms 195924 KB Output is correct
78 Correct 216 ms 195960 KB Output is correct
79 Correct 241 ms 195960 KB Output is correct
80 Correct 205 ms 193280 KB Output is correct
81 Correct 180 ms 190840 KB Output is correct
82 Correct 166 ms 190072 KB Output is correct
83 Correct 159 ms 189560 KB Output is correct
84 Correct 197 ms 193272 KB Output is correct
85 Correct 179 ms 190860 KB Output is correct
86 Correct 186 ms 190072 KB Output is correct
87 Correct 163 ms 189976 KB Output is correct
88 Correct 206 ms 194936 KB Output is correct
89 Correct 200 ms 194040 KB Output is correct
90 Correct 211 ms 193784 KB Output is correct
91 Correct 194 ms 193656 KB Output is correct
92 Correct 202 ms 195960 KB Output is correct
93 Correct 199 ms 195908 KB Output is correct
94 Correct 195 ms 195908 KB Output is correct
95 Correct 203 ms 195836 KB Output is correct
96 Correct 136 ms 189560 KB Output is correct
97 Correct 140 ms 189560 KB Output is correct
98 Correct 148 ms 189560 KB Output is correct
99 Correct 155 ms 189560 KB Output is correct
100 Correct 163 ms 189944 KB Output is correct
101 Correct 161 ms 189816 KB Output is correct
102 Correct 172 ms 190072 KB Output is correct
103 Correct 140 ms 189560 KB Output is correct
104 Correct 209 ms 193144 KB Output is correct
105 Correct 191 ms 190840 KB Output is correct
106 Correct 163 ms 189944 KB Output is correct
107 Correct 141 ms 189564 KB Output is correct
108 Correct 188 ms 192632 KB Output is correct
109 Correct 176 ms 190584 KB Output is correct
110 Correct 161 ms 189944 KB Output is correct
111 Correct 145 ms 189628 KB Output is correct
112 Correct 161 ms 192760 KB Output is correct
113 Correct 157 ms 192632 KB Output is correct
114 Correct 152 ms 192812 KB Output is correct
115 Correct 159 ms 192504 KB Output is correct
116 Correct 158 ms 192872 KB Output is correct
117 Correct 161 ms 192632 KB Output is correct
118 Correct 159 ms 192728 KB Output is correct
119 Correct 161 ms 192632 KB Output is correct
120 Correct 156 ms 192828 KB Output is correct
121 Correct 158 ms 192760 KB Output is correct
122 Correct 189 ms 196472 KB Output is correct
123 Correct 189 ms 196216 KB Output is correct
124 Correct 169 ms 190712 KB Output is correct
125 Correct 161 ms 190072 KB Output is correct
126 Correct 165 ms 189980 KB Output is correct
127 Correct 178 ms 191224 KB Output is correct
128 Correct 162 ms 190076 KB Output is correct
129 Correct 157 ms 189944 KB Output is correct
130 Correct 184 ms 191480 KB Output is correct
131 Correct 167 ms 190172 KB Output is correct
132 Correct 156 ms 190048 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 120 ms 188408 KB Output is correct
2 Correct 121 ms 188280 KB Output is correct
3 Correct 118 ms 188408 KB Output is correct
4 Correct 131 ms 188280 KB Output is correct
5 Correct 131 ms 188408 KB Output is correct
6 Correct 133 ms 188280 KB Output is correct
7 Correct 119 ms 188356 KB Output is correct
8 Correct 130 ms 188280 KB Output is correct
9 Correct 131 ms 188536 KB Output is correct
10 Correct 131 ms 188412 KB Output is correct
11 Correct 131 ms 188408 KB Output is correct
12 Correct 130 ms 188408 KB Output is correct
13 Correct 129 ms 188556 KB Output is correct
14 Correct 119 ms 188536 KB Output is correct
15 Correct 124 ms 188580 KB Output is correct
16 Correct 121 ms 188536 KB Output is correct
17 Correct 128 ms 188412 KB Output is correct
18 Correct 119 ms 188408 KB Output is correct
19 Correct 121 ms 188280 KB Output is correct
20 Correct 117 ms 188280 KB Output is correct
21 Correct 125 ms 188408 KB Output is correct
22 Correct 117 ms 188408 KB Output is correct
23 Correct 115 ms 188284 KB Output is correct
24 Correct 127 ms 188280 KB Output is correct
25 Correct 116 ms 188536 KB Output is correct
26 Correct 119 ms 188408 KB Output is correct
27 Correct 120 ms 188412 KB Output is correct
28 Correct 119 ms 188408 KB Output is correct
29 Correct 122 ms 188536 KB Output is correct
30 Correct 124 ms 188536 KB Output is correct
31 Correct 121 ms 188664 KB Output is correct
32 Correct 128 ms 188536 KB Output is correct
33 Correct 123 ms 188280 KB Output is correct
34 Correct 117 ms 188280 KB Output is correct
35 Correct 120 ms 188280 KB Output is correct
36 Correct 120 ms 188280 KB Output is correct
37 Correct 122 ms 188264 KB Output is correct
38 Correct 121 ms 188360 KB Output is correct
39 Correct 117 ms 188280 KB Output is correct
40 Correct 122 ms 188280 KB Output is correct
41 Correct 120 ms 188408 KB Output is correct
42 Correct 116 ms 188336 KB Output is correct
43 Correct 118 ms 188280 KB Output is correct
44 Correct 120 ms 188284 KB Output is correct
45 Correct 121 ms 188408 KB Output is correct
46 Correct 119 ms 188280 KB Output is correct
47 Correct 117 ms 188280 KB Output is correct
48 Correct 115 ms 188280 KB Output is correct
49 Correct 123 ms 188408 KB Output is correct
50 Correct 117 ms 188408 KB Output is correct
51 Correct 120 ms 188408 KB Output is correct
52 Correct 118 ms 188408 KB Output is correct
53 Correct 116 ms 188412 KB Output is correct
54 Correct 119 ms 188408 KB Output is correct
55 Correct 118 ms 188408 KB Output is correct
56 Correct 119 ms 188408 KB Output is correct
57 Correct 119 ms 188408 KB Output is correct
58 Correct 115 ms 188536 KB Output is correct
59 Correct 122 ms 188536 KB Output is correct
60 Correct 117 ms 188540 KB Output is correct
61 Correct 116 ms 188288 KB Output is correct
62 Correct 124 ms 188408 KB Output is correct
63 Correct 130 ms 188280 KB Output is correct
64 Correct 205 ms 193272 KB Output is correct
65 Correct 195 ms 190844 KB Output is correct
66 Correct 205 ms 190072 KB Output is correct
67 Correct 142 ms 189560 KB Output is correct
68 Correct 205 ms 193400 KB Output is correct
69 Correct 192 ms 190840 KB Output is correct
70 Correct 203 ms 190200 KB Output is correct
71 Correct 156 ms 189944 KB Output is correct
72 Correct 199 ms 194936 KB Output is correct
73 Correct 192 ms 194040 KB Output is correct
74 Correct 203 ms 194040 KB Output is correct
75 Correct 192 ms 193656 KB Output is correct
76 Correct 202 ms 195960 KB Output is correct
77 Correct 217 ms 195924 KB Output is correct
78 Correct 216 ms 195960 KB Output is correct
79 Correct 241 ms 195960 KB Output is correct
80 Correct 205 ms 193280 KB Output is correct
81 Correct 180 ms 190840 KB Output is correct
82 Correct 166 ms 190072 KB Output is correct
83 Correct 159 ms 189560 KB Output is correct
84 Correct 197 ms 193272 KB Output is correct
85 Correct 179 ms 190860 KB Output is correct
86 Correct 186 ms 190072 KB Output is correct
87 Correct 163 ms 189976 KB Output is correct
88 Correct 206 ms 194936 KB Output is correct
89 Correct 200 ms 194040 KB Output is correct
90 Correct 211 ms 193784 KB Output is correct
91 Correct 194 ms 193656 KB Output is correct
92 Correct 202 ms 195960 KB Output is correct
93 Correct 199 ms 195908 KB Output is correct
94 Correct 195 ms 195908 KB Output is correct
95 Correct 203 ms 195836 KB Output is correct
96 Correct 136 ms 189560 KB Output is correct
97 Correct 140 ms 189560 KB Output is correct
98 Correct 148 ms 189560 KB Output is correct
99 Correct 155 ms 189560 KB Output is correct
100 Correct 163 ms 189944 KB Output is correct
101 Correct 161 ms 189816 KB Output is correct
102 Correct 172 ms 190072 KB Output is correct
103 Correct 140 ms 189560 KB Output is correct
104 Correct 209 ms 193144 KB Output is correct
105 Correct 191 ms 190840 KB Output is correct
106 Correct 163 ms 189944 KB Output is correct
107 Correct 141 ms 189564 KB Output is correct
108 Correct 188 ms 192632 KB Output is correct
109 Correct 176 ms 190584 KB Output is correct
110 Correct 161 ms 189944 KB Output is correct
111 Correct 145 ms 189628 KB Output is correct
112 Correct 161 ms 192760 KB Output is correct
113 Correct 157 ms 192632 KB Output is correct
114 Correct 152 ms 192812 KB Output is correct
115 Correct 159 ms 192504 KB Output is correct
116 Correct 158 ms 192872 KB Output is correct
117 Correct 161 ms 192632 KB Output is correct
118 Correct 159 ms 192728 KB Output is correct
119 Correct 161 ms 192632 KB Output is correct
120 Correct 156 ms 192828 KB Output is correct
121 Correct 158 ms 192760 KB Output is correct
122 Correct 189 ms 196472 KB Output is correct
123 Correct 189 ms 196216 KB Output is correct
124 Correct 169 ms 190712 KB Output is correct
125 Correct 161 ms 190072 KB Output is correct
126 Correct 165 ms 189980 KB Output is correct
127 Correct 178 ms 191224 KB Output is correct
128 Correct 162 ms 190076 KB Output is correct
129 Correct 157 ms 189944 KB Output is correct
130 Correct 184 ms 191480 KB Output is correct
131 Correct 167 ms 190172 KB Output is correct
132 Correct 156 ms 190048 KB Output is correct
133 Correct 562 ms 209072 KB Output is correct
134 Correct 530 ms 199160 KB Output is correct
135 Correct 357 ms 196728 KB Output is correct
136 Correct 235 ms 194424 KB Output is correct
137 Correct 516 ms 209120 KB Output is correct
138 Correct 441 ms 199440 KB Output is correct
139 Correct 366 ms 196604 KB Output is correct
140 Correct 326 ms 195608 KB Output is correct
141 Correct 514 ms 215684 KB Output is correct
142 Correct 512 ms 212112 KB Output is correct
143 Correct 502 ms 211276 KB Output is correct
144 Correct 487 ms 211164 KB Output is correct
145 Correct 523 ms 219840 KB Output is correct
146 Correct 551 ms 219852 KB Output is correct
147 Correct 528 ms 219956 KB Output is correct
148 Correct 525 ms 219796 KB Output is correct
149 Correct 508 ms 208848 KB Output is correct
150 Correct 428 ms 199160 KB Output is correct
151 Correct 390 ms 196728 KB Output is correct
152 Correct 231 ms 194296 KB Output is correct
153 Correct 502 ms 208888 KB Output is correct
154 Correct 437 ms 199088 KB Output is correct
155 Correct 381 ms 196600 KB Output is correct
156 Correct 319 ms 195576 KB Output is correct
157 Correct 598 ms 215796 KB Output is correct
158 Correct 503 ms 211980 KB Output is correct
159 Correct 505 ms 211192 KB Output is correct
160 Correct 491 ms 211196 KB Output is correct
161 Correct 520 ms 219512 KB Output is correct
162 Correct 516 ms 219508 KB Output is correct
163 Correct 530 ms 219640 KB Output is correct
164 Correct 520 ms 219600 KB Output is correct
165 Correct 211 ms 193788 KB Output is correct
166 Correct 211 ms 193780 KB Output is correct
167 Correct 207 ms 193656 KB Output is correct
168 Correct 232 ms 193820 KB Output is correct
169 Correct 325 ms 195660 KB Output is correct
170 Correct 310 ms 195196 KB Output is correct
171 Correct 373 ms 194936 KB Output is correct
172 Correct 301 ms 193912 KB Output is correct
173 Correct 502 ms 208132 KB Output is correct
174 Correct 431 ms 198924 KB Output is correct
175 Correct 355 ms 196216 KB Output is correct
176 Correct 238 ms 194040 KB Output is correct
177 Correct 517 ms 205940 KB Output is correct
178 Correct 435 ms 198424 KB Output is correct
179 Correct 357 ms 196108 KB Output is correct
180 Correct 238 ms 193980 KB Output is correct
181 Correct 309 ms 207476 KB Output is correct
182 Correct 336 ms 207156 KB Output is correct
183 Correct 292 ms 207476 KB Output is correct
184 Correct 321 ms 207100 KB Output is correct
185 Correct 322 ms 207348 KB Output is correct
186 Correct 330 ms 207092 KB Output is correct
187 Correct 298 ms 207476 KB Output is correct
188 Correct 310 ms 207352 KB Output is correct
189 Correct 321 ms 207496 KB Output is correct
190 Correct 317 ms 207220 KB Output is correct
191 Correct 415 ms 222324 KB Output is correct
192 Correct 401 ms 221160 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1492 ms 323920 KB Output is correct
2 Correct 1348 ms 318828 KB Output is correct
3 Correct 2727 ms 460884 KB Output is correct
4 Correct 2622 ms 450560 KB Output is correct
5 Correct 3354 ms 522524 KB Output is correct
6 Correct 3202 ms 510444 KB Output is correct
7 Correct 3339 ms 272084 KB Output is correct
8 Correct 2606 ms 256640 KB Output is correct
9 Correct 2379 ms 254420 KB Output is correct
10 Correct 3864 ms 279588 KB Output is correct
11 Correct 2645 ms 256552 KB Output is correct
12 Correct 2469 ms 254204 KB Output is correct
13 Correct 3679 ms 283068 KB Output is correct
14 Correct 2562 ms 256572 KB Output is correct
15 Correct 2478 ms 254276 KB Output is correct
16 Correct 1482 ms 245624 KB Output is correct
17 Correct 1571 ms 245324 KB Output is correct
18 Correct 1593 ms 245388 KB Output is correct
19 Correct 1581 ms 245752 KB Output is correct
20 Correct 1521 ms 245500 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 120 ms 188408 KB Output is correct
2 Correct 121 ms 188280 KB Output is correct
3 Correct 118 ms 188408 KB Output is correct
4 Correct 131 ms 188280 KB Output is correct
5 Correct 131 ms 188408 KB Output is correct
6 Correct 133 ms 188280 KB Output is correct
7 Correct 119 ms 188356 KB Output is correct
8 Correct 130 ms 188280 KB Output is correct
9 Correct 131 ms 188536 KB Output is correct
10 Correct 131 ms 188412 KB Output is correct
11 Correct 131 ms 188408 KB Output is correct
12 Correct 130 ms 188408 KB Output is correct
13 Correct 129 ms 188556 KB Output is correct
14 Correct 119 ms 188536 KB Output is correct
15 Correct 124 ms 188580 KB Output is correct
16 Correct 121 ms 188536 KB Output is correct
17 Correct 128 ms 188412 KB Output is correct
18 Correct 119 ms 188408 KB Output is correct
19 Correct 121 ms 188280 KB Output is correct
20 Correct 117 ms 188280 KB Output is correct
21 Correct 125 ms 188408 KB Output is correct
22 Correct 117 ms 188408 KB Output is correct
23 Correct 115 ms 188284 KB Output is correct
24 Correct 127 ms 188280 KB Output is correct
25 Correct 116 ms 188536 KB Output is correct
26 Correct 119 ms 188408 KB Output is correct
27 Correct 120 ms 188412 KB Output is correct
28 Correct 119 ms 188408 KB Output is correct
29 Correct 122 ms 188536 KB Output is correct
30 Correct 124 ms 188536 KB Output is correct
31 Correct 121 ms 188664 KB Output is correct
32 Correct 128 ms 188536 KB Output is correct
33 Correct 123 ms 188280 KB Output is correct
34 Correct 117 ms 188280 KB Output is correct
35 Correct 120 ms 188280 KB Output is correct
36 Correct 120 ms 188280 KB Output is correct
37 Correct 122 ms 188264 KB Output is correct
38 Correct 121 ms 188360 KB Output is correct
39 Correct 117 ms 188280 KB Output is correct
40 Correct 122 ms 188280 KB Output is correct
41 Correct 120 ms 188408 KB Output is correct
42 Correct 116 ms 188336 KB Output is correct
43 Correct 118 ms 188280 KB Output is correct
44 Correct 120 ms 188284 KB Output is correct
45 Correct 121 ms 188408 KB Output is correct
46 Correct 119 ms 188280 KB Output is correct
47 Correct 117 ms 188280 KB Output is correct
48 Correct 115 ms 188280 KB Output is correct
49 Correct 123 ms 188408 KB Output is correct
50 Correct 117 ms 188408 KB Output is correct
51 Correct 120 ms 188408 KB Output is correct
52 Correct 118 ms 188408 KB Output is correct
53 Correct 116 ms 188412 KB Output is correct
54 Correct 119 ms 188408 KB Output is correct
55 Correct 118 ms 188408 KB Output is correct
56 Correct 119 ms 188408 KB Output is correct
57 Correct 119 ms 188408 KB Output is correct
58 Correct 115 ms 188536 KB Output is correct
59 Correct 122 ms 188536 KB Output is correct
60 Correct 117 ms 188540 KB Output is correct
61 Correct 116 ms 188288 KB Output is correct
62 Correct 124 ms 188408 KB Output is correct
63 Correct 130 ms 188280 KB Output is correct
64 Correct 205 ms 193272 KB Output is correct
65 Correct 195 ms 190844 KB Output is correct
66 Correct 205 ms 190072 KB Output is correct
67 Correct 142 ms 189560 KB Output is correct
68 Correct 205 ms 193400 KB Output is correct
69 Correct 192 ms 190840 KB Output is correct
70 Correct 203 ms 190200 KB Output is correct
71 Correct 156 ms 189944 KB Output is correct
72 Correct 199 ms 194936 KB Output is correct
73 Correct 192 ms 194040 KB Output is correct
74 Correct 203 ms 194040 KB Output is correct
75 Correct 192 ms 193656 KB Output is correct
76 Correct 202 ms 195960 KB Output is correct
77 Correct 217 ms 195924 KB Output is correct
78 Correct 216 ms 195960 KB Output is correct
79 Correct 241 ms 195960 KB Output is correct
80 Correct 205 ms 193280 KB Output is correct
81 Correct 180 ms 190840 KB Output is correct
82 Correct 166 ms 190072 KB Output is correct
83 Correct 159 ms 189560 KB Output is correct
84 Correct 197 ms 193272 KB Output is correct
85 Correct 179 ms 190860 KB Output is correct
86 Correct 186 ms 190072 KB Output is correct
87 Correct 163 ms 189976 KB Output is correct
88 Correct 206 ms 194936 KB Output is correct
89 Correct 200 ms 194040 KB Output is correct
90 Correct 211 ms 193784 KB Output is correct
91 Correct 194 ms 193656 KB Output is correct
92 Correct 202 ms 195960 KB Output is correct
93 Correct 199 ms 195908 KB Output is correct
94 Correct 195 ms 195908 KB Output is correct
95 Correct 203 ms 195836 KB Output is correct
96 Correct 136 ms 189560 KB Output is correct
97 Correct 140 ms 189560 KB Output is correct
98 Correct 148 ms 189560 KB Output is correct
99 Correct 155 ms 189560 KB Output is correct
100 Correct 163 ms 189944 KB Output is correct
101 Correct 161 ms 189816 KB Output is correct
102 Correct 172 ms 190072 KB Output is correct
103 Correct 140 ms 189560 KB Output is correct
104 Correct 209 ms 193144 KB Output is correct
105 Correct 191 ms 190840 KB Output is correct
106 Correct 163 ms 189944 KB Output is correct
107 Correct 141 ms 189564 KB Output is correct
108 Correct 188 ms 192632 KB Output is correct
109 Correct 176 ms 190584 KB Output is correct
110 Correct 161 ms 189944 KB Output is correct
111 Correct 145 ms 189628 KB Output is correct
112 Correct 161 ms 192760 KB Output is correct
113 Correct 157 ms 192632 KB Output is correct
114 Correct 152 ms 192812 KB Output is correct
115 Correct 159 ms 192504 KB Output is correct
116 Correct 158 ms 192872 KB Output is correct
117 Correct 161 ms 192632 KB Output is correct
118 Correct 159 ms 192728 KB Output is correct
119 Correct 161 ms 192632 KB Output is correct
120 Correct 156 ms 192828 KB Output is correct
121 Correct 158 ms 192760 KB Output is correct
122 Correct 189 ms 196472 KB Output is correct
123 Correct 189 ms 196216 KB Output is correct
124 Correct 169 ms 190712 KB Output is correct
125 Correct 161 ms 190072 KB Output is correct
126 Correct 165 ms 189980 KB Output is correct
127 Correct 178 ms 191224 KB Output is correct
128 Correct 162 ms 190076 KB Output is correct
129 Correct 157 ms 189944 KB Output is correct
130 Correct 184 ms 191480 KB Output is correct
131 Correct 167 ms 190172 KB Output is correct
132 Correct 156 ms 190048 KB Output is correct
133 Correct 562 ms 209072 KB Output is correct
134 Correct 530 ms 199160 KB Output is correct
135 Correct 357 ms 196728 KB Output is correct
136 Correct 235 ms 194424 KB Output is correct
137 Correct 516 ms 209120 KB Output is correct
138 Correct 441 ms 199440 KB Output is correct
139 Correct 366 ms 196604 KB Output is correct
140 Correct 326 ms 195608 KB Output is correct
141 Correct 514 ms 215684 KB Output is correct
142 Correct 512 ms 212112 KB Output is correct
143 Correct 502 ms 211276 KB Output is correct
144 Correct 487 ms 211164 KB Output is correct
145 Correct 523 ms 219840 KB Output is correct
146 Correct 551 ms 219852 KB Output is correct
147 Correct 528 ms 219956 KB Output is correct
148 Correct 525 ms 219796 KB Output is correct
149 Correct 508 ms 208848 KB Output is correct
150 Correct 428 ms 199160 KB Output is correct
151 Correct 390 ms 196728 KB Output is correct
152 Correct 231 ms 194296 KB Output is correct
153 Correct 502 ms 208888 KB Output is correct
154 Correct 437 ms 199088 KB Output is correct
155 Correct 381 ms 196600 KB Output is correct
156 Correct 319 ms 195576 KB Output is correct
157 Correct 598 ms 215796 KB Output is correct
158 Correct 503 ms 211980 KB Output is correct
159 Correct 505 ms 211192 KB Output is correct
160 Correct 491 ms 211196 KB Output is correct
161 Correct 520 ms 219512 KB Output is correct
162 Correct 516 ms 219508 KB Output is correct
163 Correct 530 ms 219640 KB Output is correct
164 Correct 520 ms 219600 KB Output is correct
165 Correct 211 ms 193788 KB Output is correct
166 Correct 211 ms 193780 KB Output is correct
167 Correct 207 ms 193656 KB Output is correct
168 Correct 232 ms 193820 KB Output is correct
169 Correct 325 ms 195660 KB Output is correct
170 Correct 310 ms 195196 KB Output is correct
171 Correct 373 ms 194936 KB Output is correct
172 Correct 301 ms 193912 KB Output is correct
173 Correct 502 ms 208132 KB Output is correct
174 Correct 431 ms 198924 KB Output is correct
175 Correct 355 ms 196216 KB Output is correct
176 Correct 238 ms 194040 KB Output is correct
177 Correct 517 ms 205940 KB Output is correct
178 Correct 435 ms 198424 KB Output is correct
179 Correct 357 ms 196108 KB Output is correct
180 Correct 238 ms 193980 KB Output is correct
181 Correct 309 ms 207476 KB Output is correct
182 Correct 336 ms 207156 KB Output is correct
183 Correct 292 ms 207476 KB Output is correct
184 Correct 321 ms 207100 KB Output is correct
185 Correct 322 ms 207348 KB Output is correct
186 Correct 330 ms 207092 KB Output is correct
187 Correct 298 ms 207476 KB Output is correct
188 Correct 310 ms 207352 KB Output is correct
189 Correct 321 ms 207496 KB Output is correct
190 Correct 317 ms 207220 KB Output is correct
191 Correct 415 ms 222324 KB Output is correct
192 Correct 401 ms 221160 KB Output is correct
193 Correct 1492 ms 323920 KB Output is correct
194 Correct 1348 ms 318828 KB Output is correct
195 Correct 2727 ms 460884 KB Output is correct
196 Correct 2622 ms 450560 KB Output is correct
197 Correct 3354 ms 522524 KB Output is correct
198 Correct 3202 ms 510444 KB Output is correct
199 Correct 3339 ms 272084 KB Output is correct
200 Correct 2606 ms 256640 KB Output is correct
201 Correct 2379 ms 254420 KB Output is correct
202 Correct 3864 ms 279588 KB Output is correct
203 Correct 2645 ms 256552 KB Output is correct
204 Correct 2469 ms 254204 KB Output is correct
205 Correct 3679 ms 283068 KB Output is correct
206 Correct 2562 ms 256572 KB Output is correct
207 Correct 2478 ms 254276 KB Output is correct
208 Correct 1482 ms 245624 KB Output is correct
209 Correct 1571 ms 245324 KB Output is correct
210 Correct 1593 ms 245388 KB Output is correct
211 Correct 1581 ms 245752 KB Output is correct
212 Correct 1521 ms 245500 KB Output is correct
213 Correct 5645 ms 388792 KB Output is correct
214 Correct 4830 ms 296820 KB Output is correct
215 Correct 4011 ms 274540 KB Output is correct
216 Correct 2117 ms 257188 KB Output is correct
217 Correct 5525 ms 390124 KB Output is correct
218 Correct 4810 ms 299076 KB Output is correct
219 Correct 4094 ms 276288 KB Output is correct
220 Correct 2584 ms 261624 KB Output is correct
221 Correct 5703 ms 451232 KB Output is correct
222 Correct 5350 ms 417516 KB Output is correct
223 Correct 5541 ms 409084 KB Output is correct
224 Correct 5500 ms 408152 KB Output is correct
225 Correct 5721 ms 486696 KB Output is correct
226 Correct 5594 ms 485676 KB Output is correct
227 Correct 5507 ms 487080 KB Output is correct
228 Correct 5610 ms 487440 KB Output is correct
229 Correct 5526 ms 387536 KB Output is correct
230 Correct 4961 ms 296312 KB Output is correct
231 Correct 4043 ms 274296 KB Output is correct
232 Correct 2147 ms 256980 KB Output is correct
233 Correct 5407 ms 388248 KB Output is correct
234 Correct 4979 ms 298368 KB Output is correct
235 Correct 4179 ms 276324 KB Output is correct
236 Correct 2676 ms 262528 KB Output is correct
237 Correct 5540 ms 450356 KB Output is correct
238 Correct 5362 ms 415308 KB Output is correct
239 Correct 5273 ms 408032 KB Output is correct
240 Correct 5170 ms 407116 KB Output is correct
241 Correct 5340 ms 485052 KB Output is correct
242 Correct 5456 ms 485672 KB Output is correct
243 Correct 5382 ms 484832 KB Output is correct
244 Correct 5372 ms 483992 KB Output is correct
245 Correct 1296 ms 242312 KB Output is correct
246 Correct 1283 ms 242424 KB Output is correct
247 Correct 1266 ms 242336 KB Output is correct
248 Correct 1294 ms 242300 KB Output is correct
249 Correct 2428 ms 259988 KB Output is correct
250 Correct 2524 ms 261132 KB Output is correct
251 Correct 2557 ms 262316 KB Output is correct
252 Correct 1933 ms 251192 KB Output is correct
253 Correct 5546 ms 379192 KB Output is correct
254 Correct 4711 ms 296424 KB Output is correct
255 Correct 3627 ms 273140 KB Output is correct
256 Correct 1962 ms 252152 KB Output is correct
257 Correct 5434 ms 355144 KB Output is correct
258 Correct 4600 ms 289220 KB Output is correct
259 Correct 3688 ms 269888 KB Output is correct
260 Correct 1994 ms 251000 KB Output is correct
261 Correct 2260 ms 380884 KB Output is correct
262 Correct 3350 ms 378980 KB Output is correct
263 Correct 1966 ms 371760 KB Output is correct
264 Correct 3160 ms 367260 KB Output is correct
265 Correct 2276 ms 380756 KB Output is correct
266 Correct 3397 ms 379160 KB Output is correct
267 Correct 1967 ms 371916 KB Output is correct
268 Correct 3042 ms 367460 KB Output is correct
269 Correct 3320 ms 522492 KB Output is correct
270 Correct 3269 ms 510560 KB Output is correct
271 Correct 3455 ms 273828 KB Output is correct
272 Correct 2569 ms 256376 KB Output is correct
273 Correct 3835 ms 282936 KB Output is correct
274 Correct 2558 ms 256576 KB Output is correct
275 Correct 1958 ms 319704 KB Output is correct