QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#694911#4989. Berry BattleZhaoZiLongAC ✓116ms25268kbC++231.4kb2024-10-31 18:56:082024-10-31 18:56:14

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3784kb

input:

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

output:

YES
7 10 3 2 4 9 1 5 8 6 

result:

ok 

Test #2:

score: 0
Accepted
time: 1ms
memory: 3620kb

input:

3
1 2
2 3

output:

NO

result:

ok 

Test #3:

score: 0
Accepted
time: 1ms
memory: 3572kb

input:

3
1 3
3 2

output:

NO

result:

ok 

Test #4:

score: 0
Accepted
time: 1ms
memory: 3864kb

input:

4
2 4
4 1
3 4

output:

NO

result:

ok 

Test #5:

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

input:

5
5 3
2 1
4 5
3 1

output:

YES
5 4 3 1 2 

result:

ok 

Test #6:

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

input:

6
1 2
6 5
5 2
3 4
4 2

output:

YES
5 6 2 1 4 3 

result:

ok 

Test #7:

score: 0
Accepted
time: 1ms
memory: 3868kb

input:

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

output:

YES
10 1 9 6 7 4 5 8 2 3 

result:

ok 

Test #8:

score: 0
Accepted
time: 1ms
memory: 3572kb

input:

100
42 8
32 6
92 57
47 76
69 34
24 20
61 57
22 10
18 26
89 64
13 76
38 34
23 34
54 69
88 26
66 95
34 2
93 80
77 56
96 10
44 91
86 1
90 26
19 56
30 10
4 30
45 6
8 34
17 37
97 73
67 19
58 65
75 74
39 20
57 71
53 45
25 90
51 1
79 22
55 54
15 76
74 11
70 2
95 34
60 25
91 34
48 58
16 57
64 76
37 11
40 9
...

output:

YES
99 91 94 44 34 46 98 69 38 23 2 8 95 54 50 81 35 70 71 80 20 42 66 55 11 57 1 93 24 39 26 6 59 84 49 74 37 14 92 61 16 31 86 51 73 78 63 83 18 88 90 32 45 75 17 52 82 7 28 9 97 65 76 3 25 33 27 36 53 40 68 58 47 13 15 64 60 62 5 10 48 29 87 89 85 22 96 30 79 56 41 4 21 72 77 19 12 43 67 100 

result:

ok 

Test #9:

score: 0
Accepted
time: 1ms
memory: 3876kb

input:

200
16 122
183 100
132 29
72 90
127 78
31 151
133 8
161 93
49 103
131 113
121 59
60 15
44 183
130 105
155 170
192 191
156 167
95 85
163 77
154 41
199 101
103 158
20 68
54 2
114 50
167 128
149 166
21 141
119 110
170 73
63 19
33 154
120 124
151 113
26 187
15 112
91 83
70 194
51 197
116 6
176 158
175 1...

output:

YES
197 51 54 112 2 15 177 60 145 109 110 158 139 141 119 25 103 176 21 90 106 49 56 72 19 53 166 83 63 142 149 91 133 42 194 8 178 136 70 108 87 165 173 12 164 11 22 58 79 36 143 50 170 114 155 73 153 24 27 45 188 93 47 140 189 161 92 88 185 135 144 71 18 122 4 98 16 40 1 23 129 17 160 118 65 157 1...

result:

ok 

Test #10:

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

input:

200
56 198
56 128
56 76
56 90
56 155
56 32
56 55
56 1
56 83
56 59
56 133
56 115
56 30
56 131
56 40
56 177
56 166
56 63
56 104
56 13
56 164
56 152
56 47
56 38
56 127
56 199
56 145
56 20
56 36
56 46
56 137
56 190
56 146
56 183
56 187
56 6
56 194
56 77
56 160
56 138
56 149
56 64
56 100
56 117
56 27
56 ...

output:

NO

result:

ok 

Test #11:

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

input:

200
3 138
3 187
3 13
3 36
3 26
3 59
3 69
3 54
3 27
3 154
3 82
3 132
3 161
3 101
3 198
3 6
3 193
3 169
3 60
3 85
3 166
3 57
3 28
3 163
3 89
3 93
3 135
3 16
3 125
3 62
3 71
3 150
3 2
3 21
3 127
3 121
3 95
3 39
3 179
3 90
3 98
3 104
3 182
3 103
3 177
3 174
3 172
3 49
3 88
3 178
3 51
3 200
3 159
3 48
3 ...

output:

YES
177 112 3 138 187 13 36 26 59 69 54 27 154 82 132 161 101 198 6 193 169 60 85 166 57 28 163 89 93 135 16 125 62 71 150 2 21 127 121 95 39 179 90 98 104 182 103 174 172 49 88 178 51 200 159 48 155 32 151 114 147 157 107 19 64 80 15 105 199 165 130 22 66 68 164 52 183 194 8 77 31 9 111 190 133 118...

result:

ok 

Test #12:

score: 0
Accepted
time: 106ms
memory: 22232kb

input:

300000
114853 264153
298031 43573
189277 96893
68911 129144
83395 244009
1019 185588
39660 143053
246340 144880
244223 132708
152084 27057
230030 57377
141813 235567
64190 230887
105772 151822
258236 227531
184923 92096
66128 16467
199270 173492
78538 249107
232394 197343
268822 246960
281154 197354...

output:

YES
300000 142035 228685 215522 231089 112735 207974 209654 25433 87435 188656 255567 185401 65560 95870 1573 113321 114733 276598 205655 159289 17673 116112 279434 235383 140576 141681 115286 70530 269909 246412 298557 35032 132054 210423 221605 106063 255268 123074 81389 194041 120680 192820 7673 ...

result:

ok 

Test #13:

score: 0
Accepted
time: 96ms
memory: 22336kb

input:

300000
37117 223947
199643 280354
274799 172294
226464 27333
43649 32485
130021 84630
70467 44592
112478 126488
133072 64293
271409 15857
288456 210421
139805 140
162685 49229
14096 273871
55693 11924
137750 93654
255246 78666
132904 163741
50059 8408
121274 230817
269075 125691
270537 260948
277126...

output:

YES
299998 268271 29744 197911 258207 223094 248203 226340 240629 67173 139467 25084 260772 234963 26932 48534 13868 217983 149586 17610 188562 97949 98198 225385 4383 60629 186521 220480 265536 26787 182604 212458 239228 231537 210185 159092 42533 55761 252909 238792 165550 231547 158601 72523 2206...

result:

ok 

Test #14:

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

input:

300000
268783 101895
27590 114760
14864 171076
137533 59382
133722 236003
277744 187278
189110 80196
260321 229396
293370 59604
66690 46811
188856 113279
158853 279087
234008 145840
62098 148819
90304 135703
264489 61055
1527 291426
228720 253339
128391 282367
230693 36857
134937 283157
178978 28302...

output:

YES
300000 39234 119013 220895 187858 78620 242575 242505 56514 76321 100865 110291 239481 176914 93553 12989 169345 201276 30218 56106 58431 229401 142190 126734 232168 193888 251431 89949 32532 98026 158458 198041 38599 143684 127527 139869 199101 39036 111353 154425 156614 188275 197047 41225 476...

result:

ok 

Test #15:

score: 0
Accepted
time: 112ms
memory: 22136kb

input:

300000
150950 267369
289017 3183
121065 253781
250699 196624
166248 1258
62584 164129
74238 205040
69940 242240
206512 45807
237009 152011
106234 113446
262178 6360
11915 293426
240715 210047
155609 91195
5698 108687
52572 64202
259254 131021
23340 3637
101657 75893
50362 114481
46841 259603
92022 2...

output:

YES
300000 126252 220988 109947 294352 139184 241911 274535 190785 168516 84781 76844 138216 79549 98719 94760 129832 250097 15890 236842 228501 253820 199446 41952 93292 28 116595 48410 176156 240498 37215 295628 55722 78104 130230 191575 239213 212691 179581 297969 221759 12686 234977 65615 119552...

