QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#518169#8140. Customs Controls 2MCdycAC ✓105ms32088kbC++202.5kb2024-08-13 17:02:272024-08-13 17:02:28

Judging History

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

  • [2024-08-13 17:02:28]
  • 评测
  • 测评结果:AC
  • 用时:105ms
  • 内存:32088kb
  • [2024-08-13 17:02:27]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define all(a) a.begin(), a.end()
class dsu
{
    int n;
    vector<int> pa, size;

public:
    dsu(int x) : n(x), pa(x + 1), size(x + 1, 1)
    {
        iota(all(pa), 0);
    }
    int find(int x)
    {
        return pa[x] == x ? x : pa[x] = find(pa[x]);
    }
    void unite(int x, int y)
    {
        x = find(x), y = find(y);
        if (x == y)
        {
            return;
        }
        if (size[x] < size[y])
        {
            swap(x, y);
        }
        pa[y] = x;
        size[x] += size[y];
    }
};
int solve()
{
    int n, m;
    cin >> n >> m;
    dsu t(n);
    vector<vector<int>> a(n + 1);
    vector<vector<int>> g(n + 1);
    vector<vector<int>> G(n + 1);
    vector<int> in(n + 1);
    for (int i = 0; i < m; i++)
    {
        int x, y;
        cin >> x >> y;
        a[y].emplace_back(x);
    }
    for (int i = 1; i <= n; i++)
    {
        if (a[i].size() >= 2)
        {
            int x = a[i][0];
            for (auto it : a[i])
            {
                t.unite(x, it);
            }
        }
    }
    for (int i = 1; i <= n; i++)
    {
        for (auto it : a[i])
        {
            g[t.find(it)].emplace_back(t.find(i));
            in[t.find(i)]++;
        }
    }
    queue<int> q;
    vector<int> dp(n + 1);
    for (int i = 1; i <= n; i++)
    {
        if (in[i] == 0)
        {
            q.emplace(i);
            dp[i] = 1;
        }
    }
    vector<int> ans(n + 1);
    while (!q.empty())
    {
        int x = q.front();
        q.pop();
        for (auto it : g[x])
        {
            dp[it] = max(dp[it], dp[x] + 1);
            in[it]--;
            if (in[it] == 0)
            {
                q.emplace(it);
            }
        }
    }
    for (int i = 1; i <= n; i++)
    {
        dp[i] = dp[t.find(i)];
    }
    bool flag = 0;
    for (int i = 1; i <= n; i++)
    {
        for (auto it : a[i])
        {
            ans[i] = dp[i] - dp[it];
        }
        if (in[i] != 0)
        {
            flag = 1;
        }
    }
    if (flag)
    {
        cout << "No\n";
    }
    else
    {
        cout << "Yes\n";
        ans[1] = 1;
        for (int i = 1; i <= n; i++)
        {
            cout << ans[i] << " \n"[i == n];
        }
    }
    return 0;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int test;
    cin >> test;
    while (test--)
    {
        solve();
    }
    return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 3588kb

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: 0ms
memory: 3656kb

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: 0ms
memory: 3812kb

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: 0ms
memory: 3884kb

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: 3852kb

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: 3892kb

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 3 4 2 1 1 5 3 1 1 1 1 1 2 1 2 2 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 4 4 1 1 2 1 2 1 1 3 1 2 5 1 3 1
No
Yes
1 1 3 1 3 2 2 1 1 1 3 2 3 ...

result:

ok ok (10 test cases)

Test #8:

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

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 21 1 12 13 9 16 15 19 18 30 5 23 3 13 7 1 24 18 19 31 13 9 7 2 1 1 23 8 15 1 4 29 1 5 28 20 18 20 24 3 26 9 22 21 7 23 1 11 10 7 5 38 9 3 31 6 19 13 10 10 12 18 14 5 36 11 1 12 19 14 3 18 5 36 34 35 35 8 23 9 33 3 28 14 9 27 23 33 9 9 13 21 1 9 8 11 8 1 2 8 13 36 8 16 12 9 2 3 34 13 9 22 4 ...

result:

ok ok (10 test cases)

Test #9:

score: 0
Accepted
time: 105ms
memory: 29032kb

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 125 162 28 65 14 189 47 111 83 18 17 85 93 86 147 106 153 87 56 70 14 23 34 88 46 53 52 53 65 32 20 33 45 149 191 191 111 158 15 177 154 22 47 166 223 64 224 54 75 33 37 154 36 65 101 14 5 60 141 61 109 214 7 67 197 64 185 65 82 122 109 88 160 35 78 45 12 53 79 22 237 82 154 42 94 166 102 95 5...

result:

ok ok (1 test case)

Test #10:

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

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: 102ms
memory: 31160kb

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 170 20 142 179 15 145 205 201 63 198 24 208 254 8 162 121 194 378 106 167 313 63 285 279 20 190 54 238 184 164 162 201 222 61 280 83 54 52 54 78 2 327 307 278 194 61 38 56 96 6 200 218 7 157 220 158 172 257 137 255 37 335 148 33 134 300 68 39 186 201 21 213 264 247 88 112 197 134 295 24 10...

result:

ok ok (1 test case)

Test #12:

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

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: 97ms
memory: 31464kb

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 32 16 48 280 43 215 83 78 49 192 267 186 323 79 140 291 110 113 91 187 82 254 75 32 44 47 108 140 129 81 22 48 84 19 61 244 205 210 160 341 54 141 1 55 158 84 117 336 103 237 123 222 8 98 163 33 202 143 53 60 175 157 52 108 274 248 148 50 20 90 273 115 17 122 270 75 182 138 184 139 4...

result:

ok ok (1 test case)

Test #14:

score: 0
Accepted
time: 95ms
memory: 31048kb

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 202 147 62 270 213 99 276 310 198 319 338 77 335 141 24 172 245 179 86 62 66 156 291 61 1 83 208 27 248 112 135 98 190 288 227 83 104 56 32 223 5 170 95 133 65 321 56 111 1 46 186 243 330 120 2 111 196 49 12 263 15 262 3 216 257 365 59 35 109 31 8 77 261 39 55 148 34 173 72 358 14 158 253 304 ...

result:

ok ok (1 test case)

Test #15:

score: 0
Accepted
time: 101ms
memory: 32088kb

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 182 127 35 43 15 70 126 129 82 14 99 181 152 107 120 110 117 99 85 1 49 102 49 157 50 132 51 90 109 205 112 87 72 57 35 36 88 181 193 74 85 105 57 145 21 125 273 17 217 122 89 119 132 213 136 59 51 69 4 146 31 281 143 238 247 10 52 47 103 62 218 2 59 219 66 25 209 48 125 93 70 63 216 140 154 1...

result:

ok ok (1 test case)

Test #16:

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

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 9 24 10 57 191 338 270 4 25 76 61 10 87 111 5 144 106 222 164 287 103 300 1 83 14 71 350 259 63 81 245 131 199 124 168 213 57 200 199 105 158 121 366 132 227 209 100 266 28 342 3 197 242 242 12 202 8 159 399 99 33 201 59 39 39 126 9 67 13 293 67 336 102 89 27 226 64 237 101 345 181 1...

result:

ok ok (1 test case)

Test #17:

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

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 30 12 21 51 16 134 45 158 13 69 5 34 14 157 27 34 93 32 43 48 78 18 61 50 48 75 114 114 61 59 104 70 62 115 58 140 41 72 87 47 11 138 58 71 188 15 117 46 105 99 107 5 49 27 75 97 61 84 108 118 127 1 102 96 125 167 150 76 33 153 106 27 122 198 44 44 58 42 29 18 87 122 159 144 41 56 66 1 17 ...

result:

ok ok (4 test cases)

Test #18:

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

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 12 54 88 76 88 53 178 160 5 62 172 12 21 102 67 45 47 53 77 4 9 3 46 153 66 69 129 52 86 1 40 111 134 108 15 87 97 133 53 191 37 74 107 23 36 4 85 40 61 21 98 9 57 64 18 18 122 148 67 75 20 31 83 58 28 125 48 66 1 15 45 1 66 44 76 41 93 18 104 148 52 136 58 89 195 73 109 3 129 91 96 30 64 1...

result:

ok ok (4 test cases)

Test #19:

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

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 82 65 141 15 52 92 128 164 164 54 176 110 2 86 111 79 48 77 13 51 56 16 110 119 65 68 105 69 58 131 103 82 60 86 70 52 108 20 6 179 36 56 26 77 33 25 161 27 77 45 93 76 36 26 89 108 66 76 64 28 29 207 81 69 130 70 38 11 98 186 18 61 165 114 99 75 74 76 58 85 61 110 146 157 89 152 154 40 121...

result:

ok ok (4 test cases)

Test #20:

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

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 44 118 28 41 149 57 165 119 176 197 66 167 5 10 36 2 3 62 216 31 29 73 45 42 83 81 107 17 111 102 128 38 10 164 53 128 190 123 66 57 205 199 68 160 32 44 42 146 77 109 145 98 93 67 125 69 115 31 74 70 60 166 41 26 101 81 57 5 3 16 57 58 43 106 54 197 93 2 169 10 160 134 106 11 111 6 117 ...

result:

ok ok (4 test cases)

Test #21:

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

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 93 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 32 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: 71ms
memory: 10684kb

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 13 79 59 163 135 87 80 101 142 101 35 25 23 115 59 154 130 1 9 86 165 19 130 74 124 2 70 46 99 192 207 145 104 120 70 15 25 36 1 45 173 43 71 118 112 117 112 4 68 86 64 92 98 8 10 6 105 97 147 21 168 27 113 98 183 10 162 193 132 47 106 137 1 47 71 1 83 187 14 40 66 128 1 110 100 23 77 10 139 1...

result:

ok ok (4 test cases)

Test #23:

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

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 21 136 36 125 16 14 7 205 126 101 122 79 74 22 71 96 115 22 162 49 16 20 44 171 57 169 81 39 11 158 103 57 34 12 56 29 21 22 15 69 131 61 64 8 100 104 95 34 39 102 1 43 144 129 56 83 124 118 75 39 38 108 4 30 15 22 61 15 126 89 146 15 18 12 87 100 47 17 5 67 99 12 6 14 44 92 63 114 72 8...

result:

ok ok (4 test cases)

Test #24:

score: 0
Accepted
time: 74ms
memory: 10664kb

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 23 61 20 1 56 35 11 4 57 3 11 60 9 14 7 24 17 14 85 33 12 45 53 20 21 14 54 6 63 10 12 1 75 6 12 55 53 5 5 45 79 23 61 26 24 16 8 56 50 15 85 21 4 15 35 1 5 8 79 47 44 21 28 13 52 23 36 50 24 75 55 13 9 35 11 45 20 36 17 23 29 15 59 16 12 22 56 3 36 29 37 52 20 29 2 51 29 55 23 39 29 11 1 27 3...

result:

ok ok (4 test cases)

Test #25:

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

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 10 27 74 8 6 76 11 14 38 69 12 45 77 24 117 5 30 113 14 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 35 84 82 7 91 22 25 ...

result:

ok ok (10 test cases)

Test #26:

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

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 94 96 8 94 26 65 29 75 56 52 98 33 6 17 86 90 77 50 58 100 86 98 6 14 68 21 88 88 36 4 22 46 27 93 23 29 71 30 4 65 40 52 26 6 9 63 57 17 33 6 58 114 38 64 1 42 30 16 31 9 28 46 70 42 21 103 62 3 110 123 40 114 101 56 12 2 10 35 69 79 21 26 61 51 17 38 5 74 7 20 62 78 83 98 58 2 26 26 23 46...

result:

ok ok (10 test cases)

Test #27:

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

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 100 86 3 38 81 35 95 19 61 56 1 29 66 64 22 80 37 16 23 50 83 96 86 42 60 104 20 89 21 24 1 35 37 95 87 57 91 12 30 21 35 59 90 37 20 47 84 32 14 113 95 23 35 117 26 61 27 28 12 97 6 54 71 27 21 25 30 48 119 13 41 23 30 17 56 74 12 67 96 43 95 51 43 76 36 33 13 85 83 60 46 ...

result:

ok ok (10 test cases)

Test #28:

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

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 2 103 24 53 9 16 78 52 83 23 28 59 54 81 3 25 111 40 78 43 62 49 111 52 20 21 63 39 24 15 14 74 86 8 75 46 47 64 78 56 26 26 31 39 48 51 71 90 6 50 12 77 22 76 43 6 86 50 43 35 14 90 68 87 37 69 22 23 64 43 76 56 74 36 60 44 90 7 44 135 43 20 26 34 19 89 34 93 88 2 17 37 2 1 65 85 45 48 100...

result:

ok ok (10 test cases)

Test #29:

score: 0
Accepted
time: 77ms
memory: 6816kb

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 8 6 58 48 28 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 65 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: 72ms
memory: 6464kb

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 2 32 2 47 23 43 55 65 1 12 57 79 68 20 54 66 31 57 39 34 15 42 37 27 87 56 7 64 13 22 13 44 70 69 17 25 57 5 72 95 46 26 23 111 15 72 55 1 23 63 37 59 2 10 84 41 14 77 78 18 86 32 49 4 48 22 88 46 55 77 64 4 29 30 58 36 72 104 104 2 117 41 51 18 70 105 41 61 7 13 49 41 38 79 8 46 1...

result:

ok ok (10 test cases)

Test #31:

score: 0
Accepted
time: 74ms
memory: 6876kb

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 15 24 13 6 17 11 58 27 6 36 23 13 26 2 17 42 32 28 11 16 3 7 21 5 8 59 5 3 64 10 4 12 27 62 37 26 47 1 1 32 1 43 51 16 52 50 32 48 35 26 31 19 24 15 1 4 21 31 37 49 34 20 20 3 5 16 10 17 11 11 2 47 26 1 15 1 45 11 9 1 49 37 42 39 1 26 6 30 31 11 31 18 3 50 20 16 2 31 1 22 12 3 41 17 33 13 9 7 ...

result:

ok ok (10 test cases)

Test #32:

score: 0
Accepted
time: 68ms
memory: 6288kb

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 9 34 12 31 15 70 47 40 26 7 50 91 24 18 55 58 54 38 5 94 23 54 9 8 6 75 102 43 58 41 37 56 5 65 78 53 63 12 4 13 13 37 64 81 16 38 3 62 1 30 86 31 31 4 86 53 17 51 10 31 87 17 12 96 5 25 46 38 29 58 76 71 19 1 13 18 15 74 1 49 8 18 48 5 53 61 4 33 75 44 29 10 1 5 1 60 22 25 82 24 12 8 51 29 39...

result:

ok ok (10 test cases)

Test #33:

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

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 8 1 8 13 15 17 1 19 41 9 28 34 43 37 7 16 20 54 6 8 45 24 24 1 15 20 16 32 14 1 15 28 10 25 37 3 44 26 35 51 48 1 2 4 1 45 12 31 13 16 49 21 2 35 20 32 65 43 18 38 3 7 26 41 25 9 6 12 49 39 20 36 31 1 39 24 4 17 1 8 15 38 12 20 3 12 56 4 7 42 38 5 23 1 28 24 14 42 51 19 30 10 26 2 16 39 53 1 2...

result:

ok ok (40 test cases)

Test #34:

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

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 26 18 29 3 7 7 15 1 25 6 3 43 12 31 13 23 9 31 22 9 9 19 17 4 21 32 29 1 6 2 1 1 13 3 3 26 1 9 39 7 17 39 25 9 6 17 26 6 19 1 1 23 20 2 15 11 9 10 29 1 15 4 7 12 16 1 12 23 6 3 5 4 11 11 34 1 10 1 19 7 25 18 6 8 4 19 27 24 1 1 9 7 8 38 21 1 25 6 1 12 1 14 44 9 5 33 5 27 14 4 28 4 19 13 1 8 ...

result:

ok ok (40 test cases)

Test #35:

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

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 29 43 48 37 8 10 8 29 8 4 1 28 27 9 5 33 8 13 6 45 1 6 3 59 7 27 17 39 43 21 9 11 13 8 13 30 55 31 61 31 3 29 3 45 53 19 32 12 32 25 16 5 3 48 15 11 49 5 28 9 5 34 46 36 43 26 6 20 9 5 52 38 36 8 44 41 30 25 22 24 23 21 25 47 19 35 27 70 12 3 2 4 23 55 40 5 37 37 3 5 9 17 20 22 35 20 40 1...

result:

ok ok (40 test cases)

Test #36:

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

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 6 19 10 14 12 17 22 17 13 16 11 11 20 8 1 16 19 7 3 7 7 11 9 6 2 14 19 8 11 7 23 14 7 1 2 2 20 6 16 5 19 9 11 1 5 21 5 31 19 1 7 1 4 8 19 16 5 12 15 1 1 5 4 19 22 13 16 3 31 6 4 9 4 9 11 14 8 10 33 5 4 1 15 23 9 22 22 11 19 14 18 4 4 5 20 8 24 9 19 11 16 10 5 2 1 15 23 2 17 32 13 3 14 5 1...

result:

ok ok (40 test cases)

Test #37:

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

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 3 34 30 7 6 19 41 21 11 9 2 16 10 22 6 31 8 23 3 8 1 11 7 20 3 5 31 27 13 37 6 37 29 45 16 7 33 7 15 27 32 38 54 52 19 15 23 3 17 9 21 34 13 13 21 1 4 1 24 12 2 24 21 27 13 20 18 17 31 16 53 49 12 6 16 21 5 6 18 2 16 6 7 11 8 46 24 13 18 34 23 11 24 27 17 6 10 8 14 26 26 32 46 4 21 12 2 29 4 4...

result:

ok ok (40 test cases)

Test #38:

score: 0
Accepted
time: 68ms
memory: 4432kb

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 9 1 35 35 1 10 1 15 15 8 13 38 45 25 7 17 8 43 4 2 11 43 21 8 2 22 23 7 4 44 18 25 21 35 8 45 33 13 9 18 36 31 38 11 2 6 14 1 4 3 33 20 5 15 19 21 23 45 11 33 40 22 26 37 11 14 38 7 8 22 27 38 7 23 18 50 40 14 22 14 3 2 3 30 16 49 45 38 20 19 41 35 3 11 44 14 24 12 18 1 2 6 9 19 12 30 21 1 15 ...

result:

ok ok (40 test cases)

Test #39:

score: 0
Accepted
time: 73ms
memory: 4676kb

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 42 42 37 6 22 7 12 44 39 45 19 5 13 66 13 14 23 33 35 15 9 17 10 15 22 35 28 59 38 38 5 5 41 28 1 43 14 45 25 17 24 48 3 29 41 20 12 47 27 24 30 49 11 2 26 12 47 55 4 5 21 5 25 6 5 8 4 2 9 21 42 44 32 23 31 27 5 4 4 42 24 26 39 9 4 1 29 13 19 17 11 5 55 23 17 21 28 9 21 21 36 56 61 19 63 38...

result:

ok ok (40 test cases)

Test #40:

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

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 7 15 10 18 23 10 16 1 23 19 9 34 4 33 18 15 13 19 10 12 24 36 30 31 11 2 54 25 45 2 17 21 14 1 16 6 19 16 50 10 53 40 9 4 12 21 19 3 17 29 1 42 8 17 19 6 17 4 28 20 39 3 15 1 36 44 1 7 2 14 10 18 46 21 33 32 3 7 18 4 2 8 1 17 3 18 22 8 22 42 31 4 20 10 11 6 18 16 2 3 27 26 15 41 34 47 ...

result:

ok ok (40 test cases)

Test #41:

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

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 12 1 7 8 1 1 1 5 1 1 6 1 14 1 15 11 1 3 1 10 1 10 1 15 5 10 1 7 1 1 1 18 1 6 7 5 6 16 1 1 1 1 1 1 13 4 11 4 6 12 1 1 15 6 1 6 13 11 1 4 6 1 11 5 1 1 5 3 9 8 11 1 8 7 1 10 1 6 6 4 16 1 1 6 10 1 13 1 5 1 12 8 9 12 8 10 10 1 4 1 1 4 9 4 1 10 7 6 3 4 1 1 1 1 9 5 5 2 1 2 9 1 1 5 14 8 5 13 7 3 1 1 1...

result:

ok ok (100 test cases)

Test #42:

score: 0
Accepted
time: 70ms
memory: 4292kb

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 19 6 9 27 18 5 8 27 13 26 2 8 6 22 1 17 24 11 9 9 2 21 7 1 27 22 7 14 10 1 39 27 6 10 29 3 23 1 4 27 14 13 20 3 18 5 2 18 35 1 12 3 11 13 33 23 22 41 1 11 23 18 5 27 1 5 26 4 6 10 21 23 19 4 3 3 3 28 26 28 24 9 38 9 9 20 18 27 1 1 7 15 11 14 3 23 24 12 5 22 24 10 17 4 40 33 12 11 15 20 1...

result:

ok ok (100 test cases)

Test #43:

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

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 21 4 23 40 25 1 6 18 5 1 5 1 26 33 5 35 9 1 34 6 6 8 19 6 29 3 9 13 12 33 33 12 7 12 10 2 27 23 2 10 16 29 8 10 4 23 4 24 6 39 5 5 4 15 8 6 35 12 11 1 3 7 10 14 15 16 3 10 14 11 25 8 36 26 21 5 11 26 3 7 28 7 15 23 30 8 18 6 24 24 25 25 6 40 24 12 39 5 4 3 34 42 16 21 10 20 20 13 10 22 1 12 21...

result:

ok ok (100 test cases)

Test #44:

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

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 14 10 9 2 18 19 1 8 18 3 1 4 18 14 7 22 13 17 3 11 29 8 17 27 27 3 11 11 8 21 34 20 2 15 7 2 21 1 30 3 1 22 10 6 15 8 2 4 5 1 1 15 22 17 4 16 30 10 11 15 4 1 11 4 10 27 17 10 7 14 9 3 6 25 1 6 12 8 10 12 12 16 12 14 24 9 22 9 2 9 16 11 1 7 15 14 9 39 9 15 6 6 5 3 24 1 1 15 19 6 5 13 14 3 ...

result:

ok ok (100 test cases)

Test #45:

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

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 9 6 7 6 34 9 1 7 2 5 21 18 6 4 15 35 16 10 1 33 10 10 15 7 14 17 6 24 8 3 10 3 2 3 6 22 5 23 8 7 12 33 30 13 3 39 15 6 11 1 11 11 26 6 15 25 17 9 11 19 30 21 14 14 27 29 17 4 9 19 3 20 4 15 5 23 19 7 9 1 8 22 19 17 9 31 36 40 3 31 13 32 13 28 33 26 6 17 14 6 41 19 4 8 1 16 16 16 10 35 1 22 ...

result:

ok ok (100 test cases)

Test #46:

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

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 7 1 14 6 1 10 15 7 9 4 8 5 1 8 1 3 11 5 14 19 20 13 8 12 4 1 3 4 3 1 1 5 1 1 18 4 7 11 5 14 4 9 1 2 1 2 19 4 7 2 7 8 1 1 8 10 1 11 13 3 8 4 6 1 6 8 6 10 17 5 4 11 1 5 16 7 5 8 8 2 2 15 4 7 10 4 9 7 6 16 7 1 12 1 4 5 3 3 6 6 1 5 3 1 1 13 8 7 9 4 8 7 2 9 5 9 5 2 12 16 1 9 4 7 7 9 4 14 5 6 1 1 11...

result:

ok ok (100 test cases)

Test #47:

score: 0
Accepted
time: 68ms
memory: 3984kb

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 20 18 25 16 35 28 32 9 28 22 11 1 23 6 6 31 14 2 14 16 5 21 5 6 18 26 14 11 17 34 10 2 12 19 12 27 21 12 33 1 8 19 1 4 12 31 31 5 3 23 1 10 7 22 1 1 30 18 9 1 28 33 3 9 4 25 11 22 6 13 19 18 4 4 20 20 13 37 33 22 20 26 34 21 2 13 5 1 7 14 6 10 28 8 19 15 10 24 3 7 26 18 7 10 1 3 2...

result:

ok ok (100 test cases)

Test #48:

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

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 6 8 26 4 7 11 16 12 24 31 3 2 11 29 8 27 23 14 16 9 29 6 15 18 13 41 18 14 34 9 28 38 7 10 9 2 25 20 44 33 37 3 9 23 4 9 8 3 36 27 14 1 8 5 34 1 18 14 26 29 24 1 43 1 40 11 5 14 32 19 24 12 15 12 13 11 25 23 20 9 20 1 11 4 38 32 31 28 17 47 9 9 30 7 25 30 3 16 5 6 1 9 1 9 39 29 25 ...

result:

ok ok (100 test cases)

Test #49:

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

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 1 2 1 10 5 3 11 2 7 1 1 5 4 1 8 4 11 4 5 7 5 1 4 3 7 5 1 1 3 9 2 3 5 11 1 5 9 1 3 4 1 4 1 6 7 1 4 11 1 7 1 1 7 10 3 5 7 8 10 11 1 2 1 1 1 2 1 6 8 3 3 1 2 4 1 1 17 1 6 2 1 4 1 8 1 8 6 9 1 1 1 1 1 4 13 10 7 2 1 3 2 7 2 2 1 4 1 8 1 5 3 4 6 1 1 1 12 9 2 3 10 1 1 1 2 1 2 5 2 8 1 1 1 2 5 13 1 9 7 3 ...

result:

ok ok (400 test cases)

Test #50:

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

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 5 1 1 3 10 5 3 1 4 13 22 2 11 6 10 10 1 11 7 4 2 4 6 1 9 5 1 12 1 11 21 7 4 5 7 1 9 3 1 9 1 5 10 5 4 1 5 12 5 7 7 11 11 4 6 12 3 1 7 2 9 6 1 15 11 10 1 1 4 1 8 1 1 10 7 3 5 3 16 6 1 16 7 4 1 3 1 9 18 1 1 3 1 6 4 6 8 10 5 7 4 3 18 1 13 1 1 1 12 1 1 9 1 11 9 4 13 5 9 2 6 11 10 1 17 3 11 5 5...

result:

ok ok (400 test cases)

Test #51:

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

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 2 6 1 2 7 1 2 1 4 5 5 2 5 4 16 8 1 13 11 4 1 2 3 4 10 7 2 7 1 11 10 6 10 2 2 8 4 3 10 11 18 11 9 3 2 7 12 9 2 7 6 5 6 2 5 5 1 2 4 9 1 20 1 3 5 8 2 5 14 6 5 15 2 9 1 9 14 1 7 14 8 15 5 1 4 7 18 1 3 6 3 6 18 2 10 6 4 11 8 1 6 7 1 7 18 13 4 2 18 9 4 7 5 4 3 5 7 17 20 1 13 2 19 12 3 10 4 11 4...

result:

ok ok (400 test cases)

Test #52:

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

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 4 4 10 4 13 3 7 3 4 3 2 4 3 6 11 5 6 11 2 17 7 7 9 4 4 5 4 6 7 1 1 6 10 5 1 8 4 7 11 11 2 4 4 15 3 9 8 1 6 11 6 2 2 10 8 6 3 2 2 1 1 3 8 3 15 10 11 2 1 9 10 12 7 11 4 1 5 4 9 6 19 16 4 3 8 9 5 3 4 14 16 3 3 6 10 14 7 3 3 10 10 10 2 3 4 1 1 4 8 5 5 3 14 1 9 1 3 2 2 4 1 12 7 6 7 1 1 10 6 5 2 ...

result:

ok ok (400 test cases)

Test #53:

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

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 1 4 14 1 1 8 9 5 1 7 2 2 5 1 10 2 7 1 1 1 7 17 3 18 1 1 7 3 12 1 11 9 8 2 6 1 16 13 13 6 1 2 12 1 2 10 1 1 13 13 2 1 1 5 1 1 6 5 8 9 1 6 4 15 9 1 9 1 1 16 1 13 1 1 15 2 1 6 7 1 1 13 5 12 8 3 6 1 11 1 1 4 6 1 10 16 1 12 1 6 1 1 6 1 13 1 4 1 2 2 6 4 5 1 7 4 1 5 3 1 7 7 15 5 5 1 1 1 3 1 6 5 5 10 ...

result:

ok ok (1000 test cases)

Test #54:

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

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: 66ms
memory: 3660kb

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: 67ms
memory: 3668kb

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 6 5 2 6 8 10 3 9 1 1 1 6 11 8 1 3 1 7 5 6 1 6 1 1 3 4 3 3 6 7 6 5 2 2 1 4 7 6 4 2 3 4 8 3 1 2 9 4 1 12 1 1 3 2 9 6 2 3 1 4 9 7 3 2 2 1 2 7 3 9 4 1 2 1 2 5 6 2 3 4 6 4 9 2 6 8 8 1 6 8 1 7 1 11 7 10 5 6 3 6 1 6 5 3 1 4 1 8 5 5 5 5 6 11 6 1 6 5 5 4 2 11 9 2 9 8 8 2 2 5 4 2 4 5 7 10 12 4 5 8 1 5...

result:

ok ok (1000 test cases)

Test #57:

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

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 3 2 7 1 2 1 3 1 1 1 3 1 1 1 2 2 7 5 2 3 1 2 7 1 2 2 2 4 5 3 2 1 3 7 2 2 1 6 2 1 1
No
Yes
1 7 1 1 1 1 6 1 3 4 6 6 1 3 3 5 6 1 1 1 2 5 2 2 2 4 3 2 4 3 3 4 1 1 2 3 2 6 1 1 3 1 2 2 8 3 3 4 2 1
No
Yes
1 1 1 4 3 2 1 6 3 3 2 1 3 1 1 6 1 4 1 3 1 2 1 2 3 3 4 3 1 1 3 3 3 3 1 3 4 1 1 1 2 1 2 1 2 ...

result:

ok ok (4000 test cases)

Test #58:

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

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 1 3 3 5 3 1 6 4 2 2 1 1 1 1 4 1 2 3 1 3 1 5 1 1 5 2 2 5 1 1 6 5 5 1 7 3 1 1 1 2 6 4 3 6 2 5 1 1 1
Yes
1 5 2 1 3 1 1 1 9 1 8 3 5 1 6 1 5 1 1 1 1 3 6 1 1 10 1 1 3 9 5 1 1 1 1 2 6 2 1 2 5 3 1 1...

result:

ok ok (4000 test cases)

Test #59:

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

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 1 1 1 4 2 1 2 5 6 2 1 5 1 1 6 7 1 1 1 1 3 1 1 5 7 6 1 2 2 8 1 1 3 1 2 1 1 4 2 2 1 4 5 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 1 5 1 1 5 1 2 2 1 3 7 7 2 1 1 1 1 2 8 1 3 3 2 4 1 1 2 1 2 1 5 3 4 2 6 5 1 6 5 6 2 1...

result:

ok ok (4000 test cases)

Test #60:

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

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 1 3 2 2 6 3 3 3 2 4 1 2 2 3 2 3 2 1 3 4 1 1 3 3 3 1 1 1 1 5 1 1 5 1 3 1 1 2 3 2 2 1 2 1 5 1
No
No
Yes
1 1 6 10 1 3 6 2 5 3 1 4 1 5 2 2 2 3 6 1 1 1 1 1 2 1 1 10 2 9 1 1 5 9 1 7 4 1 10 1 5 2 1 8 1 6 3 4 3 1
Yes
1 2 5 2 2 4 1 4 3 3 1 2 1 2 1 4 3 2 4 4 2 3 2 4 3 1 2 1 4 2 1 1 1 2 1 3 2 2 1 4...

result:

ok ok (4000 test cases)

Extra Test:

score: 0
Extra Test Passed