QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#536270#2279. Wellsbachbeo20070 1902ms142692kbC++233.6kb2024-08-28 21:47:352024-08-28 21:47:35

Judging History

你现在查看的是最新测评结果

  • [2024-08-28 21:47:35]
  • 评测
  • 测评结果:0
  • 用时:1902ms
  • 内存:142692kb
  • [2024-08-28 21:47:35]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int maxn = 1500005;
const int mod = 1e9+7;
int power(int a,int n){
    int res=1;
    while(n){
        if(n&1) res=1LL*res*a%mod;
        a=1LL*a*a%mod;n>>=1;
    }
    return res;
}

int n,k,par[maxn];
vector<int> edge[maxn];

int dist[maxn],ind[maxn],h[maxn];
bool dia[maxn],used[maxn],del[maxn];
vector<int> col;
int cnt,sz,num[maxn];

void dfs_dist(int u,int p){
    par[u]=p,dist[u]=dist[p]+1;
    for(int v:edge[u]) if(v!=p) dfs_dist(v,u);
}

int dfs(int u,int p){
    dist[u]=dist[p]+1;
    for(int v:edge[u]) if(v!=p && !dia[v]) ind[v]=ind[u],h[u]=max(h[u],1+dfs(v,u));
    return h[u];
}
void update(int l,int r,int val){
    num[l]=1LL*num[l]*val%mod;
    num[r]=1LL*num[r]*power(val,mod-2)%mod;
}

int get_ways(int u,int p,int d){
    if(!d || used[u]) return 1;

    int res=1;
    for(int v:edge[u]) if(v!=p && !dia[v]) res=1LL*res*get_ways(v,u,d-1)%mod;
    return (res+1)%mod;
}

void dfs_ways(int u,int p){
    if(!dia[u]){
        int dl=dist[u]+ind[u],dr=dist[u]+sz-1-ind[u];
        int ml=dl+h[u],mr=dr+h[u];
        if(ml+1<k && mr+1>=k){
            if(dr<k){
                int val=get_ways(u,p,k-dr-1);
                update(sz%k,ind[u],val);
            }
            return;
        }
        else if(ml+1>=k && mr+1<k){
            if(dl<k){
                int val=get_ways(u,p,k-dl-1);
                update(ind[u]+1,k,val);
            }
            return;
        }
        else if(ml+1>=k && mr+1>=k){
            int d0=-2*n,d1=-2*n;
            for(int v:edge[u]) if(v!=p && !dia[v]){
                if(h[v]+1>d0) d1=d0,d0=h[v]+1;
                else d0=max(d0,h[v]+1);
            }
            if(d0+d1+1>=k){
                int cur=dl%k;
                for(int x:col){
                    if(cur==x) continue;
                    int dd=(k+x-cur)%k;
                    if(dd<=d1 && 2*dd+1<=k) del[x]=true;
                    if(min(d0,dd-1)+min(d1,dd-1)+1>=k) del[x]=true;
                }
            }
        }
    }
    for(int v:edge[u]) if(v!=p && !dia[v]) dfs_ways(v,u);
}

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cin >> n >> k;
    for(int i=1;i<n;i++){
        int u,v;cin >> u >> v;
        edge[u].push_back(v);
        edge[v].push_back(u);
    }

    dist[0]=-1;
    vector<int> D;
    {
        dfs_dist(1,0);
        int X=max_element(dist+1,dist+n+1)-dist;
        dfs_dist(X,0);
        int Y=max_element(dist+1,dist+n+1)-dist;
        D.push_back(Y);
        while(Y!=X) D.push_back(Y=par[Y]);
    }
    sz=(int)D.size();
    for(int u:D) dia[u]=true;
    for(int i=0;i<sz;i++) ind[D[i]]=i,dfs(D[i],0);
    if(sz<k){
        int res=1;
        for(int i=0;i<n;i++) res=res*2%mod;
        cout << "YES\n" << res << '\n';
        return 0;
    }
    for(int i=0;i<k;i++) num[i]=1;
    for(int u=1;u<=n;u++){
        if(dia[u]) continue;
        int dl=dist[u]+ind[u],dr=dist[u]+sz-1-ind[u];
        int ml=dl+h[u],mr=dr+h[u];
        if(ml+1<k && mr+1<k) used[u]=true,cnt++;
        else if(ml+1>=k && mr+1>=k){
            int cl=dl%k,cr=((ind[u]-dist[u])%k+k)%k;
            if(cl!=cr) del[cl]=del[cr]=true;
        }
    }
    for(int i=0;i<k;i++) if(!del[i]) col.push_back(i);
    for(int u:D) dfs_ways(u,0);

    bool check=false;
    for(int i=0;i<k;i++) if(!del[i]) check=true;

    int total=0;
    for(int i=0;i<k;i++){
        if(i) num[i]=1LL*num[i]*num[i-1]%mod;
        if(!del[i]) total=(total+num[i])%mod;
    }
    while(cnt--) total=total*2%mod;
    cout << (check?"YES\n":"NO\n") << total << '\n';
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 30
Accepted
time: 0ms
memory: 14068kb