result:

ok 

Test #16:

score: 0
Accepted
time: 96ms
memory: 22032kb

input:

300000
49709 89567
116527 61741
285831 50661
101522 82524
53092 66068
86222 189736
218043 73160
13162 26534
168441 105087
11975 25881
90532 14377
232905 194513
267892 122922
272020 12435
149258 264534
123074 211569
169040 7735
137914 80789
257276 127051
35078 31990
179149 44365
178698 23293
114696 1...

output:

YES
300000 137237 174878 68695 133686 243953 114330 104773 202523 106441 182931 224639 20391 104803 203643 288617 111278 48614 183157 142643 255104 269532 225801 162172 190523 17711 21792 213183 227919 189290 96550 81097 11533 179617 196463 67346 269099 151294 119008 3110 132511 192708 32902 74868 1...

result:

ok 

Test #17:

score: 0
Accepted
time: 111ms
memory: 21984kb

input:

300000
11520 95384
25302 98828
47757 177418
33783 201064
249009 132959
160957 223098
69371 147959
297586 265064
111848 112
54402 243987
221427 176478
78297 103877
283871 164241
278667 280291
165910 63063
263388 174421
236875 249121
49837 32872
185947 118645
298053 206918
282114 120453
169448 108351
...

output:

YES
300000 169329 234218 31965 258192 9383 2504 280600 58837 72371 59479 24727 169853 13568 208905 221996 210034 131261 55503 185063 141589 226333 45176 20976 276434 6142 210752 147853 178023 155951 162931 28571 250238 219647 70739 253149 44143 256826 73195 207928 281771 277501 139080 171361 98344 1...

result:

ok 

Test #18:

score: 0
Accepted
time: 116ms
memory: 21880kb

input:

300000
266316 130154
271618 232285
202160 263507
132088 15648
107605 189613
287651 88616
182956 80933
93644 64472
151741 159119
156651 146038
95404 292422
197240 139293
193081 296605
286792 1138
90636 95542
221620 185379
21658 170349
261710 33666
32379 29518
47764 23367
137414 92197
292446 226026
28...

output:

YES
300000 134999 152127 61839 87482 194409 9760 22955 178287 135185 187169 83905 202541 44140 82227 73872 42794 97695 48663 149259 14195 248602 128879 229916 20634 226212 69747 50966 97473 168405 232577 30589 266392 52104 60299 109587 75425 249785 256644 26071 131046 145844 167001 162405 40580 2076...

result:

ok 

Test #19:

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

input:

300000
12780 264648
12780 121374
12780 42008
12780 95697
12780 976
12780 177512
12780 106434
12780 278098
12780 140080
12780 110499
12780 295006
12780 235728
12780 299674
12780 116423
12780 279890
12780 244785
12780 180340
12780 197080
12780 103638
12780 7503
12780 151147
12780 87425
12780 247699
12...

output:

NO

result:

ok 

Test #20:

score: 0
Accepted
time: 81ms
memory: 25256kb

input:

300000
299736 96862
299736 241034
299736 200539
299736 117184
299736 262455
299736 285421
299736 289066
299736 110126
299736 121907
299736 159583
299736 35052
299736 225040
299736 83339
299736 44763
299736 139926
299736 1418
299736 131518
299736 166271
299736 274471
299736 296220
299736 146978
29973...

output:

YES
299736 52829 96862 241034 200539 117184 262455 285421 289066 110126 121907 159583 35052 225040 83339 44763 139926 1418 131518 166271 274471 296220 146978 201085 161544 162910 109976 249870 44208 22149 66753 287 90379 15531 249789 89351 26074 4544 196109 121259 107632 60995 83160 151863 297212 15...

result:

ok 

Test #21:

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

input:

300000
279101 105712
279101 249105
279101 112302
279101 17133
279101 30550
279101 152384
279101 275247
279101 159978
279101 40600
279101 248027
279101 133490
279101 130020
279101 127010
279101 111540
279101 121005
279101 150446
279101 107171
279101 215779
279101 13025
279101 132710
279101 39038
2791...

output:

YES
299551 261640 279101 105712 249105 112302 17133 30550 152384 275247 159978 40600 248027 133490 130020 127010 111540 121005 150446 107171 215779 13025 132710 39038 122982 44159 200125 180086 32840 251507 240864 55779 159975 37848 8418 237512 284840 146723 12038 291415 121661 166956 133006 55031 1...

result:

ok 

Test #22:

score: 0
Accepted
time: 1ms
memory: 3580kb

input:

200
107 93
93 144
107 70
93 23
107 162
93 3
107 174
93 26
107 195
93 101
107 126
93 55
107 183
93 74
107 59
93 76
107 118
93 38
107 54
93 29
107 61
93 152
107 125
93 122
107 192
93 85
107 77
93 25
107 133
93 123
107 87
93 172
107 71
93 167
107 60
93 120
107 184
93 68
107 104
93 80
107 95
93 96
107 1...

output:

YES
107 43 93 70 162 174 195 126 183 59 118 54 61 125 192 77 133 87 71 60 184 104 95 157 106 170 200 141 33 108 191 128 62 89 145 164 158 66 57 119 79 111 199 142 78 127 69 138 140 185 135 134 72 137 196 53 124 22 159 88 90 193 63 98 19 17 110 105 4 197 92 28 173 81 58 36 177 147 82 14 7 143 56 13 8...

result:

ok 

Test #23:

score: 0
Accepted
time: 1ms
memory: 3632kb

input:

200
12 102
102 116
12 105
102 174
12 133
102 144
12 108
102 13
12 151
102 110
12 91
102 162
12 98
102 38
12 149
102 74
12 47
102 190
12 10
102 175
12 186
102 153
12 85
102 199
12 36
102 29
12 147
102 1
12 152
102 45
12 11
102 84
12 146
102 119
12 179
102 7
12 32
102 53
12 9
102 118
12 141
102 177
12...

output:

YES
164 30 102 12 116 174 144 13 110 162 38 74 190 175 153 199 29 1 45 84 119 7 53 118 177 70 39 34 176 124 197 139 182 68 3 125 33 59 112 49 188 20 195 18 19 27 113 156 193 187 16 37 87 57 173 148 142 120 181 183 126 111 65 21 64 78 79 159 24 44 166 50 122 46 123 83 100 17 80 6 160 107 168 150 143 ...

result:

ok 

Test #24:

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

input:

300000
90531 114135
114135 178759
90531 123121
114135 161955
90531 120679
114135 205637
90531 97753
114135 97745
90531 46366
114135 13177
90531 232931
114135 139366
90531 180616
114135 72520
90531 287031
114135 14029
90531 45741
114135 288828
90531 111901
114135 63091
90531 83073
114135 77690
90531 ...

output:

YES
114135 122791 90531 178759 161955 205637 97745 13177 139366 72520 14029 288828 63091 77690 103605 103183 173523 42126 159520 83592 57568 264782 200814 49371 170511 120500 136761 200695 241305 258655 82396 295610 27724 38470 165304 186031 163560 258483 138043 129855 239205 90783 173975 54281 2951...

result:

ok 

Test #25:

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

input:

300000
141727 171472
171472 62588
141727 30250
171472 267034
141727 37741
171472 141522
141727 159683
171472 256922
141727 241118
171472 153803
141727 18425
171472 172334
141727 124007
171472 13772
141727 10366
171472 213390
141727 173862
171472 77299
141727 218798
171472 122799
141727 34360
171472 ...

output:

YES
271997 280144 141727 171472 30250 37741 159683 241118 18425 124007 10366 173862 218798 34360 209593 157151 193432 15170 79227 37368 36257 199100 276245 183612 39629 169827 1504 204165 84335 249762 36927 263961 186411 14727 112876 21614 173458 238748 279030 186351 78546 80432 98056 272213 116606 ...

