Submission #423430

# Submission time Handle Problem Language Result Execution time Memory
423430 2021-06-11T05:59:27 Z 조영욱(#7649) Crossing (JOI21_crossing) C++17
100 / 100
5205 ms 40164 KB
#include <bits/stdc++.h>
using namespace std;

int n;
const int sz=262144;
int seg[sz*2];

struct SegmentTree {
    int arr[200001];
    int pr[200001];
    bool seg[sz*2];
    int lazy[sz*2];
    void init() {
        int prev=1;
        pr[1]=1;
        for(int i=2;i<=n;i++) {
            if (arr[i-1]!=arr[i]) {
                prev=i;
            }
            pr[i]=prev;
        }
        memset(lazy,-1,sizeof(lazy));
        for(int i=1;i<=n;i++) {
            if (arr[i]==0) {
                seg[i+sz]=true;
            }
        }
        for(int i=sz-1;i>0;i--) {
            seg[i]=(seg[i*2]&seg[i*2+1]);
        }
    }
    void propagate(int node,int nodel,int noder) {
        if (lazy[node]!=-1) {
            if (arr[noder]==lazy[node]&&pr[noder]<=nodel) {
                seg[node]=true;
            }
            else {
                seg[node]=false;
            }
            if (node<sz) {
                lazy[node*2]=lazy[node];
                lazy[node*2+1]=lazy[node];
            }
            lazy[node]=-1;
        }
    }
    bool sum(int l,int r,int node=1,int nodel=0,int noder=sz-1) {
        propagate(node,nodel,noder);
        if (r<nodel||l>noder) {
            return true;
        }
        if (l<=nodel&&noder<=r) {
            return seg[node];
        }
        int mid=(nodel+noder)/2;
        return sum(l,r,node*2,nodel,mid)&sum(l,r,node*2+1,mid+1,noder);
    }
    void update(int l,int r,int val,int node=1,int nodel=0,int noder=sz-1) {
        propagate(node,nodel,noder);
        if (r<nodel||l>noder) {
            return;
        }
        if (l<=nodel&&noder<=r) {
            lazy[node]=val;
            propagate(node,nodel,noder);
            return;
        }
        int mid=(nodel+noder)/2;
        update(l,r,val,node*2,nodel,mid);
        update(l,r,val,node*2+1,mid+1,noder);
        seg[node]=(seg[node*2]&seg[node*2+1]);
    }
};

SegmentTree st[9];
int arr[3][200001];

bool cal() {
    for(int j=0;j<9;j++) {
        if (st[j].sum(1,n)) {
            return true;
        }
    }
    return false;
}

int main(void) {
    scanf("%d\n",&n);
    for(int j=0;j<3;j++) {
        for(int i=1;i<=n;i++) {
            char c;
            scanf("%c",&c);
            if (c=='J') {
                arr[j][i]=0;
            }
            else if (c=='O') {
                arr[j][i]=1;
            }
            else {
                arr[j][i]=2;
            }
        }
        scanf("\n");
    }
    for(int j=0;j<9;j++) {
        for(int i=1;i<=n;i++) {
            st[j].arr[i]=(arr[0][i]*(j/3)+arr[1][i]*(j%3)+arr[2][i]*(4-j/3-j%3))%3;
        }
        st[j].init();
    }
    int q;
    scanf("%d\n",&q);
    for(int i=1;i<=n;i++) {
        char c;
        scanf("%c",&c);
        int val;
        if (c=='J') {
            val=0;
        }
        else if (c=='O') {
            val=1;
        }
        else {
            val=2;
        }
        for(int j=0;j<9;j++){
            st[j].update(i,i,val);
        }
    }
    printf("%s\n",cal()?"Yes":"No");
    for(int i=0;i<q;i++) {
        int l,r;
        char c;
        scanf("%d %d %c",&l,&r,&c);
        int val;
        if (c=='J') {
            val=0;
        }
        else if (c=='O') {
            val=1;
        }
        else {
            val=2;
        }
        for(int j=0;j<9;j++) {
            st[j].update(l,r,val);
        }
        printf("%s\n",cal()?"Yes":"No");
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:88:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   88 |     scanf("%d\n",&n);
      |     ~~~~~^~~~~~~~~~~
Main.cpp:92:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   92 |             scanf("%c",&c);
      |             ~~~~~^~~~~~~~~
Main.cpp:103:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  103 |         scanf("\n");
      |         ~~~~~^~~~~~
Main.cpp:112:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  112 |     scanf("%d\n",&q);
      |     ~~~~~^~~~~~~~~~~
Main.cpp:115:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  115 |         scanf("%c",&c);
      |         ~~~~~^~~~~~~~~
Main.cpp:134:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  134 |         scanf("%d %d %c",&l,&r,&c);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~
Main.cpp: In function 'bool cal()':
Main.cpp:34:26: warning: array subscript 262143 is above array bounds of 'int [200001]' [-Warray-bounds]
   34 |             if (arr[noder]==lazy[node]&&pr[noder]<=nodel) {
      |                 ~~~~~~~~~^
Main.cpp:9:9: note: while referencing 'SegmentTree::arr'
    9 |     int arr[200001];
      |         ^~~
Main.cpp:34:49: warning: array subscript 262143 is above array bounds of 'int [200001]' [-Warray-bounds]
   34 |             if (arr[noder]==lazy[node]&&pr[noder]<=nodel) {
      |                                         ~~~~~~~~^
Main.cpp:10:9: note: while referencing 'SegmentTree::pr'
   10 |     int pr[200001];
      |         ^~
Main.cpp:34:26: warning: array subscript 262143 is above array bounds of 'int [200001]' [-Warray-bounds]
   34 |             if (arr[noder]==lazy[node]&&pr[noder]<=nodel) {
      |                 ~~~~~~~~~^
Main.cpp:9:9: note: while referencing 'SegmentTree::arr'
    9 |     int arr[200001];
      |         ^~~
Main.cpp:34:49: warning: array subscript 262143 is above array bounds of 'int [200001]' [-Warray-bounds]
   34 |             if (arr[noder]==lazy[node]&&pr[noder]<=nodel) {
      |                                         ~~~~~~~~^
Main.cpp:10:9: note: while referencing 'SegmentTree::pr'
   10 |     int pr[200001];
      |         ^~
Main.cpp:34:26: warning: array subscript 262143 is above array bounds of 'int [200001]' [-Warray-bounds]
   34 |             if (arr[noder]==lazy[node]&&pr[noder]<=nodel) {
      |                 ~~~~~~~~~^
Main.cpp:9:9: note: while referencing 'SegmentTree::arr'
    9 |     int arr[200001];
      |         ^~~
Main.cpp:34:49: warning: array subscript 262143 is above array bounds of 'int [200001]' [-Warray-bounds]
   34 |             if (arr[noder]==lazy[node]&&pr[noder]<=nodel) {
      |                                         ~~~~~~~~^
Main.cpp:10:9: note: while referencing 'SegmentTree::pr'
   10 |     int pr[200001];
      |         ^~
Main.cpp:34:26: warning: array subscript 229375 is above array bounds of 'int [200001]' [-Warray-bounds]
   34 |             if (arr[noder]==lazy[node]&&pr[noder]<=nodel) {
      |                 ~~~~~~~~~^
Main.cpp:9:9: note: while referencing 'SegmentTree::arr'
    9 |     int arr[200001];
      |         ^~~
Main.cpp:34:49: warning: array subscript 229375 is above array bounds of 'int [200001]' [-Warray-bounds]
   34 |             if (arr[noder]==lazy[node]&&pr[noder]<=nodel) {
      |                                         ~~~~~~~~^
Main.cpp:10:9: note: while referencing 'SegmentTree::pr'
   10 |     int pr[200001];
      |         ^~
Main.cpp:34:26: warning: array subscript 262143 is above array bounds of 'int [200001]' [-Warray-bounds]
   34 |             if (arr[noder]==lazy[node]&&pr[noder]<=nodel) {
      |                 ~~~~~~~~~^
Main.cpp:9:9: note: while referencing 'SegmentTree::arr'
    9 |     int arr[200001];
      |         ^~~
Main.cpp:34:49: warning: array subscript 262143 is above array bounds of 'int [200001]' [-Warray-bounds]
   34 |             if (arr[noder]==lazy[node]&&pr[noder]<=nodel) {
      |                                         ~~~~~~~~^
Main.cpp:10:9: note: while referencing 'SegmentTree::pr'
   10 |     int pr[200001];
      |         ^~
Main.cpp: In function 'int main()':
Main.cpp:34:26: warning: array subscript 262143 is above array bounds of 'int [200001]' [-Warray-bounds]
   34 |             if (arr[noder]==lazy[node]&&pr[noder]<=nodel) {
      |                 ~~~~~~~~~^
Main.cpp:9:9: note: while referencing 'SegmentTree::arr'
    9 |     int arr[200001];
      |         ^~~
Main.cpp:34:49: warning: array subscript 262143 is above array bounds of 'int [200001]' [-Warray-bounds]
   34 |             if (arr[noder]==lazy[node]&&pr[noder]<=nodel) {
      |                                         ~~~~~~~~^
Main.cpp:10:9: note: while referencing 'SegmentTree::pr'
   10 |     int pr[200001];
      |         ^~
Main.cpp:34:26: warning: array subscript 262143 is above array bounds of 'int [200001]' [-Warray-bounds]
   34 |             if (arr[noder]==lazy[node]&&pr[noder]<=nodel) {
      |                 ~~~~~~~~~^
Main.cpp:9:9: note: while referencing 'SegmentTree::arr'
    9 |     int arr[200001];
      |         ^~~
Main.cpp:34:49: warning: array subscript 262143 is above array bounds of 'int [200001]' [-Warray-bounds]
   34 |             if (arr[noder]==lazy[node]&&pr[noder]<=nodel) {
      |                                         ~~~~~~~~^
Main.cpp:10:9: note: while referencing 'SegmentTree::pr'
   10 |     int pr[200001];
      |         ^~
Main.cpp:34:26: warning: array subscript 262143 is above array bounds of 'int [200001]' [-Warray-bounds]
   34 |             if (arr[noder]==lazy[node]&&pr[noder]<=nodel) {
      |                 ~~~~~~~~~^
Main.cpp:9:9: note: while referencing 'SegmentTree::arr'
    9 |     int arr[200001];
      |         ^~~
Main.cpp:34:49: warning: array subscript 262143 is above array bounds of 'int [200001]' [-Warray-bounds]
   34 |             if (arr[noder]==lazy[node]&&pr[noder]<=nodel) {
      |                                         ~~~~~~~~^
Main.cpp:10:9: note: while referencing 'SegmentTree::pr'
   10 |     int pr[200001];
      |         ^~
Main.cpp:34:26: warning: array subscript 262143 is above array bounds of 'int [200001]' [-Warray-bounds]
   34 |             if (arr[noder]==lazy[node]&&pr[noder]<=nodel) {
      |                 ~~~~~~~~~^
Main.cpp:9:9: note: while referencing 'SegmentTree::arr'
    9 |     int arr[200001];
      |         ^~~
Main.cpp:34:49: warning: array subscript 262143 is above array bounds of 'int [200001]' [-Warray-bounds]
   34 |             if (arr[noder]==lazy[node]&&pr[noder]<=nodel) {
      |                                         ~~~~~~~~^
Main.cpp:10:9: note: while referencing 'SegmentTree::pr'
   10 |     int pr[200001];
      |         ^~
Main.cpp:34:26: warning: array subscript 262143 is above array bounds of 'int [200001]' [-Warray-bounds]
   34 |             if (arr[noder]==lazy[node]&&pr[noder]<=nodel) {
      |                 ~~~~~~~~~^
Main.cpp:9:9: note: while referencing 'SegmentTree::arr'
    9 |     int arr[200001];
      |         ^~~
Main.cpp:34:49: warning: array subscript 262143 is above array bounds of 'int [200001]' [-Warray-bounds]
   34 |             if (arr[noder]==lazy[node]&&pr[noder]<=nodel) {
      |                                         ~~~~~~~~^
Main.cpp:10:9: note: while referencing 'SegmentTree::pr'
   10 |     int pr[200001];
      |         ^~
Main.cpp:34:26: warning: array subscript 262143 is above array bounds of 'int [200001]' [-Warray-bounds]
   34 |             if (arr[noder]==lazy[node]&&pr[noder]<=nodel) {
      |                 ~~~~~~~~~^
Main.cpp:9:9: note: while referencing 'SegmentTree::arr'
    9 |     int arr[200001];
      |         ^~~
Main.cpp:34:49: warning: array subscript 262143 is above array bounds of 'int [200001]' [-Warray-bounds]
   34 |             if (arr[noder]==lazy[node]&&pr[noder]<=nodel) {
      |                                         ~~~~~~~~^
Main.cpp:10:9: note: while referencing 'SegmentTree::pr'
   10 |     int pr[200001];
      |         ^~
# Verdict Execution time Memory Grader output
1 Correct 901 ms 21928 KB Output is correct
2 Correct 1062 ms 21796 KB Output is correct
3 Correct 1062 ms 22008 KB Output is correct
4 Correct 920 ms 21756 KB Output is correct
5 Correct 913 ms 21780 KB Output is correct
6 Correct 911 ms 21900 KB Output is correct
7 Correct 925 ms 21764 KB Output is correct
8 Correct 950 ms 21800 KB Output is correct
9 Correct 951 ms 21908 KB Output is correct
10 Correct 942 ms 21804 KB Output is correct
11 Correct 951 ms 21820 KB Output is correct
12 Correct 973 ms 21864 KB Output is correct
13 Correct 933 ms 21876 KB Output is correct
14 Correct 932 ms 21780 KB Output is correct
15 Correct 959 ms 21760 KB Output is correct
16 Correct 928 ms 21868 KB Output is correct
17 Correct 1016 ms 21840 KB Output is correct
18 Correct 1014 ms 21904 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 901 ms 21928 KB Output is correct
2 Correct 1062 ms 21796 KB Output is correct
3 Correct 1062 ms 22008 KB Output is correct
4 Correct 920 ms 21756 KB Output is correct
5 Correct 913 ms 21780 KB Output is correct
6 Correct 911 ms 21900 KB Output is correct
7 Correct 925 ms 21764 KB Output is correct
8 Correct 950 ms 21800 KB Output is correct
9 Correct 951 ms 21908 KB Output is correct
10 Correct 942 ms 21804 KB Output is correct
11 Correct 951 ms 21820 KB Output is correct
12 Correct 973 ms 21864 KB Output is correct
13 Correct 933 ms 21876 KB Output is correct
14 Correct 932 ms 21780 KB Output is correct
15 Correct 959 ms 21760 KB Output is correct
16 Correct 928 ms 21868 KB Output is correct
17 Correct 1016 ms 21840 KB Output is correct
18 Correct 1014 ms 21904 KB Output is correct
19 Correct 5021 ms 39856 KB Output is correct
20 Correct 3786 ms 39868 KB Output is correct
21 Correct 2768 ms 39028 KB Output is correct
22 Correct 2795 ms 37064 KB Output is correct
23 Correct 1177 ms 22764 KB Output is correct
24 Correct 1222 ms 22780 KB Output is correct
25 Correct 2910 ms 39836 KB Output is correct
26 Correct 3213 ms 40164 KB Output is correct
27 Correct 3658 ms 39852 KB Output is correct
28 Correct 3710 ms 39812 KB Output is correct
29 Correct 3430 ms 39384 KB Output is correct
30 Correct 1412 ms 22832 KB Output is correct
31 Correct 3541 ms 39984 KB Output is correct
32 Correct 3171 ms 38364 KB Output is correct
33 Correct 1254 ms 22776 KB Output is correct
34 Correct 3414 ms 39840 KB Output is correct
35 Correct 2481 ms 35456 KB Output is correct
36 Correct 1207 ms 22932 KB Output is correct
37 Correct 1279 ms 22792 KB Output is correct
38 Correct 3308 ms 39796 KB Output is correct
39 Correct 1808 ms 39812 KB Output is correct
40 Correct 2444 ms 33908 KB Output is correct
41 Correct 4784 ms 40156 KB Output is correct
42 Correct 2029 ms 40064 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 901 ms 21928 KB Output is correct
2 Correct 1062 ms 21796 KB Output is correct
3 Correct 1062 ms 22008 KB Output is correct
4 Correct 920 ms 21756 KB Output is correct
5 Correct 913 ms 21780 KB Output is correct
6 Correct 911 ms 21900 KB Output is correct
7 Correct 925 ms 21764 KB Output is correct
8 Correct 950 ms 21800 KB Output is correct
9 Correct 951 ms 21908 KB Output is correct
10 Correct 942 ms 21804 KB Output is correct
11 Correct 951 ms 21820 KB Output is correct
12 Correct 973 ms 21864 KB Output is correct
13 Correct 933 ms 21876 KB Output is correct
14 Correct 932 ms 21780 KB Output is correct
15 Correct 959 ms 21760 KB Output is correct
16 Correct 928 ms 21868 KB Output is correct
17 Correct 1016 ms 21840 KB Output is correct
18 Correct 1014 ms 21904 KB Output is correct
19 Correct 1040 ms 21724 KB Output is correct
20 Correct 1115 ms 21816 KB Output is correct
21 Correct 1004 ms 21740 KB Output is correct
22 Correct 905 ms 21748 KB Output is correct
23 Correct 965 ms 21892 KB Output is correct
24 Correct 923 ms 21688 KB Output is correct
25 Correct 1027 ms 21784 KB Output is correct
26 Correct 885 ms 21812 KB Output is correct
27 Correct 974 ms 21856 KB Output is correct
28 Correct 905 ms 21664 KB Output is correct
29 Correct 996 ms 21828 KB Output is correct
30 Correct 901 ms 21764 KB Output is correct
31 Correct 1000 ms 21920 KB Output is correct
32 Correct 990 ms 21932 KB Output is correct
33 Correct 987 ms 21840 KB Output is correct
34 Correct 956 ms 21812 KB Output is correct
35 Correct 1075 ms 21728 KB Output is correct
36 Correct 983 ms 21916 KB Output is correct
37 Correct 959 ms 21760 KB Output is correct
38 Correct 1044 ms 21800 KB Output is correct
39 Correct 1064 ms 21808 KB Output is correct
40 Correct 1004 ms 21780 KB Output is correct
41 Correct 1095 ms 21984 KB Output is correct
42 Correct 1108 ms 21756 KB Output is correct
43 Correct 1053 ms 21880 KB Output is correct
44 Correct 1100 ms 21804 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 901 ms 21928 KB Output is correct
2 Correct 1062 ms 21796 KB Output is correct
3 Correct 1062 ms 22008 KB Output is correct
4 Correct 920 ms 21756 KB Output is correct
5 Correct 913 ms 21780 KB Output is correct
6 Correct 911 ms 21900 KB Output is correct
7 Correct 925 ms 21764 KB Output is correct
8 Correct 950 ms 21800 KB Output is correct
9 Correct 951 ms 21908 KB Output is correct
10 Correct 942 ms 21804 KB Output is correct
11 Correct 951 ms 21820 KB Output is correct
12 Correct 973 ms 21864 KB Output is correct
13 Correct 933 ms 21876 KB Output is correct
14 Correct 932 ms 21780 KB Output is correct
15 Correct 959 ms 21760 KB Output is correct
16 Correct 928 ms 21868 KB Output is correct
17 Correct 1016 ms 21840 KB Output is correct
18 Correct 1014 ms 21904 KB Output is correct
19 Correct 5021 ms 39856 KB Output is correct
20 Correct 3786 ms 39868 KB Output is correct
21 Correct 2768 ms 39028 KB Output is correct
22 Correct 2795 ms 37064 KB Output is correct
23 Correct 1177 ms 22764 KB Output is correct
24 Correct 1222 ms 22780 KB Output is correct
25 Correct 2910 ms 39836 KB Output is correct
26 Correct 3213 ms 40164 KB Output is correct
27 Correct 3658 ms 39852 KB Output is correct
28 Correct 3710 ms 39812 KB Output is correct
29 Correct 3430 ms 39384 KB Output is correct
30 Correct 1412 ms 22832 KB Output is correct
31 Correct 3541 ms 39984 KB Output is correct
32 Correct 3171 ms 38364 KB Output is correct
33 Correct 1254 ms 22776 KB Output is correct
34 Correct 3414 ms 39840 KB Output is correct
35 Correct 2481 ms 35456 KB Output is correct
36 Correct 1207 ms 22932 KB Output is correct
37 Correct 1279 ms 22792 KB Output is correct
38 Correct 3308 ms 39796 KB Output is correct
39 Correct 1808 ms 39812 KB Output is correct
40 Correct 2444 ms 33908 KB Output is correct
41 Correct 4784 ms 40156 KB Output is correct
42 Correct 2029 ms 40064 KB Output is correct
43 Correct 1040 ms 21724 KB Output is correct
44 Correct 1115 ms 21816 KB Output is correct
45 Correct 1004 ms 21740 KB Output is correct
46 Correct 905 ms 21748 KB Output is correct
47 Correct 965 ms 21892 KB Output is correct
48 Correct 923 ms 21688 KB Output is correct
49 Correct 1027 ms 21784 KB Output is correct
50 Correct 885 ms 21812 KB Output is correct
51 Correct 974 ms 21856 KB Output is correct
52 Correct 905 ms 21664 KB Output is correct
53 Correct 996 ms 21828 KB Output is correct
54 Correct 901 ms 21764 KB Output is correct
55 Correct 1000 ms 21920 KB Output is correct
56 Correct 990 ms 21932 KB Output is correct
57 Correct 987 ms 21840 KB Output is correct
58 Correct 956 ms 21812 KB Output is correct
59 Correct 1075 ms 21728 KB Output is correct
60 Correct 983 ms 21916 KB Output is correct
61 Correct 959 ms 21760 KB Output is correct
62 Correct 1044 ms 21800 KB Output is correct
63 Correct 1064 ms 21808 KB Output is correct
64 Correct 1004 ms 21780 KB Output is correct
65 Correct 1095 ms 21984 KB Output is correct
66 Correct 1108 ms 21756 KB Output is correct
67 Correct 1053 ms 21880 KB Output is correct
68 Correct 1100 ms 21804 KB Output is correct
69 Correct 4896 ms 37032 KB Output is correct
70 Correct 4209 ms 39908 KB Output is correct
71 Correct 1419 ms 22684 KB Output is correct
72 Correct 1365 ms 22728 KB Output is correct
73 Correct 1497 ms 22780 KB Output is correct
74 Correct 2669 ms 36956 KB Output is correct
75 Correct 1294 ms 22732 KB Output is correct
76 Correct 3093 ms 39808 KB Output is correct
77 Correct 3129 ms 36964 KB Output is correct
78 Correct 1291 ms 22648 KB Output is correct
79 Correct 1457 ms 22640 KB Output is correct
80 Correct 2588 ms 34660 KB Output is correct
81 Correct 1378 ms 22644 KB Output is correct
82 Correct 3110 ms 39892 KB Output is correct
83 Correct 3216 ms 38812 KB Output is correct
84 Correct 1319 ms 22732 KB Output is correct
85 Correct 1460 ms 22744 KB Output is correct
86 Correct 3484 ms 35656 KB Output is correct
87 Correct 3748 ms 39888 KB Output is correct
88 Correct 1413 ms 22720 KB Output is correct
89 Correct 3076 ms 37732 KB Output is correct
90 Correct 3511 ms 39892 KB Output is correct
91 Correct 1371 ms 22748 KB Output is correct
92 Correct 2578 ms 35360 KB Output is correct
93 Correct 1277 ms 22628 KB Output is correct
94 Correct 1285 ms 22856 KB Output is correct
95 Correct 1271 ms 22720 KB Output is correct
96 Correct 3315 ms 39912 KB Output is correct
97 Correct 1833 ms 39864 KB Output is correct
98 Correct 2483 ms 33648 KB Output is correct
99 Correct 5205 ms 40096 KB Output is correct
100 Correct 2156 ms 40068 KB Output is correct