input:

4 2
2 1
3 2
2 4

output:

YES
2

result:

ok correct!

Test #2:

score: 30
Accepted
time: 3ms
memory: 13780kb

input:

200 50
76 199
198 145
69 25
164 140
114 13
38 40
188 60
44 157
43 23
5 6
73 113
94 76
62 134
27 159
161 155
86 8
139 133
142 175
127 137
197 88
137 56
45 79
163 73
7 24
83 87
150 194
4 27
180 47
123 69
90 159
8 107
81 190
119 40
52 148
60 59
168 73
116 148
2 9
172 66
41 75
89 152
149 95
107 191
77 1...

output:

YES
5

result:

ok correct!

Test #3:

score: 30
Accepted
time: 0ms
memory: 15860kb

input:

200 100
22 9
128 193
49 1
166 39
179 50
70 92
121 75
132 2
13 190
104 190
104 157
11 175
139 141
107 87
123 50
3 24
96 180
38 122
158 76
12 88
162 167
160 91
199 113
28 67
21 121
106 103
33 176
137 69
169 112
96 189
64 146
7 93
171 142
183 98
10 135
115 36
53 106
97 18
127 94
141 38
11 156
4 145
45 ...

output:

YES
26214400

result:

ok correct!

Test #4:

score: 30
Accepted
time: 0ms
memory: 14076kb

input:

200 30
28 66
98 40
135 162
113 8
83 184
25 15
122 152
193 91
193 18
89 175
96 6
157 37
89 181
55 78
7 99
164 27
57 116
50 55
93 53
119 159
190 141
25 41
189 101
152 143
15 194
138 175
21 126
43 169
85 161
34 22
78 100
126 99
121 112
137 141
62 177
69 180
130 132
56 117
176 162
192 48
14 153
185 111
...

output:

YES
7

result:

ok correct!

Test #5:

score: 30
Accepted
time: 4ms
memory: 14048kb

input:

200 50
158 47
120 40
142 168
101 28
177 83
25 193
124 63
85 129
97 184
13 164
86 122
162 67
86 125
108 185
3 140
101 53
174 196
46 130
194 158
49 57
60 125
75 81
179 182
102 15
56 122
46 82
81 21
105 79
168 115
54 36
186 144
106 134
50 153
188 92
181 54
87 92
100 56
7 198
122 144
84 136
94 3
181 6
3...

output:

YES
44

result:

ok correct!

Test #6:

score: 30
Accepted
time: 0ms
memory: 14096kb

input:

200 50
29 183
197 194
140 171
134 46
180 128
86 84
56 35
173 34
23 46
62 50
54 131
160 103
150 18
118 159
58 50
91 111
180 134
81 59
127 32
123 198
92 26
136 44
182 96
66 15
10 63
146 44
147 41
199 59
69 166
63 81
31 139
14 133
12 8
18 36
62 191
122 30
91 42
110 3
157 96
193 171
141 49
178 39
47 184...

output:

YES
44

result:

ok correct!

Test #7:

score: 30
Accepted
time: 0ms
memory: 14020kb

input:

200 10
79 124
9 25
70 50
124 125
122 5
10 183
52 171
15 82
197 66
106 139
130 4
28 2
90 89
63 89
157 44
3 98
24 192
107 14
110 76
112 30
5 87
90 122
8 41
156 163
72 93
149 74
27 12
14 60
102 16
115 182
11 129
81 49
57 62
193 140
150 120
91 135
126 60
18 100
157 97
9 121
48 138
167 76
85 17
56 147
71...

output:

NO
0

result:

ok correct!

Test #8:

score: 30
Accepted
time: 0ms
memory: 13744kb

input:

200 10
45 145
145 168
57 168
65 178
47 74
188 47
76 195
73 38
51 50
155 181
176 31
3 164
44 130
58 104
108 113
175 98
95 47
159 19
40 55
116 69
66 180
194 143
81 113
137 192
197 18
177 104
125 121
2 68
86 70
148 161
109 1
29 11
164 40
100 106
100 186
173 22
102 156
26 194
46 174
113 82
34 75
107 122...