result:

ok 

Test #26:

score: 0
Accepted
time: 1ms
memory: 3616kb

input:

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

output:

YES
9 7 1 8 10 3 5 4 6 2 

result:

ok 

Test #27:

score: 0
Accepted
time: 28ms
memory: 9560kb

input:

100000
4758 24995
70871 48101
57182 14922
78150 88326
5931 79858
4301 85469
17851 58413
60571 32187
75364 94152
24329 33975
99469 3833
26334 70008
78549 7447
9947 73063
18450 61713
24760 56646
9992 98945
34938 175
81746 41108
46227 77863
94891 10911
39706 67754
73219 55460
81410 3578
43031 14828
380...

output:

YES
100000 16326 24244 1139 56675 11821 6136 83962 7878 47046 11405 51283 87031 42178 62938 47597 80365 27905 90814 62381 98606 89808 35937 38634 72000 13697 82487 46336 47700 71714 13970 78159 53693 56437 45848 71651 85328 52412 65623 11548 20630 33305 95510 36381 12892 83749 99942 41938 69886 2963...

result:

ok 

Test #28:

score: 0
Accepted
time: 1ms
memory: 3784kb

input:

6
5 3
3 6
5 2
3 4
5 1

output:

YES
5 1 3 2 6 4 

result:

ok 

Test #29:

score: 0
Accepted
time: 1ms
memory: 3568kb

input:

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

output:

YES
5 1 3 7 4 2 8 6 

result:

ok 

Test #30:

score: 0
Accepted
time: 1ms
memory: 3564kb

input:

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

output:

YES
2 7 1 8 5 6 4 3 

result:

ok 

Test #31:

score: 0
Accepted
time: 1ms
memory: 3596kb

input:

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

output:

YES
8 2 5 3 6 7 4 1 

result:

ok 

Test #32:

score: 0
Accepted
time: 1ms
memory: 3864kb

input:

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

output:

YES
4 7 2 3 6 8 5 1 

result:

ok 

Test #33:

score: 0
Accepted
time: 1ms
memory: 3660kb

input:

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

output:

YES
7 2 6 8 3 5 1 4 

result:

ok 

Test #34:

score: 0
Accepted
time: 1ms
memory: 3568kb

input:

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

output:

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

result:

ok 

Test #35:

score: 0
Accepted
time: 1ms
memory: 3512kb

input:

128
53 111
111 61
53 48
111 121
53 32
111 93
53 97
111 19
53 35
111 105
53 8
111 101
53 44
111 94
53 58
111 80
53 16
111 79
53 96
111 88
53 90
111 98
53 55
111 17
53 69
111 40
53 84
111 59
53 126
111 71
53 36
111 47
53 14
111 49
53 77
111 128
53 22
111 20
53 10
111 54
53 95
111 119
53 12
111 64
53 2...

output:

YES
111 6 53 61 121 93 19 105 101 94 80 79 88 98 17 40 59 71 47 49 128 20 54 119 64 56 18 118 104 83 68 70 29 15 63 85 123 4 107 66 78 127 115 122 72 108 38 60 9 33 113 13 42 117 26 120 34 46 109 92 114 3 116 39 51 48 32 97 35 8 44 58 16 96 90 55 69 84 126 36 14 77 22 10 95 12 27 106 124 23 31 67 73...

result:

ok 

Test #36:

score: 0
Accepted
time: 89ms
memory: 23636kb

input:

300000
250443 449
250443 22884
250443 144955
250443 124134
250443 166560
250443 196513
250443 53759
250443 191771
250443 152495
250443 146696
250443 33720
250443 74643
250443 148572
250443 259831
250443 152960
250443 28807
250443 274820
250443 105639
250443 159610
250443 147117
250443 117152
250443 ...

output:

YES
299994 42100 250443 449 22884 144955 124134 166560 196513 53759 191771 152495 146696 33720 74643 148572 259831 152960 28807 274820 105639 159610 147117 117152 149064 232139 259777 223897 68534 296449 254242 277468 216340 235291 236976 97008 174301 109705 7487 164418 205985 230388 183444 8546 223...

result:

ok 

Test #37:

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

input:

4
1 2
3 4
1 4

output:

YES
4 3 1 2 

result:

ok 

Test #38:

score: 0
Accepted
time: 1ms
memory: 3484kb

input:

4
1 3
1 4
3 2

output:

YES
3 2 1 4 

result:

ok 

Test #39:

score: 0
Accepted
time: 1ms
memory: 3556kb

input:

4
1 4
2 3
2 4

output:

YES
4 1 2 3 

result:

ok 

Test #40:

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

input:

4
2 4
1 2
4 3

output:

YES
4 3 2 1 

result:

ok 

Test #41:

score: 0
Accepted
time: 1ms
memory: 3564kb

input:

4
4 3
4 2
1 2

output:

YES
4 3 2 1 

result:

ok 

Test #42:

score: 0
Accepted
time: 1ms
memory: 3780kb

input:

4
2 3
4 2
3 1

output:

YES
3 1 2 4 

result:

ok 

Test #43:

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

input:

4
1 3
2 1
4 2

output:

YES
2 4 1 3 

result:

ok 

Test #44:

score: 0
Accepted
time: 1ms
memory: 3512kb

input:

4
3 2
1 3
4 2

output:

YES
3 1 2 4 

result:

ok 

Test #45:

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

input:

4
4 1
4 3
1 2

output:

YES
4 3 1 2 

result:

ok 

Test #46:

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

input:

5
2 3
5 1
2 4
5 3

output:

YES
5 1 3 2 4 

result:

ok 

Test #47:

score: 0
Accepted
time: 1ms
memory: 3664kb

input:

6
2 5
5 1
3 6
4 6
3 1

output:

YES
6 4 3 1 5 2 

result:

ok 

Test #48:

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

input:

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

output:

YES
7 3 5 2 6 4 1 

result:

ok 

Test #49:

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

input:

4
4 2
2 3
4 1

output:

YES
4 1 2 3 

result:

ok 

Test #50:

score: 0
Accepted
time: 1ms
memory: 3852kb

input:

4
1 4
1 2
3 2

output:

YES
2 3 1 4 

result:

ok 

Test #51:

score: 0
Accepted
time: 1ms
memory: 3568kb

input:

4
1 2
1 4
2 3

output:

YES
2 3 1 4 

result:

ok 

Test #52:

score: 0
Accepted
time: 1ms
memory: 3880kb

input:

4
1 3
1 4
3 2

output:

YES
3 2 1 4 

result:

ok 

Test #53:

score: 0
Accepted
time: 1ms
memory: 3628kb

input:

6
1 2
1 3
1 4
2 5
2 6

output:

YES
2 6 1 5 3 4 

result:

ok 

Test #54:

score: 0
Accepted
time: 1ms
memory: 3788kb

input:

6
1 6
6 5
5 3
4 5
2 6

output:

YES
6 2 1 5 3 4 

result:

ok 

Test #55:

score: 0
Accepted
time: 1ms
memory: 3624kb

input:

6
2 4
4 6
1 3
5 3
4 1

output:

YES
4 6 2 1 3 5 

result:

ok 

Test #56:

score: 0
Accepted
time: 1ms
memory: 3628kb

input:

6
3 4
4 1
2 4
6 3
3 5

output:

YES
4 2 3 1 6 5 

result:

ok 

Test #57:

score: 0
Accepted
time: 1ms
memory: 3624kb

input:

6
1 2
1 3
5 6
5 4
5 1

output:

YES
5 4 6 1 2 3 

result:

ok 

Test #58:

score: 0
Accepted
time: 1ms
memory: 3568kb

input:

6
6 1
6 2
3 4
5 3
6 3

output:

YES
6 2 1 3 4 5 

result:

ok