QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#410997#8140. Customs Controls 2GraphcityAC ✓94ms26656kbC++141.4kb2024-05-14 19:44:582024-05-14 19:44:58

Judging History

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

  • [2024-05-14 19:44:58]
  • 评测
  • 测评结果:AC
  • 用时:94ms
  • 内存:26656kb
  • [2024-05-14 19:44:58]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rof(i,a,b) for(int i=(a);i>=(b);--i)
using namespace std;
const int Maxn=5e5;

int n,m,s,fa[Maxn+5],X[Maxn+5],Y[Maxn+5],deg[Maxn+5];
int h[Maxn+5];
inline int Find(int x) {return fa[x]==x?x:fa[x]=Find(fa[x]);}
vector<int> v[Maxn+5];

inline void Clear()
{
    For(i,1,s) vector<int>().swap(v[i]),deg[i]=0;
}
inline void Solve()
{
    cin>>n>>m; s=n*2;
    For(i,1,s) fa[i]=i;
    For(i,1,m)
    {
        int a,b; cin>>a>>b; X[i]=a,Y[i]=b;
        int x=Find(a+n),y=Find(b);
        if(x!=y) fa[x]=y;
    }
    For(i,1,n) if(Find(i)==Find(i+n)) {cout<<"No"<<endl; Clear(); return;}
    For(i,1,n)
    {
        int a=Find(i),b=Find(i+n);
        v[b].push_back(a),deg[a]++;
    }
    queue<int> q;
    For(i,1,s) h[i]=0;
    For(i,1,s) if(!deg[i]) q.push(i),h[i]=1;
    while(!q.empty())
    {
        int x=q.front(); q.pop();
        for(auto y:v[x])
        {
            h[y]=max(h[y],h[x]+1);
            if(--deg[y]==0) q.push(y);
        }
    }
    For(i,1,s) if(deg[i]) {cout<<"No"<<endl; Clear(); return;}
    cout<<"Yes"<<endl;
    For(i,1,n)
    {
        int a=Find(i),b=Find(i+n);
        cout<<h[a]-h[b]<<' ';
    } cout<<endl; Clear();
}

