답안 #282994

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
282994 2020-08-25T08:25:35 Z 문홍윤(#5763) Iqea (innopolis2018_final_C) C++17
51 / 100
2000 ms 115528 KB
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define eb emplace_back
#define mp make_pair
#define F first
#define S second
#define svec(x) sort(x.begin(), x.end())
#define press(x) x.erase(unique(x.begin(), x.end()), x.end())
using namespace std;
typedef pair<int, int> pii;
const int inf=1e9;

int n, rex, rey;
unordered_map<int, int> mx[100010], my[100010];
pii p[100010];
vector<int> lx[100010], ly[100010];

bool cmp(pii a, pii b){return mp(a.S, a.F)<mp(b.S, b.F);}
inline void make_tree(){
    sort(p+1, p+n+1);
    for(register int i=1; i<=n; i++){
        if(p[i].F!=p[i-1].F||p[i].S!=p[i-1].S+1)rex++;
        mx[p[i].F][p[i].S]=rex;
    }
    sort(p+1, p+n+1, cmp);
    for(register int i=1; i<=n; i++){
        if(p[i].S!=p[i-1].S||p[i].F!=p[i-1].F+1)rey++;
        my[p[i].F][p[i].S]=rey;
    }
    for(register int i=1; i<=n; i++){
        if(mx[p[i].F+1][p[i].S]){
            lx[mx[p[i].F][p[i].S]].eb(mx[p[i].F+1][p[i].S]);
            lx[mx[p[i].F+1][p[i].S]].eb(mx[p[i].F][p[i].S]);
        }
        if(my[p[i].F][p[i].S+1]){
            ly[my[p[i].F][p[i].S]].eb(my[p[i].F][p[i].S+1]);
            ly[my[p[i].F][p[i].S+1]].eb(my[p[i].F][p[i].S]);
        }
    }
    for(register int i=1; i<=rex; i++){
        svec(lx[i]);
        press(lx[i]);
    }
    for(register int i=1; i<=rey; i++){
        svec(ly[i]);
        press(ly[i]);
    }
}

int sz[100010];
bool ch[100010];
void dfs_x(int num, int par){
    sz[num]=1;
    for(auto i:lx[num]){
        if(i==par||ch[i])continue;
        dfs_x(i, num);
        sz[num]+=sz[i];
    }
}
int get_cen_x(int num, int siz){
    int ov=0;
    for(auto i:lx[num]){
        if(ch[i])continue;
        if(sz[i]>siz/2){
            ov=i;
            break;
        }
    }
    if(!ov)return num;
    sz[num]=siz-sz[ov];
    sz[ov]=siz;
    return get_cen_x(ov, siz);
}
void dfs_y(int num, int par){
    sz[num]=1;
    for(auto i:ly[num]){
        if(i==par||ch[i])continue;
        dfs_y(i, num);
        sz[num]+=sz[i];
    }
}
int get_cen_y(int num, int siz){
    int ov=0;
    for(auto i:ly[num]){
        if(ch[i])continue;
        if(sz[i]>siz/2){
            ov=i;
            break;
        }
    }
    if(!ov)return num;
    sz[num]=siz-sz[ov];
    sz[ov]=siz;
    return get_cen_y(ov, siz);
}

int cpar_x[100010], cpar_y[100010];
int d_x[100010][20], d_y[100010][20];

void make_cen_x(int num, int par){
    dfs_x(num, par);
    int cen=get_cen_x(num, sz[num]);
    cpar_x[cen]=par;
    ch[cen]=true;
    for(auto i:lx[cen]){
        if(ch[i])continue;
        make_cen_x(i, cen);
    }
}
void make_cen_y(int num, int par){
    dfs_y(num, par);
    int cen=get_cen_y(num, sz[num]);
    cpar_y[cen]=par;
    ch[cen]=true;
    for(auto i:ly[cen]){
        if(ch[i])continue;
        make_cen_y(i, cen);
    }
}

int dep_x[100010], dep_y[100010];
int sp_x[100010][20], sp_y[100010][20];
void dfs2_x(int num, int par){
    dep_x[num]=dep_x[par]+1;
    sp_x[num][0]=par;
    for(auto i:lx[num]){
        if(i==par)continue;
        dfs2_x(i, num);
    }
}
void dfs2_y(int num, int par){
    dep_y[num]=dep_y[par]+1;
    sp_y[num][0]=par;
    for(auto i:ly[num]){
        if(i==par)continue;
        dfs2_y(i, num);
    }
}

inline int lca_x(int x, int y){
    if(dep_x[x]>dep_x[y])swap(x, y);
    for(register int i=19; i>=0; i--){
        if(dep_x[y]-dep_x[x]>=(1<<i))y=sp_x[y][i];
    }
    if(x==y)return x;
    for(register int i=19; i>=0; i--){
        if(sp_x[x][i]!=sp_x[y][i]){
            x=sp_x[x][i];
            y=sp_x[y][i];
        }
    }
    return sp_x[x][0];
}
inline int lca_y(int x, int y){
    if(dep_y[x]>dep_y[y])swap(x, y);
    for(register int i=19; i>=0; i--){
        if(dep_y[y]-dep_y[x]>=(1<<i))y=sp_y[y][i];
    }
    if(x==y)return x;
    for(register int i=19; i>=0; i--){
        if(sp_y[x][i]!=sp_y[y][i]){
            x=sp_y[x][i];
            y=sp_y[y][i];
        }
    }
    return sp_y[x][0];
}
inline int getd_x(int x, int y){return dep_x[x]+dep_x[y]-2*dep_x[lca_x(x, y)];}
inline int getd_y(int x, int y){return dep_y[x]+dep_y[y]-2*dep_y[lca_y(x, y)];}

inline void get_cend_x(){
    for(register int i=1; i<=rex; i++){
        int nw=cpar_x[i];
        for(register int j=1; nw; j++, nw=cpar_x[nw])d_x[i][j]=getd_x(i, nw);
    }
}
inline void get_cend_y(){
    for(register int i=1; i<=rey; i++){
        int nw=cpar_y[i];
        for(register int j=1; nw; j++, nw=cpar_y[nw])d_y[i][j]=getd_y(i, nw);
    }
}

unordered_map<int, int> arr[100010];

inline void upd(int x, int y){
    int nx=mx[x][y], ny=my[x][y];
    int tx=nx, ty=ny;
    for(register int i=0; tx; i++, tx=cpar_x[tx]){
        ty=ny;
        for(register int j=0; ty; j++, ty=cpar_y[ty]){
            int tmp=d_x[nx][i]+d_y[ny][j]+1;
            if(!arr[tx][ty])arr[tx][ty]=inf;
            arr[tx][ty]=min(tmp, arr[tx][ty]);
        }
    }
}
inline int query(int x, int y){
    int nx=mx[x][y], ny=my[x][y], ret=inf;
    int tx=nx, ty=ny;
    for(register int i=0; tx; i++, tx=cpar_x[tx]){
        ty=ny;
        for(register int j=0; ty; j++, ty=cpar_y[ty]){
            if(!arr[tx][ty])continue;
            int tmp=d_x[nx][i]+d_y[ny][j];
            ret=min(ret, arr[tx][ty]+tmp-1);
        }
    }
    return ret==inf?-1:ret;
}

inline int readChar();
template<class T=int> inline T readInt();
static const int buf_size=4096;
inline int getChar(){
    static char buf[buf_size];
    static int len=0, pos=0;
    if(pos==len)pos=0, len=fread(buf, 1, buf_size, stdin);
    if(pos==len)return -1;
    return buf[pos++];
}
inline int readChar(){
    int c=getChar();
    while(c<=32)c=getChar();
    return c;
}
template <class T>
inline T readInt(){
    int s=1, c=readChar();
    T x=0;
    if(c=='-')s=-1, c=getChar();
    while('0'<= c&&c<='9')x=x*10+c-'0', c=getChar();
    return s==1?x:-x;
}

int main(){
    //scanf("%d", &n);
    n=readInt();
    for(register int i=1; i<=n; i++){
        //scanf("%d %d", &p[i].F, &p[i].S);
        p[i].F=readInt(); p[i].S=readInt();
    }
    make_tree();
    make_cen_x(1, 0);
    memset(ch, 0, sizeof ch);
    make_cen_y(1, 0);
    dfs2_x(1, 0);
    dfs2_y(1, 0);
    for(register int j=1; j<20; j++){
        for(register int i=1; i<=rex; i++)sp_x[i][j]=sp_x[sp_x[i][j-1]][j-1];
        for(register int i=1; i<=rey; i++)sp_y[i][j]=sp_y[sp_y[i][j-1]][j-1];
    }
    get_cend_x();
    get_cend_y();
    register int q;
    //scanf("%d", &q);
    q=readInt();
    for(register int i=1; i<=q; i++){
        int a, b, c;
        //scanf("%d %d %d", &a, &b, &c);
        a=readInt(); b=readInt(); c=readInt();
        if(a==1)upd(b, c);
        else printf("%d\n", query(b, c));
    }
}

Compilation message

C.cpp: In function 'void make_tree()':
C.cpp:23:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   23 |     for(register int i=1; i<=n; i++){
      |                      ^
C.cpp:28:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   28 |     for(register int i=1; i<=n; i++){
      |                      ^
C.cpp:32:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   32 |     for(register int i=1; i<=n; i++){
      |                      ^
C.cpp:42:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   42 |     for(register int i=1; i<=rex; i++){
      |                      ^
C.cpp:46:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   46 |     for(register int i=1; i<=rey; i++){
      |                      ^
C.cpp: In function 'int lca_x(int, int)':
C.cpp:144:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  144 |     for(register int i=19; i>=0; i--){
      |                      ^
C.cpp:148:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  148 |     for(register int i=19; i>=0; i--){
      |                      ^
C.cpp: In function 'int lca_y(int, int)':
C.cpp:158:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  158 |     for(register int i=19; i>=0; i--){
      |                      ^
C.cpp:162:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  162 |     for(register int i=19; i>=0; i--){
      |                      ^
C.cpp: In function 'void get_cend_x()':
C.cpp:174:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  174 |     for(register int i=1; i<=rex; i++){
      |                      ^
C.cpp:176:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  176 |         for(register int j=1; nw; j++, nw=cpar_x[nw])d_x[i][j]=getd_x(i, nw);
      |                          ^
C.cpp: In function 'void get_cend_y()':
C.cpp:180:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  180 |     for(register int i=1; i<=rey; i++){
      |                      ^
C.cpp:182:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  182 |         for(register int j=1; nw; j++, nw=cpar_y[nw])d_y[i][j]=getd_y(i, nw);
      |                          ^
C.cpp: In function 'void upd(int, int)':
C.cpp:191:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  191 |     for(register int i=0; tx; i++, tx=cpar_x[tx]){
      |                      ^
C.cpp:193:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  193 |         for(register int j=0; ty; j++, ty=cpar_y[ty]){
      |                          ^
C.cpp: In function 'int query(int, int)':
C.cpp:203:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  203 |     for(register int i=0; tx; i++, tx=cpar_x[tx]){
      |                      ^
C.cpp:205:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  205 |         for(register int j=0; ty; j++, ty=cpar_y[ty]){
      |                          ^
C.cpp: In function 'int main()':
C.cpp:241:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  241 |     for(register int i=1; i<=n; i++){
      |                      ^
C.cpp:251:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  251 |     for(register int j=1; j<20; j++){
      |                      ^
C.cpp:252:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  252 |         for(register int i=1; i<=rex; i++)sp_x[i][j]=sp_x[sp_x[i][j-1]][j-1];
      |                          ^
C.cpp:253:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  253 |         for(register int i=1; i<=rey; i++)sp_y[i][j]=sp_y[sp_y[i][j-1]][j-1];
      |                          ^
C.cpp:257:18: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  257 |     register int q;
      |                  ^
C.cpp:260:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  260 |     for(register int i=1; i<=q; i++){
      |                      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 21632 KB Output is correct
2 Correct 16 ms 21632 KB Output is correct
3 Correct 16 ms 21632 KB Output is correct
4 Correct 28 ms 22656 KB Output is correct
5 Correct 26 ms 22648 KB Output is correct
6 Correct 28 ms 22656 KB Output is correct
7 Correct 45 ms 24440 KB Output is correct
8 Correct 41 ms 24576 KB Output is correct
9 Correct 41 ms 24696 KB Output is correct
10 Correct 39 ms 24440 KB Output is correct
11 Correct 43 ms 24568 KB Output is correct
12 Correct 41 ms 24696 KB Output is correct
13 Correct 40 ms 24696 KB Output is correct
14 Correct 40 ms 24704 KB Output is correct
15 Correct 41 ms 24696 KB Output is correct
16 Correct 40 ms 24444 KB Output is correct
17 Correct 39 ms 24320 KB Output is correct
18 Correct 43 ms 24440 KB Output is correct
19 Correct 38 ms 24192 KB Output is correct
20 Correct 42 ms 24700 KB Output is correct
21 Correct 41 ms 24576 KB Output is correct
22 Correct 46 ms 24952 KB Output is correct
23 Correct 46 ms 25080 KB Output is correct
24 Correct 50 ms 25460 KB Output is correct
25 Correct 29 ms 24312 KB Output is correct
26 Correct 30 ms 24440 KB Output is correct
27 Correct 28 ms 23928 KB Output is correct
28 Correct 46 ms 25336 KB Output is correct
29 Correct 47 ms 25344 KB Output is correct
30 Correct 48 ms 25468 KB Output is correct
31 Correct 48 ms 25464 KB Output is correct
32 Correct 51 ms 25336 KB Output is correct
33 Correct 58 ms 25336 KB Output is correct
34 Correct 52 ms 25464 KB Output is correct
35 Correct 50 ms 25592 KB Output is correct
36 Correct 35 ms 24184 KB Output is correct
37 Correct 50 ms 25384 KB Output is correct
38 Correct 48 ms 25336 KB Output is correct
39 Correct 56 ms 25464 KB Output is correct
40 Correct 49 ms 25592 KB Output is correct
41 Correct 46 ms 25080 KB Output is correct
42 Correct 47 ms 25080 KB Output is correct
43 Correct 31 ms 24056 KB Output is correct
44 Correct 46 ms 25080 KB Output is correct
45 Correct 51 ms 25080 KB Output is correct
46 Correct 27 ms 24064 KB Output is correct
47 Correct 39 ms 23928 KB Output is correct
48 Correct 35 ms 23552 KB Output is correct
49 Correct 35 ms 23296 KB Output is correct
50 Correct 32 ms 23288 KB Output is correct
51 Correct 34 ms 22912 KB Output is correct
52 Correct 39 ms 23928 KB Output is correct
53 Correct 38 ms 24064 KB Output is correct
54 Correct 39 ms 23928 KB Output is correct
55 Correct 39 ms 24056 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 21632 KB Output is correct
2 Correct 16 ms 21632 KB Output is correct
3 Correct 16 ms 21632 KB Output is correct
4 Correct 28 ms 22656 KB Output is correct
5 Correct 26 ms 22648 KB Output is correct
6 Correct 28 ms 22656 KB Output is correct
7 Correct 45 ms 24440 KB Output is correct
8 Correct 41 ms 24576 KB Output is correct
9 Correct 41 ms 24696 KB Output is correct
10 Correct 39 ms 24440 KB Output is correct
11 Correct 43 ms 24568 KB Output is correct
12 Correct 41 ms 24696 KB Output is correct
13 Correct 40 ms 24696 KB Output is correct
14 Correct 40 ms 24704 KB Output is correct
15 Correct 41 ms 24696 KB Output is correct
16 Correct 40 ms 24444 KB Output is correct
17 Correct 39 ms 24320 KB Output is correct
18 Correct 43 ms 24440 KB Output is correct
19 Correct 38 ms 24192 KB Output is correct
20 Correct 42 ms 24700 KB Output is correct
21 Correct 41 ms 24576 KB Output is correct
22 Correct 46 ms 24952 KB Output is correct
23 Correct 46 ms 25080 KB Output is correct
24 Correct 50 ms 25460 KB Output is correct
25 Correct 29 ms 24312 KB Output is correct
26 Correct 30 ms 24440 KB Output is correct
27 Correct 28 ms 23928 KB Output is correct
28 Correct 46 ms 25336 KB Output is correct
29 Correct 47 ms 25344 KB Output is correct
30 Correct 48 ms 25468 KB Output is correct
31 Correct 48 ms 25464 KB Output is correct
32 Correct 51 ms 25336 KB Output is correct
33 Correct 58 ms 25336 KB Output is correct
34 Correct 52 ms 25464 KB Output is correct
35 Correct 50 ms 25592 KB Output is correct
36 Correct 35 ms 24184 KB Output is correct
37 Correct 50 ms 25384 KB Output is correct
38 Correct 48 ms 25336 KB Output is correct
39 Correct 56 ms 25464 KB Output is correct
40 Correct 49 ms 25592 KB Output is correct
41 Correct 46 ms 25080 KB Output is correct
42 Correct 47 ms 25080 KB Output is correct
43 Correct 31 ms 24056 KB Output is correct
44 Correct 46 ms 25080 KB Output is correct
45 Correct 51 ms 25080 KB Output is correct
46 Correct 27 ms 24064 KB Output is correct
47 Correct 39 ms 23928 KB Output is correct
48 Correct 35 ms 23552 KB Output is correct
49 Correct 35 ms 23296 KB Output is correct
50 Correct 32 ms 23288 KB Output is correct
51 Correct 34 ms 22912 KB Output is correct
52 Correct 39 ms 23928 KB Output is correct
53 Correct 38 ms 24064 KB Output is correct
54 Correct 39 ms 23928 KB Output is correct
55 Correct 39 ms 24056 KB Output is correct
56 Correct 117 ms 23288 KB Output is correct
57 Correct 120 ms 23320 KB Output is correct
58 Correct 137 ms 23288 KB Output is correct
59 Correct 251 ms 25496 KB Output is correct
60 Correct 263 ms 25592 KB Output is correct
61 Correct 243 ms 25592 KB Output is correct
62 Correct 238 ms 25336 KB Output is correct
63 Correct 251 ms 25336 KB Output is correct
64 Correct 235 ms 25592 KB Output is correct
65 Correct 230 ms 25592 KB Output is correct
66 Correct 238 ms 25592 KB Output is correct
67 Correct 227 ms 25592 KB Output is correct
68 Correct 254 ms 25592 KB Output is correct
69 Correct 213 ms 25336 KB Output is correct
70 Correct 243 ms 25336 KB Output is correct
71 Correct 205 ms 24952 KB Output is correct
72 Correct 244 ms 25464 KB Output is correct
73 Correct 233 ms 25464 KB Output is correct
74 Correct 97 ms 25208 KB Output is correct
75 Correct 99 ms 25464 KB Output is correct
76 Correct 64 ms 24696 KB Output is correct
77 Correct 292 ms 26360 KB Output is correct
78 Correct 292 ms 26488 KB Output is correct
79 Correct 77 ms 24952 KB Output is correct
80 Correct 305 ms 26360 KB Output is correct
81 Correct 305 ms 26360 KB Output is correct
82 Correct 268 ms 26108 KB Output is correct
83 Correct 287 ms 26232 KB Output is correct
84 Correct 90 ms 24952 KB Output is correct
85 Correct 288 ms 26104 KB Output is correct
86 Correct 300 ms 26200 KB Output is correct
87 Correct 71 ms 24824 KB Output is correct
88 Correct 216 ms 24696 KB Output is correct
89 Correct 176 ms 24184 KB Output is correct
90 Correct 202 ms 24312 KB Output is correct
91 Correct 169 ms 23928 KB Output is correct
92 Correct 128 ms 23416 KB Output is correct
93 Correct 197 ms 25080 KB Output is correct
94 Correct 218 ms 24824 KB Output is correct
95 Correct 213 ms 24824 KB Output is correct
96 Correct 209 ms 24824 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 437 ms 70296 KB Output is correct
2 Correct 439 ms 74388 KB Output is correct
3 Correct 1813 ms 113808 KB Output is correct
4 Correct 1874 ms 114896 KB Output is correct
5 Correct 1695 ms 115324 KB Output is correct
6 Correct 1755 ms 114808 KB Output is correct
7 Correct 710 ms 48120 KB Output is correct
8 Correct 362 ms 60824 KB Output is correct
9 Correct 345 ms 65708 KB Output is correct
10 Correct 919 ms 47624 KB Output is correct
11 Correct 545 ms 61716 KB Output is correct
12 Correct 380 ms 65692 KB Output is correct
13 Correct 364 ms 65820 KB Output is correct
14 Correct 375 ms 65796 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1337 ms 90904 KB Output is correct
2 Correct 1441 ms 92152 KB Output is correct
3 Correct 1609 ms 91896 KB Output is correct
4 Correct 1755 ms 93188 KB Output is correct
5 Correct 1746 ms 93232 KB Output is correct
6 Correct 1736 ms 93376 KB Output is correct
7 Correct 1668 ms 92048 KB Output is correct
8 Correct 1605 ms 92024 KB Output is correct
9 Correct 1607 ms 93120 KB Output is correct
10 Correct 1781 ms 107160 KB Output is correct
11 Correct 1784 ms 107172 KB Output is correct
12 Correct 1924 ms 112504 KB Output is correct
13 Correct 506 ms 76408 KB Output is correct
14 Correct 554 ms 87172 KB Output is correct
15 Correct 340 ms 66972 KB Output is correct
16 Correct 1696 ms 112888 KB Output is correct
17 Correct 1715 ms 112632 KB Output is correct
18 Correct 1746 ms 115528 KB Output is correct
19 Correct 1668 ms 115192 KB Output is correct
20 Correct 1899 ms 111156 KB Output is correct
21 Execution timed out 2100 ms 111684 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 21632 KB Output is correct
2 Correct 16 ms 21632 KB Output is correct
3 Correct 16 ms 21632 KB Output is correct
4 Correct 28 ms 22656 KB Output is correct
5 Correct 26 ms 22648 KB Output is correct
6 Correct 28 ms 22656 KB Output is correct
7 Correct 45 ms 24440 KB Output is correct
8 Correct 41 ms 24576 KB Output is correct
9 Correct 41 ms 24696 KB Output is correct
10 Correct 39 ms 24440 KB Output is correct
11 Correct 43 ms 24568 KB Output is correct
12 Correct 41 ms 24696 KB Output is correct
13 Correct 40 ms 24696 KB Output is correct
14 Correct 40 ms 24704 KB Output is correct
15 Correct 41 ms 24696 KB Output is correct
16 Correct 40 ms 24444 KB Output is correct
17 Correct 39 ms 24320 KB Output is correct
18 Correct 43 ms 24440 KB Output is correct
19 Correct 38 ms 24192 KB Output is correct
20 Correct 42 ms 24700 KB Output is correct
21 Correct 41 ms 24576 KB Output is correct
22 Correct 46 ms 24952 KB Output is correct
23 Correct 46 ms 25080 KB Output is correct
24 Correct 50 ms 25460 KB Output is correct
25 Correct 29 ms 24312 KB Output is correct
26 Correct 30 ms 24440 KB Output is correct
27 Correct 28 ms 23928 KB Output is correct
28 Correct 46 ms 25336 KB Output is correct
29 Correct 47 ms 25344 KB Output is correct
30 Correct 48 ms 25468 KB Output is correct
31 Correct 48 ms 25464 KB Output is correct
32 Correct 51 ms 25336 KB Output is correct
33 Correct 58 ms 25336 KB Output is correct
34 Correct 52 ms 25464 KB Output is correct
35 Correct 50 ms 25592 KB Output is correct
36 Correct 35 ms 24184 KB Output is correct
37 Correct 50 ms 25384 KB Output is correct
38 Correct 48 ms 25336 KB Output is correct
39 Correct 56 ms 25464 KB Output is correct
40 Correct 49 ms 25592 KB Output is correct
41 Correct 46 ms 25080 KB Output is correct
42 Correct 47 ms 25080 KB Output is correct
43 Correct 31 ms 24056 KB Output is correct
44 Correct 46 ms 25080 KB Output is correct
45 Correct 51 ms 25080 KB Output is correct
46 Correct 27 ms 24064 KB Output is correct
47 Correct 39 ms 23928 KB Output is correct
48 Correct 35 ms 23552 KB Output is correct
49 Correct 35 ms 23296 KB Output is correct
50 Correct 32 ms 23288 KB Output is correct
51 Correct 34 ms 22912 KB Output is correct
52 Correct 39 ms 23928 KB Output is correct
53 Correct 38 ms 24064 KB Output is correct
54 Correct 39 ms 23928 KB Output is correct
55 Correct 39 ms 24056 KB Output is correct
56 Correct 117 ms 23288 KB Output is correct
57 Correct 120 ms 23320 KB Output is correct
58 Correct 137 ms 23288 KB Output is correct
59 Correct 251 ms 25496 KB Output is correct
60 Correct 263 ms 25592 KB Output is correct
61 Correct 243 ms 25592 KB Output is correct
62 Correct 238 ms 25336 KB Output is correct
63 Correct 251 ms 25336 KB Output is correct
64 Correct 235 ms 25592 KB Output is correct
65 Correct 230 ms 25592 KB Output is correct
66 Correct 238 ms 25592 KB Output is correct
67 Correct 227 ms 25592 KB Output is correct
68 Correct 254 ms 25592 KB Output is correct
69 Correct 213 ms 25336 KB Output is correct
70 Correct 243 ms 25336 KB Output is correct
71 Correct 205 ms 24952 KB Output is correct
72 Correct 244 ms 25464 KB Output is correct
73 Correct 233 ms 25464 KB Output is correct
74 Correct 97 ms 25208 KB Output is correct
75 Correct 99 ms 25464 KB Output is correct
76 Correct 64 ms 24696 KB Output is correct
77 Correct 292 ms 26360 KB Output is correct
78 Correct 292 ms 26488 KB Output is correct
79 Correct 77 ms 24952 KB Output is correct
80 Correct 305 ms 26360 KB Output is correct
81 Correct 305 ms 26360 KB Output is correct
82 Correct 268 ms 26108 KB Output is correct
83 Correct 287 ms 26232 KB Output is correct
84 Correct 90 ms 24952 KB Output is correct
85 Correct 288 ms 26104 KB Output is correct
86 Correct 300 ms 26200 KB Output is correct
87 Correct 71 ms 24824 KB Output is correct
88 Correct 216 ms 24696 KB Output is correct
89 Correct 176 ms 24184 KB Output is correct
90 Correct 202 ms 24312 KB Output is correct
91 Correct 169 ms 23928 KB Output is correct
92 Correct 128 ms 23416 KB Output is correct
93 Correct 197 ms 25080 KB Output is correct
94 Correct 218 ms 24824 KB Output is correct
95 Correct 213 ms 24824 KB Output is correct
96 Correct 209 ms 24824 KB Output is correct
97 Correct 437 ms 70296 KB Output is correct
98 Correct 439 ms 74388 KB Output is correct
99 Correct 1813 ms 113808 KB Output is correct
100 Correct 1874 ms 114896 KB Output is correct
101 Correct 1695 ms 115324 KB Output is correct
102 Correct 1755 ms 114808 KB Output is correct
103 Correct 710 ms 48120 KB Output is correct
104 Correct 362 ms 60824 KB Output is correct
105 Correct 345 ms 65708 KB Output is correct
106 Correct 919 ms 47624 KB Output is correct
107 Correct 545 ms 61716 KB Output is correct
108 Correct 380 ms 65692 KB Output is correct
109 Correct 364 ms 65820 KB Output is correct
110 Correct 375 ms 65796 KB Output is correct
111 Correct 1337 ms 90904 KB Output is correct
112 Correct 1441 ms 92152 KB Output is correct
113 Correct 1609 ms 91896 KB Output is correct
114 Correct 1755 ms 93188 KB Output is correct
115 Correct 1746 ms 93232 KB Output is correct
116 Correct 1736 ms 93376 KB Output is correct
117 Correct 1668 ms 92048 KB Output is correct
118 Correct 1605 ms 92024 KB Output is correct
119 Correct 1607 ms 93120 KB Output is correct
120 Correct 1781 ms 107160 KB Output is correct
121 Correct 1784 ms 107172 KB Output is correct
122 Correct 1924 ms 112504 KB Output is correct
123 Correct 506 ms 76408 KB Output is correct
124 Correct 554 ms 87172 KB Output is correct
125 Correct 340 ms 66972 KB Output is correct
126 Correct 1696 ms 112888 KB Output is correct
127 Correct 1715 ms 112632 KB Output is correct
128 Correct 1746 ms 115528 KB Output is correct
129 Correct 1668 ms 115192 KB Output is correct
130 Correct 1899 ms 111156 KB Output is correct
131 Execution timed out 2100 ms 111684 KB Time limit exceeded
132 Halted 0 ms 0 KB -