output:

YES
1

result:

ok correct!

Test #9:

score: 30
Accepted
time: 3ms
memory: 13856kb

input:

200 11
81 2
42 76
146 126
123 111
115 117
191 155
8 196
97 177
112 107
99 69
131 151
137 15
47 21
97 84
69 98
92 1
1 48
53 127
199 25
149 124
90 200
16 33
112 73
181 62
28 171
155 45
126 168
160 104
62 60
178 52
175 104
165 76
199 102
45 146
166 14
46 172
12 131
101 83
41 126
96 91
152 63
95 126
99 ...

output:

YES
1

result:

ok correct!

Test #10:

score: 0
Wrong Answer
time: 3ms
memory: 13880kb

input:

200 23
197 139
167 26
161 58
63 154
62 184
177 112
168 106
36 50
132 45
15 8
189 103
19 162
135 41
62 163
3 31
7 186
133 128
166 173
143 196
113 63
54 12
54 200
107 35
9 63
185 105
142 126
180 89
108 14
111 69
72 169
101 60
33 191
176 39
144 32
56 24
22 172
145 48
87 109
187 170
175 32
82 162
25 55
...

output:

YES
1

result:

wrong answer your token is YES but expected NO

Subtask #2:

score: 0
Wrong Answer

Test #59:

score: 20
Accepted
time: 0ms
memory: 13864kb

input:

8 3
1 2
3 8
4 2
1 5
8 2
6 4
8 7

output:

NO
0

result:

ok correct!

Test #60:

score: 20
Accepted
time: 0ms
memory: 14064kb

input:

3000 400
1841 2850
182 1079
1319 1880
1698 1673
1484 1010
2825 2575
709 1780
1669 2725
2761 371
462 661
1160 1466
1982 545
359 2110
666 2401
673 1831
2334 890
2444 124
1086 2995
1610 715
2021 1591
1316 1358
821 1156
2000 1779
1981 2880
1694 323
1415 2369
2579 2856
2277 400
39 411
2701 2230
254 1591
...

output:

YES
20

result:

ok correct!

Test #61:

score: 20
Accepted
time: 3ms
memory: 13960kb

input:

2000 220
1171 659
1317 859
651 409
1446 909
970 363
1660 769
1410 834
1924 1704
501 1731
793 1642
205 1041
1026 1963
1858 1213
1531 242
56 1697
1039 1888
1955 433
636 1986
1072 91
1470 1081
966 500
1851 496
1296 169
895 806
1044 851
1097 836
1000 1036
566 1537
115 1484
909 1402
550 1295
1383 446
169...

output:

YES
32

result:

ok correct!

Test #62:

score: 20
Accepted
time: 0ms
memory: 14136kb

input:

4000 303
1673 3934
2433 12
1722 826
1058 3814
1505 178
3241 1125
3576 3524
2682 2859
2865 927
3763 1140
3367 2926
1853 2589
1536 717
80 3748
3266 156
2013 1856
1008 2026
2272 2270
1348 213
716 806
2669 2126
2305 3054
1201 2356
1114 3705
2497 2209
3411 3451
1565 2106
2629 1753
1718 644
2682 2605
1215...

output:

YES
1

result:

ok correct!

Test #63:

score: 20
Accepted
time: 6ms
memory: 14512kb

input:

10000 500
9202 1018
3305 9739
7239 9215
7907 361
1745 4485
2824 920
1240 8045
5226 8384
2712 7603
8636 4451
430 6733
7913 8450
9080 2082
8368 4470
9625 2821
7993 4119
896 3171
2403 5204
7851 7699
8562 7945
3704 1900
3086 197
1752 6544
3160 8100
2945 3818
2797 8086
3302 6479
7905 3178
7101 6226
3510 ...

output:

YES
1

result:

ok correct!

Test #64:

score: 20
Accepted
time: 3ms
memory: 14820kb

input:

10000 3000
4839 6455
8054 5903
5069 2818
6745 6127
127 2522
427 581
8006 7912
7409 1419
8066 5430
3949 3470
7255 8544
1209 9663
8347 1850
8462 6327
9776 525
731 986
4616 1442
962 4076
3055 4747
6985 9857
4041 1997
8755 3506
7163 8942
7696 8720
766 4361
780 3050
1625 2795
4220 6313
8315 2562
7097 159...

output:

YES
1

result:

ok correct!

Test #65:

score: 20
Accepted
time: 6ms
memory: 14672kb

input:

9644 100
8311 5396
8251 638
9620 2317
3898 2473
2564 7121
5090 5483
1667 7657
7477 7235
4545 8997
8660 5277
9218 3950
5467 7836
7184 6976
5026 5711
2124 7619
5593 7600
7722 2247
1798 4509
8227 5068
4032 4503
7545 4632
6436 5831
8742 2942
5197 3563
2162 5290
177 5357
8254 5388
1857 3960
8854 8724
207...

output:

NO
0

result:

ok correct!

Test #66:

score: 0
Wrong Answer
time: 5ms
memory: 14464kb

input:

10000 30
1105 2431
7447 1714
4344 9245
2615 3703
2266 2094
5022 3889
2700 134
4827 5103
1929 896
3245 607
5074 7980
3874 8139
1937 1569
4462 2210
3698 7946
5998 946
822 9927
7533 3910
5411 8888
3308 3695
9282 427
8933 3821
8275 903
857 9542
8255 8107
3415 7084
3610 9022
3105 1615
3459 3439
6272 4816...

output:

YES
1

result:

wrong answer your token is YES but expected NO

Subtask #3:

score: 0
Wrong Answer

Test #128:

score: 20
Accepted
time: 3ms
memory: 15848kb

input:

6 5
5 3
2 3
3 1
4 1
5 6

output:

YES
10

result:

ok correct!

Test #129:

score: 20
Accepted
time: 93ms
memory: 28604kb

input:

200000 5000
105929 120709
173353 48352
113760 54678
141672 33525
24812 87080
11451 127503
87522 53189
37392 181567
64013 5244
40367 63219
59887 87230
126637 28454
111049 29872
93355 41783
42342 191951
151726 113203
96476 158182
112053 37511
120584 180666
83109 136218
41215 128515
196117 62084
48013 ...

output:

YES
1

result:

ok correct!

Test #130:

score: 20
Accepted
time: 110ms
memory: 32088kb

input:

200000 30397
131017 98528
136333 113045
46154 160548
36869 87341
166714 169131
125185 125506
28811 60723
90812 138502
52811 90048
63420 180062
6557 78100
173893 177072
16830 194893
111058 189542
197982 175063
44163 116245
100107 166589
84552 18157
11462 80692
108557 199633
46144 29270
8055 197667
13...

output:

YES
1

result:

ok correct!

Test #131:

score: 20
Accepted
time: 88ms
memory: 35348kb

input:

200000 50001
107470 179001
17938 28983
60296 123335
4180 8366
185414 124112
168030 37068
129886 175467
43718 140142
119818 55370
150209 108372
123585 56133
59503 39573
191685 97243
38592 10989
175968 39160
1302 8335
138529 99254
105898 18025
165706 51561
180518 197567
20094 135434
124741 83466
13373...

output:

YES
1

result:

ok correct!

Test #132:

score: 20
Accepted
time: 83ms
memory: 27252kb

input:

200000 190
38440 107059
55278 185165
182727 48603
186399 197667
24040 41013
48397 74434
163580 21950
104530 18696
122751 81005
55894 184671
55539 184022
124474 154289
44500 14924
43463 150099
158521 107278
131092 84108
182054 153674
191104 97760
185529 25569
139437 148190
50507 47419
93752 38100
108...

output:

NO
0

result:

ok correct!

Test #133:

score: 20
Accepted
time: 84ms
memory: 29100kb

input:

200000 30000
58586 32004
67767 127951
96333 96111
153681 96392
39659 27387
82933 41478
93924 157937
32513 43742
69289 32765
195366 109848
195909 44904
81116 197968
43444 42334
165752 179540
77448 184787
190024 49003
163393 188417
185931 65173
97088 15488
191020 63273
64824 2783
40027 32584
13366 188...

output:

YES
1

result:

ok correct!

Test #134:

score: 20
Accepted
time: 73ms
memory: 29500kb

input:

200000 40040
109820 137523
132713 159381
180886 175012
152276 65900
87068 182880
61343 174332
28573 5361
26393 197048
86765 17278
199443 10687
113601 123845
135368 99612
191968 146554
65838 40698
99050 356
90641 149244
70435 189176
44457 85821
81125 48936
186721 35574
23711 82527
58465 189124
7231 2...

output:

YES
756320390

result:

ok correct!

Test #135:

score: 20
Accepted
time: 114ms
memory: 25348kb

input:

200000 301
95029 49877
162752 82755
160975 2166
95513 89172
115295 42548
174 177275
158790 147780
46745 47033
145265 159619
26695 134597
48706 176971
174556 171641
120050 149796
93895 165669
81744 67121
151549 143011
62640 172726
23293 186644
155234 82512
2325 31615
164506 40565
158731 98854
102898 ...

output:

YES
1

result:

ok correct!

Test #136:

score: 20
Accepted
time: 115ms
memory: 34336kb

input:

200000 3001
109861 94497
152336 137445
50486 38891
28827 127537
40860 8541
59653 35097
70398 52802
183336 156759
19971 197739
121957 157128
38354 130664
159547 19742
179831 36363
181425 185975
75960 117885
140759 13163
134470 57948
90235 52852
7013 124134
82185 146986
151493 47510
156971 154492
1477...

output:

YES
1

result:

ok correct!

Test #137:

score: 20
Accepted
time: 75ms
memory: 28744kb

input:

200000 20000
32878 112680
198408 59596
16700 97782
37059 5330
126410 94520
141315 121190
151896 175556
179446 172911
33994 161508
34670 11107
48491 176758
174775 151216
54837 10990
3302 128272
14474 149303
176657 2121
516 142366
132334 53013
20586 48925
113838 99009
76269 129733
159113 91941
87826 1...

output:

YES
6561

result:

ok correct!

Test #138:

score: 20
Accepted
time: 78ms
memory: 34868kb

input:

200000 50000
46746 7298
68101 136417
72977 34204
81639 5765
191606 9017
34204 109521
159625 62078
178528 34204
34204 32115
194517 111440
34204 23589
104925 16514
84178 98780
13261 42545
151652 181999
133345 194517
191583 124787
153513 146676
73260 22165
56880 96776
39549 194517
39446 34204
110362 17...

output:

YES
49969

result:

ok correct!

Test #139:

score: 20
Accepted
time: 267ms
memory: 61856kb

input:

499931 301243
157037 424046
492460 149527
137708 178350
142065 226894
349578 21471
207187 130320
172855 248859
257764 16340
314393 434777
203585 184094
144527 28158
469919 275000
244989 482698
187965 25169
181781 326013
489427 33247
218521 211155
274185 442176
63569 458498
222380 306287
254652 32456...

output:

YES
240508820

result:

ok correct!

Test #140:

score: 20
Accepted
time: 287ms
memory: 63672kb

input:

500000 100000
470937 443065
35524 373865
245544 361449
139722 54186
101240 112124
140857 376135
43640 220260
282922 355236
171565 229545
391186 111445
249735 261559
472819 291274
340111 411915
277906 13576
243993 337970
471127 358691
202812 139104
184978 430519
19153 122671
79871 411969
421006 23904...

output:

YES
88846

result:

ok correct!

Test #141:

score: 20
Accepted
time: 285ms
memory: 54792kb

input:

500000 10000
51384 68416
442032 409874
41541 424707
307177 84865
454914 327074
274936 325020
415781 225135
336506 262888
85892 373511
115561 211900
345764 74526
464789 497120
156835 438266
284673 446850
211064 303868
36268 15137
453523 279184
366056 142991
124694 199267
280324 474902
108780 354881
2...

output:

NO
0

result:

ok correct!

Test #142:

score: 20
Accepted
time: 445ms
memory: 56900kb

input:

500000 50000
404127 65987
201362 416108
100813 384203
178856 270977
408009 406404
378048 223798
98289 165048
150418 375515
189307 84063
353959 293656
25737 50695
25139 118496
450360 198217
424013 223706
178184 228319
469851 269026
391807 369959
116135 465951
263544 82160
278558 296412
282925 467322
...

output:

YES
1

result:

ok correct!

Test #143:

score: 20
Accepted
time: 480ms
memory: 56848kb

input:

500000 30000
324076 257330
80613 234482
27192 169144
355790 166342
399941 362813
224277 266609
122384 350743
393469 412232
293216 21495
443840 285857
217438 481064
188009 112836
436995 473127
90744 451126
396770 240083
231472 366893
260303 362886
445168 236474
216489 127008
106578 369351
45237 15502...

output:

NO
0

result:

ok correct!

Test #144:

score: 20
Accepted
time: 311ms
memory: 53612kb

input:

500000 4004
311809 364188
101609 78858
23110 208875
488043 269376
441160 382560
405368 294879
227786 88060
470928 460229
346632 65018
195317 489
180739 44665
499038 64106
281510 133538
167400 100016
63355 443857
159015 201306
287741 421884
134285 393952
227714 225689
120365 431656
206934 455933
3024...

output:

NO
0

result:

ok correct!

Test #145:

score: 20
Accepted
time: 308ms
memory: 68616kb

input:

498381 150301
339283 209353
276398 226770
101587 22779
173805 163681
238946 305477
266748 187721
402038 54816
161959 232657
241654 181352
166137 394595
70132 80587
438209 108524
125016 418742
69057 248672
74885 320008
122526 246359
290535 491982
291227 414466
188938 393390
232008 109285
22803 65360
...

output:

YES
1067

result:

ok correct!

Test #146:

score: 20
Accepted
time: 205ms
memory: 56968kb

input:

500000 10304
192469 410573
489695 486144
97931 74359
410573 175642
21634 105637
174922 189210
153963 54706
99256 150121
410573 418101
238475 135317
32405 394982
26824 153963
264730 169905
78322 153963
410573 261734
206975 233031
410573 462529
145530 410573
153963 157903
415691 13933
242271 410573
15...

output:

YES
364

result:

ok correct!

Test #147:

score: 20
Accepted
time: 270ms
memory: 64760kb

input:

500000 100000
61743 35205
232308 411029
144914 211913
399888 263063
93044 63802
341321 213136
274108 25521
457110 445033
318693 198434
459077 418722
96149 161169
96149 393851
322407 96149
80079 362856
96149 357546
490461 10312
214615 205386
454140 88544
391108 96149
383238 234411
303828 316073
29454...

output:

YES
99995

result:

ok correct!

Test #148:

score: 20
Accepted
time: 420ms
memory: 49304kb

input:

500000 100
74262 370433
203659 386286
290902 98995
314797 436272
426546 48181
456669 208862
134471 199487
387258 449346
89386 133841
135095 360262
77490 210592
212304 412408
103771 149304
298599 424527
143963 60361
300403 10763
7008 68163
290635 470385
341907 121997
83755 471258
378484 100948
138853...

output:

YES
2

result:

ok correct!

Test #149:

score: 20
Accepted
time: 112ms
memory: 27148kb

input:

200000 10000
53780 74395
50875 173060
86477 116365
126581 150027
134661 45097
158351 115492
105600 90514
15990 94291
8148 34693
95081 73904
46678 147907
126657 104590
136716 14818
661 78682
170870 5780
15803 143881
191925 87392
192788 36697
192010 20478
73170 37031
73786 20391
57495 5903
12946 15673...

output:

YES
360

result:

ok correct!

Test #150:

score: 20
Accepted
time: 117ms
memory: 26792kb

input:

200000 5001
29490 142824
97916 107346
186859 48204
104581 157825
2526 84364
134388 160378
1716 28736
181756 163883
76101 56154
197597 152665
55513 131273
148979 128312
179913 142119
54112 44509
137900 117113
191458 173661
127125 78685
58639 161306
57185 197985
1682 17520
122258 144638
193374 73962
1...

output:

YES
1

result:

ok correct!

Test #151:

score: 20
Accepted
time: 87ms
memory: 35140kb

input:

200000 20001
95160 64885
69569 11624
9385 136594
148723 178968
160856 110491
128336 130518
151697 132697
179754 83896
171251 157454
112755 46297
99283 8955
122377 62316
175923 123849
176878 86156
21959 70641
185346 80833
53043 175345
166975 122355
159093 4677
127756 31773
129768 142641
198321 198377...

output:

YES
1

result:

ok correct!

Test #152:

score: 0
Wrong Answer
time: 94ms
memory: 32488kb

input:

200000 3033
39850 115157
34378 88430
177949 97922
122356 19181
195096 12226
19841 40377
16166 40980
55413 64597
102972 175059
15067 60752
115201 60838
4472 133882
115107 80602
54038 142499
99188 150995
126509 90127
150386 24253
108244 62085
133253 23160
67704 21351
22924 50859
73488 114934
5530 1920...

output:

YES
1

result:

wrong answer your token is YES but expected NO

Subtask #4:

score: 0
Wrong Answer

Test #187:

score: 30
Accepted
time: 1459ms
memory: 133708kb

input:

1500000 100001
724442 92881
221091 494887
870685 626437
800019 156221
540292 848793
958857 904443
998942 236053
367784 381864
864466 1438769
485291 722962
438316 569974
1302008 1060744
425759 1288500
1156731 464288
1098453 616408
208387 468078
1290672 998059
1008416 642693
1133953 870685
1144129 134...

output:

NO
0

result:

ok correct!

Test #188:

score: 30
Accepted
time: 1018ms
memory: 132088kb

input:

1500000 100001
1240262 562697
246375 1092513
376768 1213989
135207 1247693
936879 829839
1499516 114086
814950 998720
1168103 1017510
1085702 1438018
159874 798820
154540 1425186
145764 347072
1326586 994127
1351989 403111
690454 414513
379516 249269
417545 1329723
280548 1010976
173795 1427387
3804...

output:

YES
49967

result:

ok correct!

Test #189:

score: 30
Accepted
time: 1302ms
memory: 142692kb

input:

1500000 300000
979117 209874
1072315 1471611
1375047 1482434
872429 775057
687011 1312877
973993 1279844
1224115 601513
73532 1106585
923551 565906
410562 923961
1357633 290349
1070312 1323299
758095 1380782
337712 497859
745363 991732
1059383 275592
629425 775266
606642 167816
1372324 1333682
10964...

output:

YES
702716631

result:

ok correct!

Test #190:

score: 30
Accepted
time: 1040ms
memory: 131036kb

input:

1500000 100000
243691 661485
928194 145213
70992 766950
416050 801116
1255496 170664
949690 273477
1298519 693895
222134 1343792
173903 309140
1122917 994080
1118907 439588
1027783 1322769
1130141 1432891
747901 816394
269664 611171
847567 1451083
65904 802862
276935 611438
224407 1286401
499480 143...

output:

YES
49950

result:

ok correct!

Test #191:

score: 30
Accepted
time: 1036ms
memory: 131748kb

input:

1500000 100001
1321913 341149
1305306 992267
507679 291659
1051986 51978
28911 468674
1350931 115569
21154 210046
1262901 812080
708184 194769
1494326 1055561
292398 1309868
958511 821090
881647 16797
763737 566442
582692 1478377
495434 1428915
28911 940175
69838 1324869
594430 870959
1201573 16856
...

output:

YES
49962

result:

ok correct!

Test #192:

score: 30
Accepted
time: 998ms
memory: 131744kb

input:

1500000 100000
224157 930121
680696 562537
872394 881320
1012668 1410854
75752 646739
731974 719996
1326143 133183
1300028 1081685
1353429 933932
276030 1265065
1307852 566176
164735 1389216
644503 121655
456495 472607
895810 1128294
701225 1466856
99517 1196524
14022 1485041
830296 1226861
798258 3...

output:

YES
49959

result:

ok correct!

Test #193:

score: 30
Accepted
time: 1204ms
memory: 136192kb

input:

1500000 10000
1298060 605130
581261 812235
214641 689504
866795 1038855
659638 392338
819734 1358718
1083290 183676
953595 290840
909126 1419858
813447 850939
590844 896678
345 836046
165900 711181
598905 802261
823320 101890
364461 590035
576278 786042
584597 1133318
150823 1381946
574524 1242324
1...

output:

YES
1

result:

ok correct!

Test #194:

score: 30
Accepted
time: 1216ms
memory: 136972kb

input:

1500000 10000
759421 823363
1475460 731394
1149553 1099585
327453 708341
618246 572895
205456 395120
1246323 177302
678610 1323677
324680 1463838
959404 76634
425450 812138
172051 872410
1444934 1098072
456753 583007
1293133 1006142
522852 1218050
344413 1485127
1140512 335572
411036 506392
477211 2...

output:

NO
0

result:

ok correct!

Test #195:

score: 30
Accepted
time: 1106ms
memory: 125316kb

input:

1500000 20104
1290552 574634
851432 1242496
984399 420135
695149 207080
1163529 977491
503888 1205428
1203436 911490
1116487 582351
964441 914384
902924 546738
708079 937558
135157 1106508
978272 1467125
369418 1084612
1346137 969393
354714 1377409
1357203 745621
1280339 1033775
263907 1441457
58800...

output:

YES
187

result:

ok correct!

Test #196:

score: 30
Accepted
time: 985ms
memory: 117808kb

input:

1500000 10000
214852 299556
220350 783764
741735 1157489
265599 86602
468753 359238
1399719 1231447
483610 294905
65970 1241336
967430 1496355
708935 644233
274786 582291
1145110 736039
1335654 759067
567584 1243182
1329072 769476
1140470 1110023
880562 247197
723779 736732
1191901 103752
61206 5881...

output:

YES
543919010

result:

ok correct!

Test #197:

score: 30
Accepted
time: 1087ms
memory: 115284kb

input:

1423984 23492
819905 71969
1347553 962899
1010139 1126961
585408 301152
1413946 1095627
721295 1176125
1304672 1108166
1349812 708811
781017 330798
654027 149892
577932 16334
144130 309817
604546 1347831
299766 553210
911713 1315752
576475 927202
986429 37219
1167395 715844
1112668 777674
1145113 11...