int main()
{
    // freopen("1.in","r",stdin);

    ios::sync_with_stdio(false);
    int T; cin>>T;
    while(T--) Solve();
    return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 15224kb

input:

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

output:

No
Yes
1 1 1 1 1 1 1 1 

result:

ok ok (2 test cases)

Test #2:

score: 0
Accepted
time: 0ms
memory: 15280kb

input:

2
11 16
1 2
1 3
1 4
1 5
2 6
4 6
3 7
4 7
5 8
6 8
2 9
3 9
7 10
8 10
9 11
10 11
8 10
1 2
1 3
2 4
3 5
3 6
4 6
2 7
5 7
6 8
7 8

output:

Yes
1 1 1 1 2 1 2 1 3 1 1 
No

result:

ok ok (2 test cases)

Test #3:

score: 0
Accepted
time: 2ms
memory: 15256kb

input:

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

output:

No

result:

ok ok (1 test case)

Test #4:

score: 0
Accepted
time: 2ms
memory: 15252kb

input:

1
11 16
1 2
1 3
1 4
1 5
2 6
4 6
3 7
4 7
5 8
6 8
2 9
3 9
7 10
8 10
9 11
10 11

output:

Yes
1 1 1 1 2 1 2 1 3 1 1 

result:

ok ok (1 test case)

Test #5:

score: 0
Accepted
time: 2ms
memory: 15196kb

input:

1
3 3
1 2
1 3
2 3

output:

No

result:

ok ok (1 test case)

Test #6:

score: 0
Accepted
time: 0ms
memory: 15284kb

input:

1
15 24
1 3
1 7
1 6
1 12
3 11
3 5
3 13
3 14
3 8
7 11
7 13
7 14
11 2
11 10
6 9
5 9
13 9
14 4
8 4
2 4
10 4
9 4
12 15
4 15

output:

Yes
1 1 1 1 1 2 1 2 1 1 1 4 1 2 1 

result:

ok ok (1 test case)

Test #7:

score: 0
Accepted
time: 0ms
memory: 15244kb

input:

10
20 40
1 8
1 11
1 19
8 7
8 16
8 15
8 14
8 4
8 17
11 5
11 6
11 2
11 3
7 6
7 2
7 3
16 9
16 12
15 9
15 12
14 9
4 18
4 10
5 13
5 10
6 18
6 10
2 13
2 18
3 18
3 10
9 13
9 10
12 13
12 10
19 20
17 20
13 20
18 20
10 20
20 30
8 19
19 12
5 12
5 10
10 4
18 4
18 14
14 6
15 6
15 7
7 3
17 3
17 2
2 16
9 16
9 11
1...

output:

Yes
1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 3 1 4 1 
No
Yes
1 1 1 4 4 1 2 1 2 2 3 3 4 2 2 1 1 1 1 1 
Yes
1 3 4 4 3 1 2 5 3 1 1 1 2 1 1 1 2 1 2 1 
Yes
1 3 1 1 1 1 3 1 1 1 3 1 1 2 2 3 1 1 1 1 
Yes
1 1 1 1 3 1 1 1 1 2 1 1 3 4 1 3 2 1 1 1 
Yes
1 2 1 1 2 2 1 1 2 3 2 1 1 3 1 2 5 1 1 1 
No
Yes
1 1 3 1 3 2 2 1 1 1 ...

result:

ok ok (10 test cases)

Test #8:

score: 0
Accepted
time: 9ms
memory: 15396kb

input:

10
1919 3195
1888 1186
1186 519
1514 519
1514 859
859 1634
977 1634
977 185
185 1250
1103 1250
1103 463
463 1683
426 1683
426 1728
1728 1402
1612 1402
1612 1789
1789 857
586 857
586 1669
1669 1376
1833 1376
1833 1076
1076 749
733 749
733 551
551 217
1717 217
1717 862
862 319
96 319
96 479
479 1381
1...

output:

No
Yes
1 26 1 11 13 4 18 15 15 18 30 5 23 3 12 7 1 24 18 19 34 13 14 7 1 1 1 23 5 14 2 7 29 1 6 28 20 18 20 20 1 25 7 23 21 12 24 3 11 12 7 1 40 8 3 31 1 19 12 10 10 15 17 16 5 36 11 1 13 18 13 3 18 4 36 34 35 37 8 27 13 33 5 29 13 9 28 23 33 7 9 13 21 3 7 10 11 8 6 1 6 12 36 7 16 13 8 2 1 34 12 8 2...

result:

ok ok (10 test cases)

Test #9:

score: 0
Accepted
time: 83ms
memory: 26056kb

input:

1
181547 488264
1 172537
1 90998
1 88110
1 96832
1 114889
1 33910
1 88129
1 70671
1 63339
1 48928
1 87572
1 34438
1 159256
1 173984
1 91374
1 89583
1 47960
1 93777
1 44079
1 132241
1 85083
1 99617
1 160839
1 157126
1 178514
1 70706
1 13530
1 168869
1 29354
1 11630
1 123518
1 86921
1 19627
1 126118
1...

output:

Yes
1 124 164 29 69 17 188 48 117 80 12 28 85 97 88 141 105 153 90 54 76 14 29 37 83 52 57 54 52 69 31 20 34 48 153 189 185 111 156 15 174 138 23 46 164 220 62 228 62 68 33 39 154 42 64 100 14 6 66 138 65 104 216 13 60 191 60 176 70 82 118 104 87 155 34 86 55 15 64 76 24 234 81 152 41 93 163 101 101...

result:

ok ok (1 test case)

Test #10:

score: 0
Accepted
time: 58ms
memory: 24816kb

input:

1
180842 301400
100472 98062
98062 152871
139599 152871
139599 97417
97417 138150
99214 138150
99214 110823
110823 179307
54096 179307
54096 169504
169504 60019
92807 60019
92807 176799
176799 10766
51615 10766
51615 85235
85235 110883
72664 110883
72664 81826
81826 151507
21410 151507
21410 148464
...

output:

No

result:

ok ok (1 test case)

Test #11:

score: 0
Accepted
time: 90ms
memory: 26232kb

input:

1
195719 496023
1 37447
1 94499
1 93445
1 159134
1 9294
1 28312
1 159443
1 12198
1 175523
1 167569
1 182624
1 61106
1 109758
1 83799
1 70857
1 180981
1 90329
1 63481
1 5198
1 54301
1 29404
1 77383
1 193083
1 48588
1 143999
1 189809
1 102318
1 39109
1 50191
1 18419
1 162337
1 16535
1 8472
1 168713
1 ...

output:

Yes
1 336 171 21 144 177 12 146 204 200 64 200 26 209 255 9 162 118 193 377 110 163 312 63 286 276 18 189 60 242 185 163 163 200 218 61 282 83 55 49 52 81 2 327 307 280 198 62 43 59 95 5 204 211 5 154 220 158 173 260 134 256 34 338 140 33 138 301 69 40 187 199 21 212 264 246 89 109 196 136 295 23 11...

result:

ok ok (1 test case)

Test #12:

score: 0
Accepted
time: 62ms
memory: 26028kb

input:

1
195881 326465
4835 48280
48280 145430
69556 145430
69556 139594
139594 100169
113695 100169
113695 9721
9721 159758
45959 159758
45959 138631
138631 105525
161337 105525
161337 145825
145825 13840
115797 13840
115797 192352
192352 59986
147016 59986
147016 106035
106035 42785
87638 42785
87638 102...

output:

No

result:

ok ok (1 test case)

Test #13:

score: 0
Accepted
time: 94ms
memory: 26656kb

input:

1
200000 498030
1 61309
1 80811
1 159457
1 53775
1 53080
1 73194
1 50600
1 182243
1 70727
1 55494
1 86417
1 159878
1 131249
1 24024
1 131422
1 152466
1 61113
1 30222
1 199135
1 117959
1 27855
1 195292
1 181094
1 16962
1 123395
1 114071
1 116743
1 198435
1 182160
1 170066
1 142336
1 158861
1 83699
1 ...

output:

Yes
1 131 87 73 33 14 48 280 40 215 83 78 48 192 267 186 323 80 139 291 110 116 91 187 82 254 75 34 44 47 107 140 129 81 24 48 84 19 61 244 205 210 159 341 54 142 1 55 158 88 116 336 103 237 123 224 8 99 163 33 202 144 53 60 175 157 52 106 274 251 148 47 20 91 273 115 17 121 269 75 182 137 184 139 4...

result:

ok ok (1 test case)

Test #14:

score: 0
Accepted
time: 88ms
memory: 26348kb

input:

1
200000 496308
1 67125
1 87884
1 23447
1 175546
1 183274
1 9684
1 115668
1 110230
1 115021
1 162717
1 101513
1 182387
1 118073
1 43089
1 37679
1 125719
1 149180
1 181735
1 118142
1 29
1 92393
1 16214
1 75575
1 51852
1 85094
1 131713
1 122543
1 28961
1 10685
1 128461
1 57196
1 141573
1 80411
1 39767...

output:

Yes
1 205 148 67 269 214 99 278 310 196 321 336 78 340 141 25 171 240 176 86 62 67 153 291 62 1 83 208 28 250 113 136 94 191 293 229 86 101 58 38 223 3 168 96 133 65 323 52 115 1 46 186 246 331 119 4 111 196 53 14 261 15 263 2 213 255 365 57 35 109 31 9 72 256 40 55 148 35 175 70 358 14 158 254 307 ...

result:

ok ok (1 test case)

Test #15:

score: 0
Accepted
time: 76ms
memory: 26632kb

input:

1
200000 494647
1 40292
1 144979
1 143414
1 20633
1 103476
1 41901
1 54942
1 7709
1 13011
1 183194
1 10687
1 173540
1 46370
1 199713
1 197513
1 164369
1 56771
1 188738
1 191416
1 134766
1 174253
1 189997
1 62461
1 77816
1 155675
1 53293
1 73007
1 123351
1 73328
1 134584
1 192547
1 94713
1 87884
1 16...

output:

Yes
1 184 130 33 42 14 74 130 129 81 17 105 186 156 110 126 115 121 94 90 1 46 105 46 157 47 128 46 92 116 208 111 86 72 62 35 35 88 178 194 72 89 100 51 149 21 120 259 19 219 122 96 126 129 205 143 57 57 70 4 151 36 282 146 242 247 8 50 47 104 54 218 4 64 213 66 25 205 50 124 94 77 65 220 141 154 1...

result:

ok ok (1 test case)

Test #16:

score: 0
Accepted
time: 92ms
memory: 26520kb

input:

1
196815 497583
1 155797
1 193300
1 125537
1 194998
1 189169
1 149571
1 81372
1 129406
1 85598
1 187825
1 36566
1 180012
1 10823
1 62405
1 46314
1 4001
1 61376
1 137856
1 42774
1 129337
1 35178
1 102964
1 174069
1 101483
1 121457
1 153968
1 77937
1 99096
1 155052
1 58925
1 36248
1 14075
1 57233
1 76...

output:

Yes
1 78 107 97 12 23 10 57 191 340 270 4 25 76 61 10 87 109 5 142 106 223 164 287 103 300 1 83 15 71 350 258 63 81 244 131 199 123 168 213 57 200 197 105 158 121 366 132 227 209 100 266 27 342 3 197 241 240 12 201 7 160 399 100 33 201 59 39 39 126 9 67 13 295 65 336 102 89 27 226 64 240 101 345 181...

result:

ok ok (1 test case)

Test #17:

score: 0
Accepted
time: 63ms
memory: 17880kb

input:

4
50000 99992
1 37052
1 42568
1 64
1 29389
1 33625
1 45029
1 29776
1 14888
1 15856
1 34822
1 42758
1 45081
1 41042
1 18758
1 22373
1 2232
1 48245
1 8335
1 30504
1 24566
1 43294
1 48483
1 17157
1 45811
1 13014
1 11847
1 19635
1 22669
1 46134
1 12982
1 30977
1 26649
1 17344
1 41235
1 6192
1 12638
1 25...

output:

Yes
1 107 29 12 21 50 16 134 45 158 13 69 5 34 14 157 27 34 93 33 43 48 78 18 61 50 48 74 114 114 61 59 104 70 62 115 58 140 41 72 87 47 11 138 58 71 188 15 117 46 105 97 107 4 49 27 74 97 61 84 109 118 127 1 102 96 125 167 150 76 32 153 105 27 122 199 44 44 58 42 29 18 87 122 159 144 41 56 67 1 17 ...

result:

ok ok (4 test cases)

Test #18:

score: 0
Accepted
time: 62ms
memory: 17768kb

input:

4
50000 99987
1 26348
1 28062
1 21534
1 42614
1 37721
1 47094
1 26341
1 48507
1 30205
1 18544
1 22338
1 11500
1 36134
1 49034
1 3366
1 333
1 21428
1 34175
1 25082
1 14845
1 46041
1 41371
1 45461
1 43435
1 16198
1 27448
1 20195
1 41680
1 30051
1 27745
1 44032
1 26376
1 31540
1 39763
1 22578
1 33250
1...

output:

Yes
1 59 14 54 88 76 87 53 178 160 5 63 172 12 23 102 65 45 46 53 77 4 6 6 46 153 66 70 129 53 85 1 41 111 134 109 15 87 97 133 53 191 37 74 107 23 36 3 85 40 61 20 99 9 57 66 18 18 122 148 67 75 19 31 81 56 28 125 47 63 1 15 45 1 66 43 76 41 93 18 104 148 50 136 58 89 195 71 109 3 129 91 96 30 63 1...

result:

ok ok (4 test cases)

Test #19:

score: 0
Accepted
time: 62ms
memory: 18048kb

input:

4
46544 77570
5146 33799
33799 24403
20994 24403
20994 6976
6976 17268
23793 17268
23793 34344
34344 3356
43440 3356
43440 44237
44237 10294
28698 10294
28698 39637
39637 18139
35928 18139
35928 44391
44391 33265
1826 33265
1826 6813
6813 10489
14783 10489
14783 39250
39250 3550
43164 3550
43164 516...

output:

No
Yes
1 81 63 141 13 52 92 128 164 164 54 176 110 4 82 111 80 48 77 13 53 56 16 110 119 65 69 103 67 58 132 103 82 60 86 70 50 106 20 6 179 35 56 26 77 32 25 161 23 79 41 97 76 36 26 89 108 66 76 64 28 28 207 76 70 130 69 42 11 98 186 18 59 165 114 99 75 76 77 59 85 62 111 148 157 87 151 155 40 122...

result:

ok ok (4 test cases)

Test #20:

score: 0
Accepted
time: 54ms
memory: 17952kb

input:

4
50000 99982
1 44586
1 26416
1 13734
1 14946
1 15582
1 48832
1 48946
1 49537
1 2997
1 44139
1 38283
1 42638
1 45750
1 30506
1 42989
1 4251
1 47124
1 11832
1 46680
1 17060
1 31444
1 17322
1 44148
1 45927
1 19806
1 45126
1 10678
1 34979
1 33116
1 19659
1 19963
1 47207
1 38543
1 23992
1 47547
1 30810
...

output:

Yes
1 88 30 45 115 28 42 149 57 161 117 176 197 68 169 5 10 36 4 3 64 216 32 29 72 45 43 82 82 107 21 111 102 126 38 14 164 50 132 190 123 67 60 205 199 67 160 32 44 42 142 73 109 145 98 89 72 125 68 114 31 76 70 61 165 41 30 101 81 57 5 3 14 57 57 43 106 54 196 93 2 171 10 160 134 106 11 115 10 117...

result:

ok ok (4 test cases)

Test #21:

score: 0
Accepted
time: 60ms
memory: 18052kb

input:

4
48440 80730
20510 37086
37086 41968
37277 41968
37277 32029
32029 12807
4350 12807
4350 5096
5096 13315
233 13315
233 26078
26078 39649
34279 39649
34279 30398
30398 19295
35076 19295
35076 10210
10210 23140
40175 23140
40175 24651
24651 10464
6146 10464
6146 20178
20178 6945
32095 6945
32095 398
...

output:

No
Yes
1 99 113 162 39 33 22 30 113 7 32 70 63 161 49 1 59 94 102 1 72 36 82 39 52 28 97 68 152 98 143 35 8 76 44 57 134 25 124 118 42 156 162 87 17 28 147 97 115 98 61 1 25 11 36 94 59 182 68 5 6 120 136 171 96 15 126 113 130 97 48 15 72 76 35 33 91 74 129 13 29 74 74 52 64 32 87 26 25 182 15 99 18...

result:

ok ok (4 test cases)

Test #22:

score: 0
Accepted
time: 69ms
memory: 17940kb

input:

4
50000 99978
1 28364
1 35612
1 47359
1 13620
1 30756
1 11913
1 7196
1 38786
1 30188
1 48614
1 13513
1 49242
1 2768
1 8699
1 24695
1 44809
1 28800
1 42856
1 416
1 44350
1 35045
1 26340
1 6524
1 39330
1 19440
1 31508
1 37508
1 25780
1 3393
1 41409
1 28384
1 11978
1 6137
1 3202
1 15895
1 44535
1 2860
...

output:

Yes
1 15 79 58 165 132 85 81 101 142 98 36 22 21 115 58 152 132 3 9 86 169 19 130 73 124 2 69 44 100 194 204 144 104 119 68 15 23 42 1 46 171 39 69 118 113 117 114 7 69 88 68 86 100 7 10 4 105 94 145 21 168 24 115 98 184 3 156 192 134 41 108 136 1 47 71 1 81 188 16 40 66 127 1 115 98 22 83 12 139 12...

result:

ok ok (4 test cases)

Test #23:

score: 0
Accepted
time: 52ms
memory: 18044kb

input:

4
45901 99522
1 18883
1 16169
1 24663
1 35800
1 39712
1 43438
1 44701
1 30656
1 38898
1 40326
1 43301
1 25369
1 42501
1 35809
1 10640
1 9339
1 38562
1 42600
1 158
1 21847
1 19980
1 20090
1 32169
1 8928
1 16065
1 6917
1 35776
1 45788
1 32598
1 17405
1 798
1 25226
1 8067
1 24647
1 5083
1 14754
1 4293
...

output:

Yes
1 57 113 26 137 36 124 16 15 7 208 126 101 122 78 74 22 68 96 115 25 163 48 16 20 43 172 58 169 80 40 11 158 103 57 34 10 56 29 12 20 10 69 132 61 65 3 98 104 95 34 39 102 1 41 145 128 54 90 124 126 76 35 36 108 3 31 15 23 63 11 125 88 147 16 22 13 87 100 47 17 2 67 99 13 6 14 42 95 63 118 73 81...

result:

ok ok (4 test cases)

Test #24:

score: 0
Accepted
time: 66ms
memory: 17800kb

input:

4
50000 99561
1 9493
1 4375
1 19778
1 17185
1 47877
1 20599
1 9768
1 37858
1 15658
1 13556
1 5845
1 38836
1 14046
1 30325
1 19245
1 11055
1 45732
1 40427
1 18069
1 2936
1 5434
1 14846
1 15104
1 762
1 16135
1 28604
1 45416
1 865
1 33562
1 4793
1 17457
1 43485
1 15706
1 37883
1 21892
1 39920
1 8477
1 ...

output:

Yes
1 24 59 20 6 58 29 17 5 59 16 14 62 15 15 11 21 24 3 84 32 20 44 43 22 19 11 50 9 68 8 11 5 72 3 14 54 44 1 8 45 82 17 59 25 30 22 7 46 47 18 82 19 5 17 32 1 9 11 79 42 46 23 26 1 45 31 40 40 24 68 63 9 1 39 9 38 18 28 19 22 29 13 58 21 9 16 49 7 41 28 34 54 17 22 3 55 30 54 21 30 31 13 3 29 4 1...

result:

ok ok (4 test cases)

Test #25:

score: 0
Accepted
time: 59ms
memory: 16660kb

input:

10
20000 49560
1 12421
1 18824
1 7063
1 6144
1 18228
1 10289
1 18844
1 16226
1 16484
1 15230
1 1325
1 9893
1 8118
1 6648
1 18994
1 14612
1 18502
1 3075
1 9636
1 914
1 2702
1 8055
1 15865
1 5437
1 13614
1 5111
1 3875
1 19395
1 19759
1 4084
1 6443
1 14246
1 6291
1 17649
1 12872
1 9223
1 9642
1 16067
1...

output:

Yes
1 49 31 32 30 48 38 2 29 76 24 21 37 27 23 7 47 37 3 57 31 48 43 72 27 105 29 70 69 49 56 65 47 103 54 9 27 74 8 6 76 11 14 38 69 12 45 77 24 117 5 30 113 13 23 12 47 6 66 65 7 13 17 71 96 57 83 14 3 26 35 31 19 65 94 93 82 88 50 1 105 54 27 93 22 33 1 43 54 112 87 72 12 41 34 83 82 7 91 22 25 5...

result:

ok ok (10 test cases)

Test #26:

score: 0
Accepted
time: 78ms
memory: 16692kb

input:

10
20000 49107
1 2585
1 5845
1 8900
1 17326
1 5237
1 7619
1 6910
1 5560
1 7767
1 13249
1 16441
1 4223
1 8764
1 7632
1 14152
1 5888
1 17688
1 6705
1 18011
1 5206
1 2533
1 4756
1 9396
1 14175
1 10340
1 13664
1 2459
1 15061
1 4081
1 7025
1 4435
1 9
1 19720
1 7035
1 7721
1 9669
1 8989
1 11217
1 9496
1 8...

output:

Yes
1 41 93 95 10 94 27 65 31 73 56 47 97 32 3 16 87 90 77 51 54 100 86 96 6 14 69 22 86 89 38 2 22 45 28 94 24 29 71 29 4 66 42 52 22 3 7 64 57 17 34 8 59 116 37 64 1 40 29 16 30 11 26 50 72 43 19 103 62 5 109 123 40 114 100 56 9 1 8 36 68 79 24 24 61 51 18 38 5 71 5 19 64 77 84 97 59 2 31 25 22 45...

result:

ok ok (10 test cases)

Test #27:

score: 0
Accepted
time: 67ms
memory: 16508kb

input:

10
20000 49355
1 7470
1 7577
1 9444
1 15558
1 7425
1 3863
1 17023
1 11796
1 6149
1 11714
1 6227
1 3974
1 2051
1 12472
1 162
1 846
1 13731
1 18883
1 3493
1 6308
1 2308
1 12711
1 711
1 3217
1 3536
1 6648
1 3836
1 15134
1 18111
1 8632
1 7968
1 2318
1 584
1 10247
1 11066
1 15015
1 3315
1 15121
1 9663
1 ...

output:

Yes
1 76 105 7 45 46 1 38 102 86 3 39 81 35 94 19 61 55 1 29 66 65 20 80 37 17 23 50 83 96 86 42 60 104 20 89 21 22 1 35 37 95 88 57 91 14 30 23 33 59 90 38 20 47 82 35 14 113 95 23 36 117 25 61 25 29 13 97 6 54 71 26 21 25 30 47 119 13 40 23 30 17 56 74 12 67 96 43 95 51 44 76 37 33 11 85 83 60 44 ...

result:

ok ok (10 test cases)

Test #28:

score: 0
Accepted
time: 64ms
memory: 16540kb

input:

10
20000 49306
1 7640
1 19539
1 10600
1 7349
1 8170
1 17293
1 3327
1 1538
1 10166
1 961
1 4723
1 10857
1 15980
1 4810
1 11977
1 16853
1 14175
1 3467
1 17354
1 15184
1 19601
1 12222
1 4953
1 3699
1 2097
1 4341
1 11166
1 16802
1 10024
1 6743
1 14735
1 3824
1 9205
1 727
1 2759
1 2973
1 15939
1 1566
1 1...

output:

Yes
1 56 3 104 24 52 9 16 78 53 83 24 28 59 54 80 3 26 111 40 78 43 63 49 111 51 20 21 63 39 24 18 15 74 82 8 75 47 47 64 78 56 26 26 31 39 48 53 71 89 6 50 12 77 22 76 42 6 87 49 43 35 15 90 68 87 37 69 21 22 65 43 75 56 74 36 56 44 90 7 44 134 43 20 27 35 20 88 34 90 87 2 17 37 3 1 64 85 45 46 100...

result:

ok ok (10 test cases)

Test #29:

score: 0
Accepted
time: 72ms
memory: 16784kb

input:

10
20000 49519
1 8235
1 7650
1 3118
1 17111
1 15781
1 16102
1 19721
1 17353
1 2190
1 10928
1 10843
1 18647
1 17340
1 9304
1 8101
1 7939
1 16815
1 1635
1 14666
1 8181
1 11412
1 109
1 16165
1 3710
1 10306
1 17420
1 6735
1 2471
1 2099
1 2308
1 4171
1 6075
1 3641
1 10159
1 7087
1 2055
1 5638
1 12576
1 2...

output:

Yes
1 2 8 27 79 17 81 34 22 2 9 6 58 48 29 32 79 22 54 1 72 96 58 100 1 91 21 53 7 44 19 80 42 98 45 84 20 57 81 38 109 64 28 86 62 5 17 94 43 35 1 42 90 11 21 30 39 4 13 30 64 25 26 13 11 9 57 44 1 8 25 19 10 40 71 20 58 84 44 31 23 3 83 29 24 29 4 59 21 62 57 12 6 110 74 71 53 37 33 32 4 34 59 83 ...

result:

ok ok (10 test cases)

Test #30:

score: 0
Accepted
time: 58ms
memory: 16680kb

input:

10
19817 33025
8702 12298
12298 8087
14391 8087
14391 15275
15275 13489
7589 13489
7589 13828
13828 17626
13759 17626
13759 15568
15568 7861
7560 7861
7560 1415
1415 3704
16988 3704
16988 7209
7209 11660
3746 11660
3746 537
537 18694
9263 18694
9263 7359
7359 15346
11798 15346
11798 794
794 10169
18...

output:

No
No
Yes
1 76 68 1 32 2 47 23 43 55 65 1 12 57 81 68 20 54 67 31 57 41 34 15 42 40 25 87 56 9 64 13 22 11 45 70 69 19 25 57 5 72 94 45 26 23 110 15 73 52 1 23 62 37 59 2 10 84 41 14 77 78 18 86 32 49 4 49 22 88 47 55 76 64 3 29 30 58 36 69 104 104 2 117 42 51 16 72 105 41 63 7 13 49 41 38 79 8 46 1...

result:

ok ok (10 test cases)

Test #31:

score: 0
Accepted
time: 65ms
memory: 16740kb

input:

10
20000 46778
1 17666
1 9583
1 11152
1 10784
1 1976
1 530
1 16681
1 15370
1 5019
1 18392
1 1399
1 488
1 454
1 16246
1 13133
1 3027
1 18304
1 15782
1 768
1 14823
1 13200
1 7920
1 346
1 6059
1 13204
1 9737
1 7592
1 19616
1 2964
1 9331
1 14593
1 7052
1 602
1 12049
1 15523
1 9925
1 3494
1 15517
1 18307...

output:

Yes
1 11 27 17 8 10 15 53 25 10 39 18 12 26 1 7 44 25 24 19 8 1 3 20 8 12 56 6 1 68 8 6 2 33 62 39 18 46 7 12 29 3 43 56 10 55 49 33 44 38 22 27 20 19 10 1 1 26 36 40 45 30 20 19 1 16 24 12 21 10 11 1 40 29 10 14 1 40 15 2 1 34 29 41 43 1 24 1 43 25 10 37 17 1 44 27 14 7 30 1 24 10 5 39 26 30 15 18 ...

result:

ok ok (10 test cases)

Test #32:

score: 0
Accepted
time: 54ms
memory: 16644kb

input:

10
18919 48489
1 5647
1 13440
1 9257
1 2479
1 7324
1 18716
1 5839
1 7538
1 2868
1 18485
1 3031
1 14830
1 3522
1 11211
1 10343
1 15329
1 4888
1 17703
1 342
1 18032
1 14491
1 8520
1 13101
1 4569
1 6716
1 16225
1 4159
1 5545
1 13225
1 11735
1 16867
1 7687
1 3712
1 3458
1 9859
1 11566
1 14696
1 7612
1 6...

output:

Yes
1 15 34 14 29 10 69 48 40 26 9 49 91 20 16 51 56 53 42 8 93 22 51 8 14 7 79 103 43 58 41 39 56 4 66 78 57 62 14 2 10 11 39 64 80 16 36 4 62 3 34 84 33 29 4 87 51 17 51 12 31 85 20 13 93 5 30 42 34 34 59 77 71 16 6 13 18 16 71 1 54 7 17 44 5 49 65 3 31 76 42 29 10 3 5 1 61 25 26 81 22 11 9 53 29 ...

result:

ok ok (10 test cases)

Test #33:

score: 0
Accepted
time: 59ms
memory: 15812kb

input:

40
5000 11814
1 3958
1 4783
1 1625
1 4971
1 2666
1 4347
1 4726
1 983
1 3194
1 3690
1 2027
1 3165
1 2524
1 3054
1 2784
1 2288
1 954
1 3066
1 4592
1 3744
1 894
1 3044
1 4129
1 4206
1 4340
1 1312
1 282
1 407
1 4190
1 980
1 2100
1 1245
1 600
1 2680
1 4984
1 1058
1 2320
1 4736
1 1835
1 772
1 3850
1 3434
...

output:

Yes
1 7 2 6 10 25 17 1 15 43 9 35 34 37 35 16 17 21 69 8 4 47 26 18 2 19 14 14 28 21 4 11 25 13 24 37 3 42 31 26 47 49 8 1 3 2 44 14 32 12 16 46 16 4 32 19 31 65 42 15 40 1 8 21 38 21 9 5 12 48 38 19 39 27 1 30 24 2 14 2 5 18 39 15 19 5 7 57 3 8 42 37 6 27 1 28 32 7 41 57 23 23 8 27 1 13 38 47 1 30 ...

result:

ok ok (40 test cases)

Test #34:

score: 0
Accepted
time: 57ms
memory: 15804kb

input:

40
4721 7865
3857 3817
3817 3296
3963 3296
3963 4111
4111 475
257 475
257 1447
1447 4646
2028 4646
2028 3185
3185 3622
4651 3622
4651 1160
1160 1260
2044 1260
2044 2212
2212 4504
3886 4504
3886 1332
1332 2499
526 2499
526 2467
2467 924
3996 924
3996 1185
1185 4187
1816 4187
1816 307
307 3579
220 357...

output:

No
Yes
1 21 14 27 1 15 10 23 2 23 5 12 43 6 27 14 20 8 21 25 9 9 22 15 1 17 36 31 2 13 3 1 4 16 1 1 20 8 1 27 4 27 37 23 8 9 15 28 3 14 1 5 25 12 1 14 1 9 8 29 4 13 12 3 15 13 2 9 23 2 2 2 1 15 2 36 1 7 11 23 8 21 19 9 10 1 22 18 22 2 1 12 7 6 33 21 1 20 8 3 5 5 25 37 4 6 35 3 31 19 8 30 1 15 9 1 11...

result:

ok ok (40 test cases)

Test #35:

score: 0
Accepted
time: 60ms
memory: 15620kb

input:

40
4764 12096
1 4578
1 3298
1 4612
1 3807
1 3223
1 2526
1 2712
1 3568
1 1422
1 4727
1 4155
1 3080
1 659
1 3218
1 3075
1 3893
1 458
1 1821
1 587
1 4675
1 816
1 533
1 148
1 928
1 4335
1 3122
1 4506
1 3792
1 3766
1 2912
1 3651
1 2310
1 3119
1 2038
1 2452
1 1449
1 2758
1 1975
1 2962
1 4657
1 3038
1 2371...

output:

Yes
1 20 3 30 43 48 41 9 10 7 30 9 4 2 28 27 10 5 33 8 13 5 48 1 10 1 61 7 27 18 38 42 21 8 10 13 9 14 30 55 29 60 31 3 25 2 45 53 20 32 12 31 25 17 4 1 48 15 11 49 9 27 9 5 31 45 40 43 26 7 18 10 5 50 39 38 12 42 38 30 24 22 24 23 21 25 47 19 36 27 70 15 5 1 5 23 52 40 5 37 40 3 5 9 17 21 24 35 22 ...

result:

ok ok (40 test cases)

Test #36:

score: 0
Accepted
time: 71ms
memory: 15556kb

input:

40
4778 7960
2767 1868
1868 1252
1808 1252
1808 1426
1426 2084
4736 2084
4736 3578
3578 505
4167 505
4167 4537
4537 1732
2227 1732
2227 1876
1876 3989
4495 3989
4495 353
353 3061
2281 3061
2281 4502
4502 2478
83 2478
83 603
603 621
1033 621
1033 3023
3023 1777
1320 1777
1320 3704
3704 2126
1341 2126...

output:

No
Yes
1 5 1 24 1 7 10 9 17 17 14 23 11 5 18 8 2 18 17 3 1 9 6 7 6 2 8 5 15 5 8 7 15 12 4 2 5 5 22 10 18 1 18 11 11 11 1 27 3 28 14 3 4 3 1 2 13 30 4 7 12 1 6 6 10 24 25 6 24 3 27 6 11 8 13 1 23 12 5 5 33 8 4 1 12 26 8 26 16 13 19 10 21 2 7 4 15 4 23 22 18 13 18 4 2 13 6 25 26 1 13 37 5 1 21 2 17 9 ...

result:

ok ok (40 test cases)

Test #37:

score: 0
Accepted
time: 61ms
memory: 15592kb

input:

40
4837 11978
1 2353
1 1062
1 3787
1 4402
1 4050
1 1049
1 795
1 1018
1 3962
1 4447
1 2062
1 4467
1 2569
1 3967
1 3946
1 766
1 2336
1 1273
1 3153
1 4219
1 2927
1 1213
1 668
1 3004
1 1515
1 641
1 1358
1 4768
1 2183
1 2565
1 3675
1 2458
1 297
1 1055
1 3881
1 4719
1 579
1 2119
1 484
1 224
1 4315
1 2878
...

output:

Yes
1 2 30 32 8 6 19 43 25 12 11 4 13 6 23 6 31 8 23 4 8 1 13 10 16 2 7 35 21 17 36 7 37 30 45 16 2 30 7 16 30 29 38 54 54 19 11 22 3 17 10 21 34 13 11 20 2 4 1 29 7 3 24 19 27 10 20 15 17 26 16 53 49 12 6 16 21 5 5 18 2 16 7 6 6 9 48 25 13 19 35 22 11 25 25 17 6 10 9 14 26 27 31 42 5 21 12 4 29 5 4...

result:

ok ok (40 test cases)

Test #38:

score: 0
Accepted
time: 54ms
memory: 15600kb

input:

40
4531 11826
1 469
1 499
1 1329
1 1084
1 1582
1 4286
1 3566
1 4385
1 1823
1 4161
1 1884
1 623
1 321
1 198
1 3228
1 4165
1 2720
1 4092
1 2876
1 2853
1 1308
1 3671
1 4036
1 2147
1 3881
1 2180
1 3193
1 3794
1 2421
1 3051
1 1550
1 1430
1 1273
1 355
1 3728
1 320
1 1429
1 2111
1 93
1 1229
1 4516
1 3476
1...

output:

Yes
1 6 3 35 34 1 10 1 12 18 9 10 37 45 23 7 20 9 43 4 2 12 43 19 8 2 22 22 7 5 45 19 28 21 33 10 44 31 13 8 17 36 29 41 11 1 6 14 2 1 3 34 19 5 13 21 22 26 45 8 32 41 20 26 35 15 15 38 7 10 21 24 38 7 19 18 53 40 14 24 18 4 1 5 33 15 49 47 39 21 22 39 37 1 11 45 14 24 13 17 1 1 2 9 20 11 30 21 3 14...

result:

ok ok (40 test cases)

Test #39:

score: 0
Accepted
time: 67ms
memory: 15724kb

input:

40
5000 12093
1 4282
1 4844
1 4912
1 4220
1 4200
1 796
1 1478
1 3428
1 4898
1 4881
1 549
1 2913
1 4823
1 3658
1 2576
1 1732
1 3627
1 4938
1 2055
1 1088
1 769
1 2935
1 1085
1 1698
1 4172
1 1962
1 24
1 3967
1 206
1 163
1 3524
1 4740
1 3288
1 4368
1 4767
1 4508
1 4271
1 1004
1 966
1 1612
1 328
1 1015
1...

output:

Yes
1 44 40 40 38 6 22 10 14 44 41 45 17 5 13 66 13 13 24 30 38 15 9 18 12 17 22 37 28 62 39 35 8 6 43 28 1 43 14 44 25 17 24 49 5 32 41 22 12 47 26 24 30 49 12 2 26 13 47 55 3 5 21 3 27 6 6 8 4 2 6 20 42 43 33 25 29 27 5 2 4 42 26 28 39 12 8 1 29 14 19 19 12 5 55 23 17 21 24 8 22 21 35 56 57 20 63 ...

result:

ok ok (40 test cases)

Test #40:

score: 0
Accepted
time: 64ms
memory: 15632kb

input:

40
5000 12265
1 3936
1 3755
1 2242
1 136
1 3205
1 2971
1 1659
1 1707
1 150
1 554
1 4766
1 2084
1 3640
1 3266
1 2867
1 3424
1 2176
1 1288
1 3127
1 4005
1 2554
1 868
1 3477
1 912
1 2149
1 1582
1 3442
1 4186
1 522
1 3063
1 1635
1 741
1 3109
1 403
1 4529
1 1244
1 2880
1 2318
1 2161
1 3466
1 3931
1 1488
...

output:

Yes
1 20 3 14 8 15 10 17 25 10 16 1 21 19 9 34 4 31 17 15 12 20 10 12 24 36 31 32 11 2 54 25 45 2 17 20 14 1 16 6 19 16 50 10 53 40 9 4 12 22 18 3 18 29 1 42 8 17 19 6 17 4 28 20 39 2 15 1 36 44 1 5 2 16 10 18 46 21 33 32 3 8 18 3 4 9 1 17 3 18 22 8 21 42 30 4 18 10 10 5 17 14 2 3 27 26 17 40 34 47 ...

result:

ok ok (40 test cases)

Test #41:

score: 0
Accepted
time: 64ms
memory: 15380kb

input:

100
1870 3399
1 808
1 1347
1 1776
1 1128
1 1263
1 1100
1 1741
1 1497
1 33
1 1749
808 640
808 429
808 1099
808 1625
808 89
808 757
808 73
808 739
808 1295
808 578
808 1248
640 1242
640 747
640 908
640 934
640 243
640 1700
640 1275
640 272
640 383
1347 518
1347 1209
1347 13
1347 560
1347 440
518 45
51...

output:

Yes
1 2 3 10 4 1 3 5 1 1 1 1 4 8 7 11 7 1 1 1 8 7 5 1 1 11 9 1 10 1 5 1 26 3 6 5 1 1 13 3 1 4 4 1 7 11 5 1 1 1 10 2 3 5 5 1 1 9 3 2 3 10 1 10 8 1 1 1 1 2 10 5 10 10 1 1 5 9 1 1 1 1 3 1 2 7 1 11 6 8 1 15 2 3 8 4 1 7 1 1 1 1 7 1 6 4 14 12 3 6 1 5 8 4 3 10 1 1 4 2 7 8 1 1 1 1 11 5 9 1 4 1 1 1 11 1 1 1 ...

result:

ok ok (100 test cases)

Test #42:

score: 0
Accepted
time: 63ms
memory: 15628kb

input:

100
1944 4734
1 1018
1 1785
1 561
1 1221
1 107
1 1848
1 181
1 375
1 380
1 454
1 871
1 953
1 912
1 998
1 401
1 1709
1 581
1 417
1 1226
1 1328
1 1633
1 678
1 936
1 404
1 1909
1 125
1 190
1 900
1 712
1 732
1 1274
1 1489
1 1008
1 1600
1 1367
1 434
1 35
1 52
1 945
1 159
1 782
1 903
1 337
1 1353
1 838
1 5...

output:

Yes
1 14 17 18 9 8 25 21 6 8 30 13 26 3 8 5 22 1 17 24 9 11 13 4 21 7 1 30 21 7 14 10 1 38 27 6 10 28 6 23 1 1 30 17 16 18 2 18 4 1 17 36 1 10 3 11 13 32 18 20 40 1 11 26 18 7 27 1 5 25 1 8 8 20 23 18 4 2 5 3 27 26 27 23 9 37 9 9 19 16 25 1 1 12 15 11 15 4 22 24 12 8 22 22 10 14 4 40 33 12 13 15 20 ...

result:

ok ok (100 test cases)

Test #43:

score: 0
Accepted
time: 62ms
memory: 15424kb

input:

100
1941 4777
1 591
1 1042
1 162
1 27
1 1673
1 1394
1 50
1 209
1 782
1 1758
1 915
1 968
1 1660
1 1815
1 940
1 1049
1 325
1 1489
1 267
1 263
1 707
1 578
1 749
1 1218
1 660
1 1391
1 1029
1 415
1 1627
1 361
1 527
1 1899
1 362
1 805
1 324
1 1286
1 20
1 583
1 791
1 1041
1 530
1 1050
1 1356
1 1839
1 256
1...

output:

Yes
1 16 4 27 40 25 1 3 18 5 2 4 1 29 37 5 35 9 1 34 6 6 9 19 6 28 3 6 13 12 33 33 12 7 15 9 2 28 23 2 10 17 29 7 13 4 23 4 24 6 39 5 5 1 15 7 6 35 12 11 1 4 7 5 16 15 13 4 11 14 12 25 8 35 26 21 10 8 23 3 12 28 7 15 23 30 8 18 3 24 25 20 25 6 39 23 12 42 5 4 3 34 42 16 20 10 20 22 13 10 22 1 12 21 ...

result:

ok ok (100 test cases)

Test #44:

score: 0
Accepted
time: 58ms
memory: 15384kb

input:

100
1950 4510
1 1676
1 920
1 245
1 1944
1 1448
1 550
1 1032
1 776
1 376
1 618
1 1640
1 1887
1 585
1 1203
1 1187
1 139
1 1080
1 1625
1 1191
1 1136
1 1223
1 1229
1 1627
1676 29
1676 41
1676 1731
1676 1076
1676 1341
1676 1237
1676 1444
1676 117
1676 579
1676 599
1676 1822
1676 1834
1676 1035
1676 652
1...

output:

Yes
1 1 20 9 17 18 9 16 25 2 1 10 4 1 4 18 10 18 26 16 17 3 14 25 10 18 32 21 1 13 3 2 18 31 20 6 23 1 5 18 2 24 5 1 15 11 7 16 8 2 1 5 2 2 14 22 19 5 12 22 9 7 17 2 1 11 11 11 20 17 14 10 15 13 8 10 25 3 1 10 10 1 12 12 10 16 17 26 16 22 2 2 11 11 2 3 14 15 13 8 32 9 22 5 7 1 2 18 1 1 10 16 4 10 18...

result:

ok ok (100 test cases)

Test #45:

score: 0
Accepted
time: 63ms
memory: 15608kb

input:

100
1937 3225
1707 1249
1249 1515
1032 1515
1032 1779
1779 1399
1443 1399
1443 1649
1649 683
1934 683
1934 1051
1051 1344
69 1344
69 1304
1304 1210
1648 1210
1648 1146
1146 924
729 924
729 282
282 580
816 580
816 1440
1440 781
383 781
383 1273
1273 587
1118 587
1118 1751
1751 853
289 853
289 296
296...

output:

No
Yes
1 6 7 7 11 33 9 1 7 1 4 23 16 4 2 18 36 16 11 1 33 11 10 13 11 11 18 6 20 10 3 11 3 3 3 6 25 5 23 4 6 12 28 30 11 3 40 15 3 11 2 12 14 26 9 15 24 21 7 10 20 32 23 14 14 28 27 13 5 9 19 3 17 2 15 8 20 20 7 7 1 9 22 21 13 7 34 36 39 4 32 15 33 15 26 33 25 5 12 15 1 41 19 1 7 1 19 15 20 8 37 1 2...

result:

ok ok (100 test cases)

Test #46:

score: 0
Accepted
time: 56ms
memory: 15416kb

input:

100
1907 4098
1 1269
1 1056
1 846
1 645
1 160
1 955
1 310
1 774
1 73
1 989
1 1787
1 1802
1 1728
1 1577
1 524
1269 378
1269 1503
1269 1362
1269 1241
1269 1642
1269 928
1269 659
1269 115
1269 1372
1269 870
1269 1057
1269 1775
1056 1357
1056 726
1056 1849
1056 1850
1056 40
1056 896
1056 1471
1056 235
1...

output:

Yes
1 11 7 15 1 1 3 12 12 3 1 6 7 2 8 1 9 12 2 12 20 22 13 10 14 4 2 1 5 4 2 4 3 1 1 21 5 7 10 10 9 1 7 3 1 1 5 15 4 8 3 9 6 2 3 9 13 2 13 13 5 1 1 7 1 8 6 1 13 20 1 7 11 10 8 15 6 12 1 8 1 3 20 6 5 13 5 11 1 2 15 9 1 11 1 9 8 5 1 14 3 4 3 3 1 5 11 6 1 12 6 10 4 9 9 4 10 6 1 11 10 4 14 1 9 10 12 5 1...

result:

ok ok (100 test cases)

Test #47:

score: 0
Accepted
time: 61ms
memory: 15392kb

input:

100
1892 3150
1876 1550
1550 1752
1857 1752
1857 1805
1805 1628
1733 1628
1733 1352
1352 1227
155 1227
155 1885
1885 1662
348 1662
348 900
900 1774
689 1774
689 1476
1476 57
1685 57
1685 403
403 699
978 699
978 187
187 1001
19 1001
19 1719
1719 690
1164 690
1164 132
132 1769
113 1769
113 1784
1784 1...

output:

No
Yes
1 20 10 4 4 21 18 23 17 35 28 32 8 28 20 10 1 23 6 6 29 14 3 14 16 5 21 6 6 18 26 14 14 18 34 10 2 11 19 12 27 21 12 33 1 8 19 7 4 12 31 31 5 3 23 1 10 7 22 1 1 30 17 11 1 28 35 4 8 5 25 13 22 6 13 20 18 4 4 20 22 13 37 33 22 20 28 34 21 2 14 5 1 13 14 6 10 26 8 19 14 12 24 3 12 26 19 7 10 4 ...

result:

ok ok (100 test cases)

Test #48:

score: 0
Accepted
time: 63ms
memory: 15388kb

input:

100
1814 3020
1218 1336
1336 527
1014 527
1014 1445
1445 728
1583 728
1583 1718
1718 263
1177 263
1177 386
386 257
1387 257
1387 60
60 927
622 927
622 1004
1004 1719
433 1719
433 476
476 1662
989 1662
989 1538
1538 295
900 295
900 1288
1288 609
292 609
292 1730
1730 1036
689 1036
689 842
842 1596
64...

output:

No
No
No
No
Yes
1 5 6 25 1 7 14 18 15 21 28 3 2 8 29 8 29 23 14 18 6 31 5 15 18 13 41 15 16 34 7 27 38 7 9 8 2 27 20 42 35 37 4 9 23 3 9 6 5 41 27 16 7 8 4 34 1 18 14 26 29 24 2 43 1 41 8 5 16 30 19 29 10 15 10 7 11 25 23 20 9 20 2 11 2 38 35 30 28 17 45 9 7 29 7 25 27 1 13 5 6 1 9 1 10 37 29 28 16 ...

result:

ok ok (100 test cases)

Test #49:

score: 0
Accepted
time: 59ms
memory: 15328kb

input:

400
500 883
1 305
1 134
1 102
1 497
1 235
1 389
1 70
1 119
1 167
1 96
1 31
305 453
305 270
305 447
305 258
305 155
453 496
453 175
453 214
453 474
496 93
496 52
496 373
496 263
496 129
496 491
496 35
270 479
270 410
270 344
270 66
270 80
270 122
479 256
479 141
479 330
479 162
479 160
479 383
134 11...

output:

Yes
1 3 6 1 6 3 2 11 1 5 1 3 10 6 1 3 1 6 5 4 1 4 1 3 6 1 1 1 1 2 17 4 1 1 8 3 1 8 1 1 9 6 1 1 5 5 1 4 7 1 1 1 1 3 1 1 1 3 3 10 2 1 1 1 7 3 3 1 1 10 5 1 7 3 2 1 4 13 3 6 1 4 4 2 7 1 9 2 8 1 5 2 2 4 2 13 3 3 6 7 1 8 1 4 6 1 2 1 3 2 1 3 1 1 2 1 1 5 12 3 1 14 1 1 5 1 1 4 4 8 3 1 5 9 1 4 4 3 1 5 1 2 2 1...

result:

ok ok (400 test cases)

Test #50:

score: 0
Accepted
time: 57ms
memory: 15304kb

input:

400
473 785
360 240
240 421
175 421
175 169
169 8
443 8
443 9
9 63
406 63
406 377
377 309
68 309
68 85
85 64
3 64
3 105
105 424
62 424
62 179
179 415
349 415
349 274
274 378
72 378
72 454
454 47
403 47
403 270
270 91
189 91
189 27
27 414
199 414
199 381
381 258
242 258
242 408
408 155
252 155
252 17...

output:

No
Yes
1 2 1 3 3 1 14 3 2 1 10 13 22 5 8 10 12 17 3 10 1 10 1 1 4 2 12 2 1 9 1 6 21 3 4 1 1 6 8 2 2 2 1 5 3 12 1 11 7 15 1 1 5 16 7 1 10 7 3 1 7 1 2 8 12 12 13 12 3 6 8 1 8 2 1 11 1 7 2 10 11 3 2 10 5 3 3 1 1 10 10 2 6 11 1 10 12 1 1 6 9 11 1 1 14 2 14 1 1 1 13 4 3 7 1 6 13 1 17 4 8 4 2 11 10 6 11 9...

result:

ok ok (400 test cases)

Test #51:

score: 0
Accepted
time: 58ms
memory: 15244kb

input:

400
500 1147
1 149
1 103
1 140
1 229
1 425
1 389
1 423
1 194
1 293
1 16
1 479
1 496
1 401
1 269
1 407
1 247
1 212
1 171
1 262
1 397
1 80
1 85
1 75
1 44
1 175
1 258
1 122
1 65
149 32
149 213
149 438
149 286
149 96
149 126
149 200
103 32
103 349
103 119
103 231
103 3
103 489
103 341
103 90
103 126
140...

output:

Yes
1 9 14 1 7 4 2 7 1 2 1 4 5 5 2 5 6 16 8 1 11 11 1 1 1 3 4 10 7 2 7 3 11 10 6 9 2 2 9 5 3 10 9 18 11 6 6 2 7 12 9 2 7 7 5 6 1 7 6 1 1 3 9 1 20 4 3 5 8 1 5 14 6 5 15 1 8 2 9 17 1 8 14 8 15 5 1 7 7 18 1 2 6 3 9 18 2 13 6 5 11 7 1 5 7 1 7 16 13 3 2 16 9 1 6 5 4 2 5 4 18 20 1 16 2 19 12 3 10 3 12 7 2...

result:

ok ok (400 test cases)

Test #52:

score: 0
Accepted
time: 62ms
memory: 15484kb

input:

400
500 1149
1 484
1 71
1 338
1 237
1 187
1 388
1 27
1 296
1 272
1 14
1 445
1 491
1 209
1 457
1 312
1 56
1 5
1 81
1 52
1 345
1 395
1 41
1 199
1 386
1 326
1 339
1 448
1 84
1 360
1 83
484 128
484 436
484 349
484 127
484 478
484 256
484 428
484 466
484 251
484 350
71 63
71 418
71 193
71 186
71 492
71 1...

output:

Yes
1 15 3 4 10 2 13 1 6 1 2 3 7 6 3 6 11 3 5 9 1 17 9 5 8 3 5 5 2 7 8 1 1 8 8 3 1 6 5 6 13 11 4 4 2 15 3 7 7 1 6 11 7 6 2 10 8 6 3 2 2 1 1 3 8 3 15 8 11 4 1 9 8 11 5 9 3 1 5 4 11 6 19 16 6 3 8 9 5 3 2 14 14 4 4 4 10 14 8 3 3 11 9 5 1 5 4 1 1 4 6 4 5 1 14 1 9 1 3 3 2 4 1 13 7 1 8 1 1 10 4 4 2 9 9 11...

result:

ok ok (400 test cases)

Test #53:

score: 0
Accepted
time: 59ms
memory: 15296kb

input:

1000
200 353
1 62
1 175
1 131
1 173
1 6
1 37
1 94
1 85
1 171
1 39
1 187
1 25
62 199
62 182
62 44
62 65
175 191
175 145
175 13
175 177
175 73
175 124
131 31
131 15
131 2
131 146
131 96
173 31
173 3
173 18
173 180
6 92
6 152
6 139
6 170
31 78
31 30
31 88
31 76
31 97
31 38
191 136
191 115
191 80
191 51...

output:

Yes
1 5 1 7 1 10 1 3 13 1 8 1 9 6 5 10 1 8 4 1 3 1 8 8 18 1 1 7 2 9 2 3 1 3 3 3 14 12 14 1 9 2 6 4 1 1 2 1 1 1 14 2 5 1 9 1 2 2 6 4 1 9 10 1 7 9 1 1 1 8 8 1 14 1 5 11 1 1 3 7 1 5 13 11 13 5 1 10 1 3 1 4 4 13 2 10 12 1 4 8 3 1 1 6 4 2 1 4 1 2 1 6 1 4 13 1 3 1 1 1 1 1 1 15 1 6 2 1 6 1 4 7 1 1 4 1 3 3 ...

result:

ok ok (1000 test cases)

Test #54:

score: 0
Accepted
time: 59ms
memory: 15220kb

input:

1000
200 456
1 141
1 138
1 82
1 71
1 149
1 84
1 92
1 74
1 171
1 104
1 146
1 23
1 151
1 123
1 124
1 41
1 199
1 112
1 32
1 90
1 110
1 194
1 97
1 79
1 130
141 159
141 94
141 40
141 91
141 193
141 165
141 51
141 73
141 77
141 24
141 28
141 152
141 131
141 65
141 64
141 128
141 81
138 132
138 145
138 137...

output:

Yes
1 5 6 1 3 1 2 5 7 12 8 1 3 3 5 2 5 7 2 7 2 5 4 9 4 2 6 9 3 12 10 8 5 9 1 2 3 6 11 4 7 1 8 8 1 1 1 5 7 1 7 5 7 1 4 4 4 1 1 8 2 4 4 13 11 2 5 5 10 4 1 6 7 2 3 10 8 1 12 1 13 1 10 1 4 7 6 4 1 9 4 1 10 2 3 6 11 9 10 13 6 4 1 3 6 3 2 3 1 9 10 8 3 7 2 6 3 7 9 5 8 6 7 7 5 2 13 13 8 14 10 1 5 1 2 9 2 1 ...

result:

ok ok (1000 test cases)

Test #55:

score: 0
Accepted
time: 53ms
memory: 15204kb

input:

1000
182 300
151 50
50 110
181 110
181 138
138 54
141 54
141 41
41 93
33 93
33 101
101 20
159 20
159 120
120 32
118 32
118 119
119 107
117 107
117 9
9 2
173 2
173 86
86 7
48 7
48 105
105 24
145 24
145 3
3 73
63 73
63 150
150 71
87 71
87 83
83 16
68 16
68 19
19 30
103 30
103 164
164 25
104 25
104 67
...

output:

No
Yes
1 7 4 7 2 5 4 4 2 2 12 2 8 6 1 2 14 9 12 2 9 10 3 1 14 7 3 11 1 9 2 3 3 12 5 10 4 7 13 1 11 12 3 1 6 9 1 5 3 6 4 10 7 12 3 1 4 4 10 4 9 2 5 5 7 7 3 1 3 13 10 1 11 3 2 10 4 7 1 5 2 1 1 11 1 2 1 8 2 3 5 4 1 11 4 1 7 4 14 1 1 10 4 6 6 6 10 8 3 1 4 3 3 1 2 7 2 5 4 4 4 4 3 7 11 7 1 7 9 7 7 3 1 10 ...

result:

ok ok (1000 test cases)

Test #56:

score: 0
Accepted
time: 60ms
memory: 15304kb

input:

1000
198 461
1 68
1 77
1 163
1 12
1 19
1 196
1 30
1 60
1 28
1 175
1 21
1 115
1 22
1 190
1 87
1 145
1 113
1 78
1 169
1 125
1 155
1 124
1 191
1 139
1 52
1 146
68 103
68 81
68 18
68 34
68 132
68 164
68 40
68 165
68 94
68 193
68 88
68 168
68 49
68 177
68 183
68 178
68 116
68 160
77 37
77 86
77 126
77 19...

output:

Yes
1 3 5 5 2 6 7 10 3 9 1 2 1 6 11 8 1 3 2 7 5 6 1 6 1 2 3 4 3 3 6 6 6 5 3 2 1 4 6 6 4 1 2 4 8 3 1 2 9 3 1 12 1 2 2 1 9 6 1 3 1 4 9 7 3 2 2 1 2 6 3 9 4 1 2 1 2 6 6 2 3 3 6 4 8 2 6 8 8 1 6 8 1 7 1 10 7 9 5 6 3 6 1 6 5 3 1 4 1 7 4 5 6 5 6 11 6 1 5 5 5 4 2 11 9 2 9 8 8 1 1 5 4 2 4 5 7 10 12 4 5 7 2 5 ...

result:

ok ok (1000 test cases)

Test #57:

score: 0
Accepted
time: 55ms
memory: 15184kb

input:

4000
46 93
1 42
1 26
1 32
1 23
1 33
1 8
1 22
1 28
1 39
42 14
42 11
42 21
42 4
42 43
26 15
26 11
26 20
26 21
26 43
32 12
32 44
32 31
32 40
32 36
32 27
14 17
14 12
14 44
14 31
14 36
15 9
15 10
15 5
15 24
11 5
11 24
11 30
11 34
20 2
20 7
20 16
21 7
21 45
17 45
17 25
17 16
9 2
9 25
10 29
10 13
10 38
2 1...

output:

Yes
1 1 1 5 3 1 2 7 1 2 1 3 1 1 1 3 1 1 1 2 2 7 5 4 3 1 4 7 1 4 4 2 6 5 1 4 1 3 7 4 2 1 6 4 3 1 
No
Yes
1 7 1 1 1 1 7 1 3 5 7 5 1 3 4 5 5 1 1 1 3 5 1 2 3 4 3 1 4 4 3 5 2 2 2 4 1 7 1 1 4 1 1 1 8 3 4 4 2 1 
No
Yes
1 1 2 4 3 2 1 6 3 2 1 2 2 1 1 6 1 4 1 3 1 3 1 2 3 2 4 4 1 1 3 3 2 2 1 3 4 1 1 1 2 1 2 1 ...

result:

ok ok (4000 test cases)

Test #58:

score: 0
Accepted
time: 55ms
memory: 15256kb

input:

4000
50 111
1 42
1 37
1 8
1 33
1 48
1 30
1 17
1 22
1 21
1 6
1 29
1 24
1 45
42 40
42 39
42 18
42 32
42 34
42 3
42 2
37 39
37 32
37 34
37 25
37 13
8 40
8 3
8 2
8 5
40 11
40 10
40 44
40 12
39 27
39 11
39 46
39 44
33 31
33 19
33 43
33 49
33 35
33 36
33 23
48 49
48 35
48 23
18 14
18 43
27 19
27 49
27 35
...

output:

Yes
1 5 4 2 6 6 1 1 1 1 1 5 4 1 1 1 4 2 1 1 5 5 4 7 4 3 1 1 7 4 1 3 3 3 2 4 1 1 1 1 1 1 1 2 7 2 3 3 1 1 
Yes
1 3 3 3 3 1 1 4 4 1 2 3 1 1 1 2 1 2 1 1 3 1 5 1 1 4 3 4 3 1 1 5 5 5 1 7 1 1 1 1 2 6 2 1 4 2 3 2 1 1 
Yes
1 1 6 1 3 1 5 1 9 1 4 3 5 1 6 1 1 1 1 1 1 3 6 5 1 10 1 5 3 9 5 1 1 1 1 2 6 2 1 2 5 3 1...

result:

ok ok (4000 test cases)

Test #59:

score: 0
Accepted
time: 45ms
memory: 15216kb

input:

4000
44 70
32 33
33 23
6 23
6 27
27 18
40 18
40 14
14 4
9 4
9 36
36 28
37 28
37 21
21 19
43 19
43 22
22 20
30 20
30 35
35 26
24 26
24 3
3 39
29 39
29 16
16 12
17 12
17 15
15 10
13 10
13 31
31 7
11 7
11 34
34 41
2 41
2 8
8 42
5 42
5 38
38 25
32 25
1 32
23 44
1 6
18 44
1 40
4 44
1 9
28 44
1 37
19 44
1...

output:

No
Yes
1 6 2 1 4 2 1 4 1 4 1 1 6 2 1 5 2 1 5 7 1 3 1 1 2 1 1 4 6 5 4 5 1 8 1 1 3 1 4 1 1 4 2 2 2 1 1 1 
Yes
1 1 1 1 2 1 4 2 1 1 2 1 4 3 1 2 3 7 4 4 1 2 1 2 4 1 5 6 2 6 1 3 3 1 4 1 5 2 2 3 4 3 7 3 6 4 1 1 2 1 
Yes
1 1 7 2 5 1 2 6 1 1 3 1 3 7 6 1 6 1 1 1 3 7 1 3 4 1 4 2 1 1 1 1 2 6 3 4 2 1 6 1 7 5 7 1...

result:

ok ok (4000 test cases)

Test #60:

score: 0
Accepted
time: 51ms
memory: 15220kb

input:

4000
50 108
1 32
1 4
1 16
1 19
1 13
1 12
1 43
1 11
1 27
1 24
1 2
1 49
1 34
1 3
1 9
32 48
32 33
32 21
32 8
32 44
32 20
32 28
32 37
4 48
4 33
4 8
4 44
4 28
4 37
16 40
16 25
16 38
16 10
16 23
16 14
19 35
19 25
19 36
19 38
19 10
13 40
13 5
13 31
13 36
13 38
48 35
48 31
48 10
33 5
33 29
12 39
12 6
43 39
...

output:

Yes
1 4 6 1 2 2 2 2 6 3 4 4 2 4 1 2 2 3 2 3 3 1 3 4 2 1 3 3 3 1 1 1 1 5 2 1 5 1 2 2 1 2 4 2 2 1 1 1 5 1 
No
No
Yes
1 6 6 5 1 3 1 2 7 1 1 4 4 2 2 6 2 1 6 1 1 3 1 1 2 5 1 10 2 4 1 1 5 9 1 7 4 1 5 3 5 2 3 6 1 6 3 1 1 1 
Yes
1 2 5 1 2 4 2 4 3 2 1 1 1 2 1 4 3 2 4 4 2 3 2 4 3 1 1 1 4 2 1 1 2 2 2 3 2 3 1 4...

result:

ok ok (4000 test cases)

Extra Test:

score: 0
Extra Test Passed