QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#536144#4578. LabyrinthLavine#AC ✓47ms31876kbC++141.3kb2024-08-28 19:05:452024-08-28 19:05:46

Judging History

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

  • [2024-08-28 19:05:46]
  • 评测
  • 测评结果:AC
  • 用时:47ms
  • 内存:31876kb
  • [2024-08-28 19:05:45]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int n,m,s,f[N],vis[N];
vector<int>e[N],rs1,rs2;
void slv(int x,vector<int>&rs){
    rs.push_back(x);
    if(x==s)return;
    else slv(f[x],rs);
}
void Fin(){
    puts("Possible");
    printf("%d\n",(int)rs1.size());
    for(int i=(int)rs1.size()-1;~i;i--){
        printf("%d%c",rs1[i],(i)? ' ':'\n');
    }
    printf("%d\n",(int)rs2.size());
    for(int i=(int)rs2.size()-1;~i;i--){
        printf("%d%c",rs2[i],(i)? ' ':'\n');
    }
    exit(0);
}
void dfs(int x,int y){
    // printf("___%d %d\n",x,y);
    vis[x]=y;
    for(auto to:e[x]){
        if(to==s)continue;
        else if(vis[to]==y)continue;
        else if(vis[to]){
            // puts("??????");
            rs1.push_back(to);
            slv(x,rs1);
            slv(to,rs2);
            // puts("<<<");
            Fin();
        }else {
            f[to]=x;
            dfs(to,y);
        }
    }
}
int main(){
    scanf("%d %d %d",&n,&m,&s);
    for(int i=1;i<=m;++i){
        int x,y;
        scanf("%d %d",&x,&y);
        e[x].push_back(y);
    }
    for(auto y:e[s]){
        if(vis[y]){
            rs1.push_back(y),rs1.push_back(s);
            slv(y,rs2);
            Fin();
        }
        f[y]=s;
        dfs(y,y);
    }
    puts("Impossible");
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 8568kb

input:

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

output:

Possible
3
1 4 3
3
1 2 3

result:

ok n=5, m=5: possible

Test #2:

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

input:

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

output:

Impossible

result:

ok n=5, m=5: impossible

Test #3:

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

input:

3 3 2
1 2
2 3
3 1

output:

Impossible

result:

ok n=3, m=3: impossible

Test #4:

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

input:

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

output:

Possible
2
1 5
5
1 2 3 4 5

result:

ok n=5, m=5: possible

Test #5:

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

input:

2 2 1
1 2
2 1

output:

Impossible

result:

ok n=2, m=2: impossible

Test #6:

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

input:

2 0 2

output:

Impossible

result:

ok n=2, m=0: impossible

Test #7:

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

input:

2 1 2
2 1

output:

Impossible

result:

ok n=2, m=1: impossible

Test #8:

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

input:

2 2 2
1 2
2 1

output:

Impossible

result:

ok n=2, m=2: impossible

Test #9:

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

input:

3 0 3

output:

Impossible

result:

ok n=3, m=0: impossible

Test #10:

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

input:

3 1 3
3 2

output:

Impossible

result:

ok n=3, m=1: impossible

Test #11:

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

input:

3 2 1
1 2
3 1

output:

Impossible

result:

ok n=3, m=2: impossible

Test #12:

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

input:

3 3 3
2 3
1 2
3 1

output:

Impossible

result:

ok n=3, m=3: impossible

Test #13:

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

input:

3 4 2
3 2
2 1
1 3
2 3

output:

Possible
2
2 3
3
2 1 3

result:

ok n=3, m=4: possible

Test #14:

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

input:

3 5 1
1 3
1 2
2 3
3 1
3 2

output:

Possible
2
1 2
3
1 3 2

result:

ok n=3, m=5: possible

Test #15:

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

input:

4 0 2

output:

Impossible

result:

ok n=4, m=0: impossible

Test #16:

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

input:

4 1 2
3 2

output:

Impossible

result:

ok n=4, m=1: impossible

Test #17:

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

input:

4 2 2
3 2
1 4

output:

Impossible

result:

ok n=4, m=2: impossible

Test #18:

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

input:

4 3 2
4 1
1 3
1 4

output:

Impossible

result:

ok n=4, m=3: impossible

Test #19:

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

input:

4 4 2
4 3
2 1
3 1
1 3

output:

Impossible

result:

ok n=4, m=4: impossible

Test #20:

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

input:

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

output:

Impossible

result:

ok n=4, m=5: impossible

Test #21:

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

input:

5 10 2
2 4
4 1
1 4
4 3
3 5
5 3
2 5
5 2
1 2
1 3

output:

Possible
2
2 5
5
2 4 1 3 5

result:

ok n=5, m=10: possible

Test #22:

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

input:

5 11 2
5 3
3 1
3 5
2 3
4 5
2 1
4 3
4 2
5 1
5 4
1 4

output:

Possible
2
2 1
3
2 3 1

result:

ok n=5, m=11: possible

Test #23:

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

input:

5 12 5
4 5
1 2
5 3
2 1
3 5
5 1
2 4
1 3
2 3
4 2
1 4
2 5

output:

Possible
4
5 1 2 3
2
5 3

result:

ok n=5, m=12: possible

Test #24:

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

input:

5 13 4
4 1
2 1
5 1
3 5
3 4
4 5
2 4
1 3
5 4
3 1
4 2
1 5
2 5

output:

Possible
2
4 5
4
4 1 3 5

result:

ok n=5, m=13: possible

Test #25:

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

input:

5 14 3
3 4
5 4
1 4
2 3
4 2
5 1
1 2
2 1
2 4
5 3
5 2
3 2
4 3
4 1

output:

Possible
2
3 2
3
3 4 2

result:

ok n=5, m=14: possible

Test #26:

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

input:

5 15 1
3 4
2 5
1 4
4 3
3 5
3 2
3 1
4 1
1 3
1 5
4 2
5 4
2 1
2 4
5 3

output:

Possible
2
1 3
3
1 4 3

result:

ok n=5, m=15: possible

Test #27:

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

input:

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

output:

Impossible

result:

ok n=6, m=10: impossible

Test #28:

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

input:

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

output:

Impossible

result:

ok n=6, m=11: impossible

Test #29:

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

input:

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

output:

Possible
4
5 3 4 1
2
5 1

result:

ok n=6, m=12: possible

Test #30:

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

input:

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

output:

Impossible

result:

ok n=6, m=13: impossible

Test #31:

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

input:

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

output:

Possible
2
3 1
4
3 5 6 1

result:

ok n=6, m=14: possible

Test #32:

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

input:

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

output:

Possible
2
1 2
4
1 4 6 2

result:

ok n=6, m=15: possible

Test #33:

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

input:

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

output:

Impossible

result:

ok n=7, m=10: impossible

Test #34:

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

input:

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

output:

Impossible

result:

ok n=7, m=11: impossible

Test #35:

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

input:

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

output:

Possible
2
3 1
3
3 6 1

result:

ok n=7, m=12: possible

Test #36:

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

input:

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

output:

Possible
3
2 3 1
5
2 6 5 7 1

result:

ok n=7, m=13: possible

Test #37:

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

input:

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

output:

Impossible

result:

ok n=7, m=14: impossible

Test #38:

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

input:

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

output:

Impossible

result:

ok n=7, m=15: impossible

Test #39:

score: 0
Accepted
time: 16ms
memory: 10200kb

input:

1000 200000 750
99 603
432 550
167 777
550 503
470 670
99 547
363 422
364 88
191 491
802 393
365 832
347 853
788 103
473 319
952 581
730 60
322 129
366 904
763 224
805 489
325 420
414 642
706 696
817 794
395 70
926 59
570 937
772 531
688 899
299 150
552 824
866 850
266 665
882 73
873 523
880 427
453...

output:

Possible
2
750 854
167
750 693 310 387 770 346 408 381 109 87 349 472 537 953 145 808 932 42 553 157 34 120 233 107 22 173 147 257 320 800 734 533 668 595 887 694 647 506 282 702 411 216 434 139 983 342 450 459 644 600 604 402 840 844 183 315 456 355 804 78 893 61 906 546 226 772 531 480 947 190 474...

result:

ok n=1000, m=200000: possible

Test #40:

score: 0
Accepted
time: 37ms
memory: 13272kb

input:

200000 200000 198052
4586 27672
17981 118299
94888 27703
63779 189872
197575 143914
102809 122055
161350 181460
115888 104037
103273 93758
73021 174644
70581 39955
59802 90498
140280 113445
176995 6850
4222 11494
52730 44233
176733 173360
27012 138898
14570 74558
78250 105659
123138 32176
156633 110...

output:

Impossible

result:

ok n=200000, m=200000: impossible

Test #41:

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

input:

200000 199999 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 ...

output:

Impossible

result:

ok n=200000, m=199999: impossible

Test #42:

score: 0
Accepted
time: 43ms
memory: 13276kb

input:

200000 199999 1
113093 2
56617 3
177632 4
45501 5
179252 6
197091 7
86918 8
127628 9
110789 10
23064 11
15380 12
174677 13
25171 14
116220 15
7622 16
11370 17
17042 18
120335 19
103585 20
187829 21
92802 22
112939 23
79099 24
84969 25
108627 26
34045 27
139532 28
144356 29
123788 30
6664 31
96032 32...

output:

Impossible

result:

ok n=200000, m=199999: impossible

Test #43:

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

input:

200000 199999 1
28417 2
75238 3
35661 4
41668 5
163112 6
33492 7
146058 8
119064 9
89361 10
149891 11
176414 12
192281 13
85293 14
122872 15
73232 16
43049 17
135762 18
29240 19
165149 20
145318 21
74237 22
95382 23
85861 24
40685 25
88630 26
58014 27
54380 28
169636 29
117826 30
95492 31
6860 32
13...

output:

Impossible

result:

ok n=200000, m=199999: impossible

Test #44:

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

input:

200000 200000 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 ...

output:

Possible
4
1 5 158258 159342
3
1 2 159342

result:

ok n=200000, m=200000: possible

Test #45:

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

input:

199998 200000 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 ...

output:

Possible
3
1 41612 123321
3
1 2 123321

result:

ok n=199998, m=200000: possible

Test #46:

score: 0
Accepted
time: 34ms
memory: 13420kb

input:

200000 200000 1
1 2
1 4
1 7
1 25
1 41
1 463
1 939
1 3557
1 5506
1 49960
1 57865
2 3
2 11
2 56
2 159
2 472
2 12278
2 24433
2 52604
2 92202
2 143885
2 159205
3 6
3 28
3 53
3 2085
3 4390
4 5
4 8
4 9
4 71
4 238
4 380
4 596
4 1053
4 5713
4 7422
4 36656
4 106984
4 108732
5 10
5 29
5 31
5 91
5 141
5 173
5 ...

output:

Possible
18
1 4 5 10 14 51 152 240 274 921 1111 1739 3394 9147 48139 103379 125195 83488
12
1 2 3 6 106 653 1898 2596 5211 8714 23920 83488

result:

ok n=200000, m=200000: possible

Test #47:

score: 0
Accepted
time: 31ms
memory: 13100kb

input:

199998 200000 1
1 2
1 8
1 51
1 109
1 236
1 264
1 368
1 2248
1 2726
1 4606
1 8197
1 9907
1 54812
2 3
2 4
2 5
2 107
2 5761
2 6840
2 10339
2 15124
2 16307
2 31159
2 92110
2 95473
3 7
3 14
3 21
3 27
3 28
3 33
3 37
3 353
3 2530
3 4176
3 5535
3 7378
3 20130
3 23521
3 27524
3 38779
3 62426
4 11
4 150
4 397...

output:

Impossible

result:

ok n=199998, m=200000: impossible

Test #48:

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

input:

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

output:

Impossible

result:

ok n=200000, m=200000: impossible

Test #49:

score: 0
Accepted
time: 32ms
memory: 25592kb

input:

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

output:

Impossible

result:

ok n=199998, m=200000: impossible

Test #50:

score: 0
Accepted
time: 29ms
memory: 13224kb

input:

199991 200000 1
1 2
1 3
1 4
1 5
1 23
1 45
1 79
1 141
1 174
1 291
1 826
1 1582
1 106574
1 146374
2 6
2 8
2 19
2 41
2 194
3 7
3 56
3 110
3 121
3 213
3 296
3 553
3 1087
3 5684
3 12620
3 36770
3 139163
3 151281
4 46
4 77
4 504
4 927
4 1531
4 2891
4 4093
4 22309
4 166814
5 11
5 12
5 13
5 22
5 100
5 299
5...

output:

Possible
18
1 3 7 18 20 40 44 189 349 352 1029 1071 1320 3527 9372 16321 42282 61728
10
1 2 8 10 67 75 337 534 13846 61728

result:

ok n=199991, m=200000: possible

Test #51:

score: 0
Accepted
time: 36ms
memory: 13268kb

input:

199901 200000 1
1 2
1 4
1 8
1 21
1 26
1 3862
1 4395
1 6044
1 9267
1 119347
1 167443
2 3
2 5
2 34
2 39
2 41
2 955
2 1242
2 9857
2 20264
2 30266
2 46919
2 53420
3 6
3 13
3 50
3 232
3 403
3 1120
3 2390
3 2983
3 10760
3 12799
3 43017
3 186442
4 7
4 42
4 158
4 223
4 671
4 2109
4 2814
4 4124
4 6207
4 8722...

output:

Possible
14
1 4 7 17 22 40 313 456 6387 19240 34645 46727 59094 116847
13
1 2 3 6 10 28 56 83 1378 1821 12992 16635 116847

result:

ok n=199901, m=200000: possible

Test #52:

score: 0
Accepted
time: 32ms
memory: 13368kb

input:

199001 200000 1
1 2
1 3
1 12
1 28
1 48
1 100
1 104
1 114
1 124
1 292
1 372
1 3929
1 4064
1 16637
1 37706
1 56869
1 57879
1 89411
2 4
2 8
2 56
2 157
2 1262
2 1834
2 2434
2 11024
2 142777
2 171095
3 5
3 9
3 13
3 110
3 130
3 195
3 281
3 8440
3 105399
4 6
4 7
4 10
4 20
4 64
4 197
4 942
4 3751
4 9268
4 1...

output:

Possible
15
1 3 5 16 39 41 49 91 103 113 144 293 1645 4867 5436
16
1 2 8 44 72 135 143 165 509 959 1534 1663 11412 19831 96675 5436

result:

ok n=199001, m=200000: possible

Test #53:

score: 0
Accepted
time: 34ms
memory: 13248kb

input:

190001 200000 1
1 2
1 5
1 49
1 59
1 203
1 452
1 551
1 958
1 1349
1 3069
1 3248
1 4082
1 31104
1 123082
2 3
2 6
2 39
2 55
2 149
2 154
2 324
2 488
2 1344
2 1405
2 7030
2 8119
2 44474
2 56110
3 4
3 7
3 8
3 30
3 137
3 277
3 892
3 1548
3 2709
3 5430
3 14156
3 15279
3 79538
4 14
4 15
4 29
4 123
4 205
4 14...

output:

Possible
14
1 5 10 28 63 80 503 1097 3989 4161 4706 8987 14591 35372
30
1 2 6 118 389 406 1287 3400 9981 12158 179 299 407 8702 45152 61700 137284 149 150 170 301 351 390 477 539 1196 24903 70526 99404 35372

result:

ok n=190001, m=200000: possible

Test #54:

score: 0
Accepted
time: 33ms
memory: 12744kb

input:

199991 200000 1
1 2
1 3
1 6
1 10
1 12
1 14
1 15
1 30
1 595
1 1103
1 1172
1 1407
1 3246
1 12747
1 27902
1 48157
1 52331
1 53512
1 57264
1 68168
1 121994
1 138076
1 176407
2 4
2 11
2 19
2 20
2 31
2 35
2 43
2 79
2 80
2 292
2 1235
2 3453
2 4168
2 5012
2 125367
2 147212
3 5
3 7
3 8
3 40
3 56
3 108
3 139
...

output:

Possible
11
1 3 8 70 343 1189 6917 25975 82811 164749 33612
8
1 2 4 50 209 539 1676 33612

result:

ok n=199991, m=200000: possible

Test #55:

score: 0
Accepted
time: 26ms
memory: 12872kb

input:

199901 200000 1
1 2
1 3
1 4
1 5
1 8
1 11
1 13
1 17
1 36
1 346
1 796
1 1204
1 4373
1 6334
1 6526
1 7551
1 12665
1 15696
1 53644
1 54043
1 64796
2 9
2 14
2 18
2 20
2 25
2 26
2 28
2 34
2 38
2 67
2 134
2 193
2 1068
2 1437
2 1709
2 2621
2 3671
2 4224
2 4657
2 6592
2 7899
2 10257
2 11797
2 16784
2 32076
2...

output:

Possible
13
1 3 10 15 47 71 218 4485 9792 15793 25954 76569 42486
8
1 2 18 51 805 14877 37819 42486

result:

ok n=199901, m=200000: possible

Test #56:

score: 0
Accepted
time: 32ms
memory: 12884kb

input:

199001 200000 1
1 2
1 4
1 5
1 7
1 8
1 13
1 17
1 26
1 78
1 192
1 229
1 280
1 416
1 685
1 739
1 6891
1 9290
1 11026
1 21354
1 38853
1 61979
2 3
2 21
2 35
2 47
2 54
2 68
2 89
2 190
2 329
2 412
2 476
2 509
2 1345
2 3294
2 4196
2 4320
2 6117
2 16948
2 37252
2 46230
2 52789
2 55018
2 77562
2 80477
2 80535...

output:

Possible
10
1 4 19 61 303 827 1567 4624 11097 129894
12
1 2 3 20 81 630 20529 67497 89914 111493 198595 129894

result:

ok n=199001, m=200000: possible

Test #57:

score: 0
Accepted
time: 31ms
memory: 12764kb

input:

190001 200000 1
1 2
1 3
1 5
1 8
1 9
1 12
1 108
1 121
1 128
1 473
1 901
1 924
1 3191
1 5023
1 5047
1 5632
1 7381
1 10045
1 12625
1 16404
1 22731
1 24897
1 38463
1 50405
1 93426
1 143911
1 155466
2 4
2 6
2 7
2 11
2 16
2 86
2 112
2 209
2 323
2 390
2 1538
2 1562
2 1667
2 6741
2 16642
2 36177
3 10
3 17
3...

output:

Possible
11
1 3 10 20 59 171 556 1332 2351 22441 65592
12
1 2 6 29 1022 1879 3924 9763 40262 59374 145841 65592

result:

ok n=190001, m=200000: possible

Test #58:

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

input:

199991 200000 1
1 2
1 3
1 5
1 9
1 16
1 23
1 35
1 36
1 63
1 170
1 206
1 211
1 251
1 280
1 320
1 850
1 959
1 1013
1 1205
1 1336
1 1826
1 3090
1 4021
1 4295
1 10739
1 74716
1 87485
1 90537
1 110072
1 187277
2 4
2 6
2 7
2 8
2 15
2 33
2 37
2 38
2 41
2 77
2 80
2 89
2 94
2 146
2 238
2 1070
2 1370
2 2080
2 ...

output:

Possible
8
1 3 32 83 362 11362 112976 78618
8
1 2 80 278 916 2180 21803 78618

result:

ok n=199991, m=200000: possible

Test #59:

score: 0
Accepted
time: 31ms
memory: 12580kb

input:

199901 200000 1
1 2
1 3
1 7
1 12
1 23
1 25
1 29
1 45
1 128
1 239
1 330
1 450
1 670
1 734
1 1055
1 1068
1 1776
1 1962
1 5955
1 6983
1 7299
1 9086
1 10227
1 13412
1 14122
1 16330
1 23731
1 25582
1 27807
1 37585
1 157299
2 5
2 8
2 10
2 11
2 17
2 22
2 57
2 93
2 104
2 109
2 113
2 135
2 205
2 212
2 321
2 ...

output:

Possible
10
1 3 4 36 217 335 1929 24419 69824 194848
10
1 2 17 26 98 847 20584 105165 130612 194848

result:

ok n=199901, m=200000: possible

Test #60:

score: 0
Accepted
time: 21ms
memory: 12588kb

input:

199001 200000 1
1 2
1 3
1 4
1 5
1 40
1 61
1 210
1 225
1 321
1 328
1 420
1 510
1 883
1 902
1 1332
1 1474
1 1727
1 2286
1 2527
1 2810
1 2813
1 4597
1 7894
1 16116
1 25018
1 41731
1 45003
1 45365
1 59060
1 66542
1 70660
1 81690
1 91566
1 107169
1 124761
1 173619
1 184157
2 6
2 10
2 14
2 15
2 22
2 27
2 ...

output:

Possible
11
1 3 7 12 25 116 389 570 11071 26685 50828
10
1 2 6 20 151 467 1467 3240 11331 50828

result:

ok n=199001, m=200000: possible

Test #61:

score: 0
Accepted
time: 26ms
memory: 12596kb

input:

190001 199999 1
1 2
1 3
1 5
1 6
1 17
1 31
1 39
1 55
1 94
1 108
1 113
1 162
1 205
1 208
1 244
1 1003
1 1005
1 1122
1 1440
1 2835
1 2965
1 4056
1 8335
1 8670
1 12258
1 30616
1 47417
1 64628
1 94160
1 115208
1 127412
1 162298
1 179828
1 188179
2 4
2 7
2 9
2 15
2 18
2 52
2 84
2 86
2 241
2 258
2 308
2 33...

output:

Possible
12
1 3 10 41 154 1016 4194 15145 55424 97165 185302 77355
9
1 2 4 23 35 293 2469 28250 77355

result:

ok n=190001, m=199999: possible

Test #62:

score: 0
Accepted
time: 29ms
memory: 31876kb

input:

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

output:

Impossible

result:

ok n=200000, m=200000: impossible

Test #63:

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

input:

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

output:

Impossible

result:

ok n=200000, m=199999: impossible

Test #64:

score: 0
Accepted
time: 47ms
memory: 29376kb

input:

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

output:

Possible
100001
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137 139 141 143 145 147 149 151 153 155 157 159 161 163 165 167 169...

result:

ok n=200000, m=200000: possible

Test #65:

score: 0
Accepted
time: 32ms
memory: 24116kb

input:

199999 200000 1
1 3
3 5
5 7
7 9
9 11
11 13
13 15
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
45 47
47 49
49 51
51 53
53 55
55 57
57 59
59 61
61 63
63 65
65 67
67 69
69 71
71 73
73 75
75 77
77 79
79 81
81 83
83 85
85 87
87 89
89 91
91 93
93 95
95 97
97 99...

output:

Impossible

result:

ok n=199999, m=200000: impossible

Test #66:

score: 0
Accepted
time: 21ms
memory: 13092kb

input:

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

output:

Impossible

result:

ok n=200000, m=200000: impossible

Test #67:

score: 0
Accepted
time: 24ms
memory: 13056kb

input:

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

output:

Impossible

result:

ok n=200000, m=200000: impossible

Test #68:

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

input:

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

output:

Possible
18
1 3 7 14 29 59 118 237 475 951 1903 3806 7612 15224 30448 60896 121792 149567
18
1 2 4 9 18 36 73 146 292 584 1168 2336 4673 9347 18695 37391 74783 149567

result:

ok n=200000, m=200000: possible

Test #69:

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

input:

706 911 614
457 348
47 544
598 243
533 483
512 79
243 181
200 604
219 541
255 431
588 467
590 242
282 99
519 620
156 227
49 20
662 280
46 391
436 666
91 648
254 438
103 90
548 400
256 613
308 552
60 629
609 280
599 214
542 520
168 700
291 682
497 675
371 692
212 300
175 158
164 172
146 285
594 518
6...

output:

Possible
6
614 255 431 394 55 480
26
614 510 183 576 271 584 680 446 308 381 485 112 323 493 449 109 573 290 226 528 398 536 334 134 535 480

result:

ok n=706, m=911: possible

Test #70:

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

input:

928 1241 412
531 561
137 499
85 426
299 864
254 136
386 865
243 154
500 249
763 567
364 399
99 728
887 879
155 121
487 903
375 188
851 43
16 37
693 499
128 511
362 312
425 693
278 890
911 282
702 572
89 610
139 518
692 294
398 515
208 644
502 161
65 189
315 115
255 470
55 530
358 919
648 216
503 79
...

output:

Possible
20
412 701 631 12 1 689 481 305 923 646 683 229 279 57 597 834 560 399 432 786
11
412 319 181 278 890 670 894 49 378 656 786

result:

ok n=928, m=1241: possible

Test #71:

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

input:

613 732 424
267 424
598 286
137 269
335 117
63 448
45 361
301 198
562 230
181 138
550 383
339 190
93 300
360 358
307 59
5 90
295 144
272 429
212 514
57 268
107 94
87 107
99 100
170 516
291 13
584 544
509 242
21 410
151 89
401 192
79 32
573 102
168 141
327 518
350 444
51 126
423 96
524 84
226 266
597...

output:

Possible
14
424 411 177 202 286 609 334 193 145 577 479 263 560 327
12
424 436 292 255 574 319 99 350 444 581 371 327

result:

ok n=613, m=732: possible

Test #72:

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

input:

351 435 298
13 216
280 275
126 298
169 256
30 66
171 226
216 177
18 169
201 36
225 20
5 336
237 168
234 344
127 129
98 169
97 279
103 47
12 99
57 329
271 176
182 217
135 123
265 238
129 10
261 9
236 176
80 53
296 31
299 165
288 58
181 90
183 107
205 172
10 315
322 188
36 37
147 344
204 112
64 281
53...

output:

Possible
7
298 134 127 129 10 315 325
14
298 62 97 279 328 348 204 112 144 271 176 268 278 325

result:

ok n=351, m=435: possible

Test #73:

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

input:

281 552 196
90 119
118 4
111 74
12 181
255 276
208 85
267 174
27 41
3 85
50 244
24 61
97 132
180 130
219 199
48 231
177 218
185 152
15 88
43 235
132 47
195 255
72 90
202 257
125 17
221 10
144 253
271 259
9 101
225 141
18 238
160 170
127 276
37 16
277 250
272 217
131 21
43 4
77 86
121 266
91 50
132 2...

output:

Possible
13
196 191 171 258 139 56 231 264 271 135 3 85 89
8
196 180 130 33 109 214 128 89

result:

ok n=281, m=552: possible

Test #74:

score: 0
Accepted
time: 4ms
memory: 9732kb

input:

8429 14496 3632
4577 3524
817 8232
59 4774
7661 8131
7896 7689
7583 7248
5495 903
4803 5445
3965 5354
514 4829
3314 1506
777 2671
6553 7684
4051 5935
204 4178
3492 7413
4416 505
6986 1323
6657 3165
6741 3954
3504 8395
5730 472
6031 5626
170 7317
7930 3371
40 1806
4612 8264
6382 1811
2170 4434
6960 1...

output:

Possible
8
3632 2474 5050 988 3891 6821 4209 2347
536
3632 2326 340 2112 357 4406 7004 4233 2490 6060 3984 5202 5259 4130 2045 407 3690 3972 7782 6037 617 6170 7459 6768 2777 3892 6961 4123 7321 3409 3121 2306 2824 1539 2719 2712 7 6937 7328 5265 6134 6934 7051 7720 4667 313 4629 3231 5165 6726 5042...

result:

ok n=8429, m=14496: possible

Test #75:

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

input:

3840 3905 3313
925 919
1445 2066
3836 2817
2742 1678
2332 2257
2475 113
3682 913
1341 744
1788 2097
1064 2502
343 3463
2222 1024
423 3018
3347 2865
2402 1815
546 3351
2757 1005
166 3092
3662 2480
2546 3246
320 2601
2650 2319
2594 1540
440 1669
3648 3664
2536 3587
2856 771
2636 1439
815 3700
584 786
...

output:

Possible
10
3313 3696 2461 2111 1005 3512 203 3347 195 1233
12
3313 2281 1776 3198 293 3338 1459 625 840 2053 1503 1233

result:

ok n=3840, m=3905: possible