output:

YES
13033

result:

ok correct!

Test #198:

score: 30
Accepted
time: 1107ms
memory: 119680kb

input:

1500000 24924
495967 886551
474093 1476130
1482596 1075864
32808 1489665
786875 1015099
1473771 1256481
1347968 1333380
534131 239344
1357875 273517
217495 1442403
1398518 623342
1014315 1492468
800236 296808
452420 1383394
714538 1223078
486134 1289369
1498229 46645
8760 781464
1175646 1346297
3412...

output:

YES
887

result:

ok correct!

Test #199:

score: 30
Accepted
time: 1201ms
memory: 114076kb

input:

1500000 40
489100 410574
127776 908669
2254 162402
708807 404554
793535 318022
227742 225160
654219 598403
56412 118668
1292123 751296
1133859 989438
1255186 836342
691524 81520
1364074 948683
1051988 1480386
496139 373940
1347432 1347611
247669 269288
501739 251056
917193 676015
1148415 815559
1099...

output:

NO
0

result:

ok correct!

Test #200:

score: 30
Accepted
time: 1061ms
memory: 119848kb

input:

1499999 101
1026473 997889
1398444 1411999
510671 151785
1164891 805692
228868 319003
1423570 1282879
1196800 1228910
1309191 838339
1001982 772157
972757 388987
1270598 1417093
299619 531487
853354 124916
872019 490912
91878 1096067
460565 651754
1073097 1116443
714453 1206997
428096 112897
1405446...

output:

YES
45

result:

ok correct!

Test #201:

score: 30
Accepted
time: 1075ms
memory: 115816kb

input:

1500000 2000
556423 864632
646085 736110
672810 579284
479039 1380115
57682 225049
201454 300685
1150939 1395254
437217 753739
430869 945474
173057 333728
471361 928764
693275 924346
1086713 942033
831672 1168510
828867 33426
384022 804437
1262862 367231
1271024 1103730
842860 1296750
311299 404602
...

output:

YES
667

result:

ok correct!

Test #202:

score: 30
Accepted
time: 1835ms
memory: 115796kb

input:

1500000 10001
154756 751852
1403963 623906
751946 147344
291915 584183
452524 1401990
665989 1191112
890233 30076
1002835 724952
574658 664824
1404542 72442
409816 893823
888631 179319
717129 1131668
436810 697066
462697 532777
479723 267885
846371 1094278
943164 493587
327684 848360
841455 528051
1...

output:

NO
0

result:

ok correct!

Test #203:

score: 30
Accepted
time: 1073ms
memory: 133924kb

input:

1500000 411246
257534 1399536
618844 131560
134389 640121
63831 789145
1257075 374871
33621 454741
377908 56563
651225 1374460
1334252 1083444
17352 1029126
1288536 1036078
1391861 1348899
677995 942118
85976 589849
2785 123282
1286174 357320
905610 765601
146663 623801
284045 1378935
370093 63454
1...

output:

YES
179527867

result:

ok correct!

Test #204:

score: 30
Accepted
time: 1829ms
memory: 116240kb

input:

1500000 10000
1377275 378003
1340971 99701
646671 1470034
1417809 1281846
644930 842430
501455 1391423
593707 785700
645940 653703
375816 252679
1071469 265020
1248829 592264
835997 915789
981757 304040
125322 574254
47789 1035826
1314897 311650
1333980 1375710
346212 762188
898592 1443238
365616 39...

output:

NO
0

result:

ok correct!

Test #205:

score: 30
Accepted
time: 1812ms
memory: 116000kb

input:

1500000 10000
401443 1159914
417771 494201
265427 625605
1160468 568203
109664 856137
1445085 208774
618996 204203
1373082 651836
724072 138734
767590 1479614
16194 1216379
1495546 8886
391905 918954
1458989 837194
1204201 59688
1476825 448426
452073 829757
803724 973984
559423 1030774
390782 133932...

output:

YES
2

result:

ok correct!

Test #206:

score: 0
Wrong Answer
time: 1902ms
memory: 115920kb

input:

1500000 10001
745193 1401641
1017833 427299
1006101 80691
705361 932407
985783 793850
90897 114574
863879 205114
580069 345053
259258 1140031
36860 263368
927691 553149
791196 618494
377455 52031
708327 1367231
736744 251573
971506 372495
1377693 76783
1396171 69112
836660 760261
1273049 334921
7312...

output:

YES
1

result:

wrong answer your token is YES but expected NO