QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#372159#3012. Planes, Trains, but not AutomobilesInfinityNSAC ✓191ms44720kbC++204.8kb2024-03-31 00:20:012024-03-31 00:20:02

Judging History

This is the latest submission verdict.

  • [2024-03-31 00:20:02]
  • Judged
  • Verdict: AC
  • Time: 191ms
  • Memory: 44720kb
  • [2024-03-31 00:20:01]
  • Submitted

answer

#include<bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
using namespace std;
typedef pair<int,int> pii;

const int mod=998244353;
inline int add(int x,int y){int ret=x+y;if(ret>=mod)ret-=mod;return ret;}
inline int sub(int x,int y){int ret=x-y;if(ret<0)ret+=mod;return ret;}
inline int mul(int x,int y){return ((ll)x*y)%mod;}
inline int step(int base,int pw){int ret=1;while(pw){if(pw&1)ret=mul(ret,base);base=mul(base,base);pw>>=1;}return ret;}
inline int invv(int x){return step(x,mod-2);}


const int maxn=2e5+10;

struct edge{
    int u,v,f;
};
vector<edge>e;
vector<int>g[maxn];
int start[maxn],level[maxn],source,sink;

int n,m;


void add_edge(int u,int v){
    g[u].pb(e.size());
    e.pb({u,v,0});
    g[v].pb(e.size());
    e.pb({v,u,1});
}

int bfs(){

    memset(level,0,sizeof(level));
    level[source]=1;
    queue<int>q;
    q.push(source);
    while(q.size()){

        int x=q.front();
        q.pop();

        for(int i=0;i<g[x].size();i++){
            int id=g[x][i];
            if(e[id].f || level[e[id].v])continue;
            level[e[id].v]=level[x]+1;
            q.push(e[id].v);
        }

    }

    return level[sink];
}
int sflow(int x){

    if(x==sink)return 1;

    for(;start[x]<g[x].size();start[x]++){

        int id=g[x][start[x]];

        if(e[id].f==0 && level[x]+1==level[e[id].v]){

            int tmp=sflow(e[id].v);

            if(tmp){
                e[id].f^=1;
                e[id^1].f^=1;
                return 1;
            }

        }

    }

    return 0;
}
vector<pii>get_match(){

    vector<pii>ret;

    while(bfs()){
        memset(start,0,sizeof(start));
        while(sflow(source)){}
    }

    for(int i=1;i<=n;i++){
        for(int j=0;j<g[i].size();j++){
            int id=g[i][j];
            if(e[id].v==source)continue;
            if(e[id].f)ret.pb({i,e[id].v});
        }
    }

    return ret;
}

vector<int>vect[maxn],vect2[maxn];
bitset<maxn>cmask,cmask2;/// hendlaj
int reach[maxn],reach2[maxn];
int rez[maxn];

void drugi_edge(int u,int v){
    ///vect[u].pb(v);
    vect[v].pb(u);
    vect2[u].pb(v);
    ///printf("%d %d EDGE\n",u,v);
}


int main(){

    ///freopen("test.txt","r",stdin);

    scanf("%d %d",&n,&m);
    vector<pii>myedges;
    for(int i=1;i<=m;i++){
        int u,v;
        scanf("%d %d",&u,&v);
        add_edge(u,v+n);
        myedges.pb({u,v+n});
    }
    source=0;
    sink=2*n+1;
    for(int i=1;i<=n;i++){
        add_edge(source,i);
        add_edge(i+n,sink);
        rez[i]=2;
        cmask[i]=1;
        cmask2[i]=1;
    }

    vector<pii> mat=get_match();


    printf("%d\n",n-1-mat.size());

    if(n-1-mat.size()==0){
        printf("\n");
        return 0;
    }

    set<pii>st;
    queue<int>q;
    for(int i=0;i<mat.size();i++){
        ///printf("%d %d MATCH\n",mat[i].ff,mat[i].ss);

        int u,v;
        u=mat[i].ff;
        v=mat[i].ss;

        drugi_edge(v,u);
        st.insert({u,v});

        cmask[v-n]=0;
        cmask2[u]=0;

        rez[u]--;
        rez[v-n]--;
    }
    ///for(int i=1;i<=n;i++)printf("%d %d AFA\n",i,rez[i]);
    for(int i=1;i<=n;i++)if(cmask[i]){q.push(i+n);reach[i+n]=1;}
    for(int i=0;i<myedges.size();i++){
        int u,v;
        u=myedges[i].ff;
        v=myedges[i].ss;

        if(st.find({u,v})==st.end()){
            drugi_edge(u,v);
        }

    }

    /*for(int i=1;i<=n;i++){
        printf("%d %d REZ\n",i,rez[i]);
    }*/

    while(q.size()){
        int x=q.front();
        q.pop();

        for(int i=0;i<vect[x].size();i++){
            int id=vect[x][i];
            if(reach[id])continue;
            reach[id]=1;
            q.push(id);
        }
    }

    for(int i=1;i<=n;i++){
        if(cmask2[i]){
            q.push(i);
            reach2[i]=1;
            ///printf("strt %d\n",i);
        }
    }
    while(q.size()){
        int x=q.front();
        q.pop();
        ///printf("%d DOSO\n",x);

        for(int i=0;i<vect2[x].size();i++){
            int id=vect2[x][i];
            if(reach2[id])continue;
            reach2[id]=1;
            q.push(id);
        }
    }

    //for(int i=1;i<=n;i++)printf("%d %d AFA\n",i,rez[i]);
    for(int i=0;i<mat.size();i++){

        int u,v;
        u=mat[i].ff;
        v=mat[i].ss;
        int pom=reach[u];
        rez[v-n]+=pom;

        pom=reach2[v];
        rez[u]+=pom;

        ///printf("%d %d | %d %d PROBAJ\n",u,v,reach[u],reach2[v]);

    }
    //printf("%d %d AA\n",reach2[15],reach[1]);

   // for(int i=1;i<=n;i++)printf("%d %d AFA\n",i,rez[i]);

    for(int i=1;i<=n;i++){
        if(rez[i]>0)printf("%d ",i);
    }
    printf("\n");


    return 0;
}

詳細信息

Test #1:

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

input:

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

output:

4
1 2 3 4 5 6 7 8 9 10 

result:

ok 2 lines

Test #2:

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

input:

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

output:

4
1 2 3 4 5 6 7 8 9 10 

result:

ok 2 lines

Test #3:

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

input:

100000 99999
1 50001
2 50002
3 50003
4 50004
5 50005
6 50006
7 50007
8 50008
9 50009
10 50010
11 50011
12 50012
13 50013
14 50014
15 50015
16 50016
17 50017
18 50018
19 50019
20 50020
21 50021
22 50022
23 50023
24 50024
25 50025
26 50026
27 50027
28 50028
29 50029
30 50030
31 50031
32 50032
33 50033...

output:

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

result:

ok 2 lines

Test #4:

score: 0
Accepted
time: 86ms
memory: 44480kb

input:

100000 99999
92976 9666
41240 49021
72655 13963
63062 44556
19738 10829
88976 33593
87067 65641
54950 33258
16132 71361
30648 85895
37337 87023
91820 23912
86527 11345
88855 83124
91090 22982
90758 16027
17901 73205
25624 10610
52247 55981
26799 8948
2572 60857
69334 94935
40650 71134
43703 9374
588...

output:

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

result:

ok 2 lines

Test #5:

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

input:

100000 99999
49344 19739
24235 2377
40619 61060
32268 44106
6922 61417
45674 23811
76170 97815
44929 55403
72619 22892
79918 49828
12401 49316
16126 25995
41637 27020
8369 40231
80377 22621
87052 77067
89322 17394
64966 85667
95792 53831
22046 73082
74625 53219
60490 82874
33343 31492
98481 72494
72...

output:

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

result:

ok 2 lines

Test #6:

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

input:

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

output:

5
1 2 3 4 5 6 7 8 9 10 

result:

ok 2 lines

Test #7:

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

input:

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

output:

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

result:

ok 2 lines

Test #8:

score: 0
Accepted
time: 3ms
memory: 5760kb

input:

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

output:

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

result:

ok 2 lines

Test #9:

score: 0
Accepted
time: 44ms
memory: 41984kb

input:

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

output:

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

result:

ok 2 lines

Test #10:

score: 0
Accepted
time: 114ms
memory: 44720kb

input:

100000 99998
1040 50119
9951 50119
41736 1040
32656 1040
51335 9951
98310 9951
78980 41736
82560 41736
3112 32656
52587 32656
45999 51335
99140 51335
55050 98310
17390 98310
30605 78980
3055 78980
37978 82560
11809 82560
78897 3112
6172 3112
38997 52587
96277 52587
1098 45999
75259 45999
85211 99140...

output:

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

result:

ok 2 lines

Test #11:

score: 0
Accepted
time: 3ms
memory: 5328kb

input:

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

output:

0


result:

ok single line: '0'

Test #12:

score: 0
Accepted
time: 15ms
memory: 29096kb

input:

100000 99999
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
51 5...

output:

0


result:

ok single line: '0'

Test #13:

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

input:

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

output:

0


result:

ok single line: '0'

Test #14:

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

input:

100000 99999
37509 37508
38111 38110
67714 67713
98287 98286
17246 17245
34301 34300
11327 11326
56912 56911
30990 30989
14819 14818
32123 32122
69516 69515
67332 67331
74691 74690
57102 57101
50980 50979
92406 92405
8842 8841
18057 18056
79549 79548
10535 10534
15433 15432
32406 32405
27536 27535
9...

output:

0


result:

ok single line: '0'

Test #15:

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

input:

100000 99999
81046 76854
32217 24292
46819 71700
50876 76717
48053 14326
93154 42270
81580 98683
12242 82981
7696 30610
12252 86637
99937 3697
67902 113
92401 22484
62150 68540
41780 65308
12293 94346
82835 53559
24835 2328
3986 67306
35834 28484
30810 40260
30044 29144
10252 31936
55732 88865
45485...

output:

0


result:

ok single line: '0'

Test #16:

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

input:

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

output:

4
1 2 3 4 5 6 7 8 9 10 

result:

ok 2 lines

Test #17:

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

input:

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

output:

3
1 2 4 5 7 9 10 

result:

ok 2 lines

Test #18:

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

input:

100000 50000
78826 55692
1994 2375
12558 72817
92478 95665
23151 97646
23044 15580
62040 35435
70932 54686
98138 24861
82119 29132
82006 33060
29800 33870
2546 99125
53885 33426
168 24733
47167 68425
9263 60217
69038 45617
64463 95042
64838 23038
70360 31454
65945 17438
67591 62109
11275 41202
38458...

output:

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

result:

ok 2 lines

Test #19:

score: 0
Accepted
time: 86ms
memory: 37528kb

input:

100000 66666
57021 21590
21590 96919
27100 59730
59730 37331
66137 8049
8049 92734
73656 78347
78347 79107
42744 23851
23851 31924
7380 65637
65637 58968
53917 81680
81680 30862
17735 56690
56690 82122
8248 43298
43298 73409
22518 61534
61534 64713
42236 21634
21634 84838
53252 29926
29926 50399
794...

output:

33333
3 4 5 6 7 9 10 11 12 13 14 20 23 24 25 26 27 28 29 30 33 34 36 37 38 39 40 41 43 44 45 46 47 48 49 53 55 57 58 59 60 61 62 64 65 67 68 72 73 74 75 76 77 78 81 82 84 85 86 87 88 89 91 94 95 96 97 98 99 100 102 104 105 106 107 109 110 111 112 114 115 116 117 118 119 120 121 122 123 128 129 130 1...

result:

ok 2 lines

Test #20:

score: 0
Accepted
time: 117ms
memory: 40760kb

input:

100000 90000
29500 21163
21163 11193
11193 38173
38173 85965
85965 69861
69861 25368
25368 40857
40857 60529
60529 2040
34509 61662
61662 77156
77156 52991
52991 39227
39227 61244
61244 74922
74922 38505
38505 73929
73929 13588
94457 30548
30548 26500
26500 30524
30524 19300
19300 50723
50723 48788
...

output:

9999
9 17 22 25 26 31 39 45 46 49 54 57 58 61 85 86 87 99 101 108 111 112 114 117 118 126 128 133 135 144 145 147 150 153 185 191 198 199 201 202 212 217 219 224 227 228 230 237 240 242 253 257 261 268 277 278 281 283 292 293 298 300 301 307 308 322 325 328 330 331 333 340 342 349 350 355 356 358 36...

result:

ok 2 lines

Test #21:

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

input:

1 0

output:

0


result:

ok single line: '0'

Test #22:

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

input:

10 0

output:

9
1 2 3 4 5 6 7 8 9 10 

result:

ok 2 lines

Test #23:

score: 0
Accepted
time: 14ms
memory: 22268kb

input:

100000 0

output:

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

result:

ok 2 lines

Test #24:

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

input:

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

output:

4
1 2 3 4 5 6 7 8 9 10 

result:

ok 2 lines

Test #25:

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

input:

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

output:

1
1 2 3 5 7 8 9 10 

result:

ok 2 lines

Test #26:

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

input:

50 50
12 17
13 48
11 39
43 44
36 46
21 35
10 23
27 29
21 30
25 47
23 35
19 50
27 45
40 42
22 47
17 37
3 31
43 45
46 49
30 44
42 44
12 28
12 47
5 25
24 45
12 21
48 50
21 28
20 22
8 21
47 50
24 30
12 38
13 46
4 34
30 43
8 49
6 16
13 43
49 50
26 49
10 28
4 13
11 17
22 37
27 44
28 44
21 38
44 46
20 31

output:

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

result:

ok 2 lines

Test #27:

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

input:

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

output:

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

result:

ok 2 lines

Test #28:

score: 0
Accepted
time: 6ms
memory: 5836kb

input:

1000 5000
944 950
825 873
858 966
603 996
369 554
222 237
370 780
941 967
153 976
283 899
503 677
457 461
966 987
969 989
457 914
200 972
237 856
629 645
130 639
296 355
466 810
207 637
398 894
338 756
125 876
125 222
142 410
641 980
552 558
864 880
772 831
628 806
574 802
739 909
137 872
468 686
26...

output:

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

result:

ok 2 lines

Test #29:

score: 0
Accepted
time: 141ms
memory: 27944kb

input:

50000 100000
7679 14637
14788 48557
40753 42308
31274 49508
24574 34582
21101 23526
16716 40475
15410 43130
9560 33471
13857 25421
34731 43024
35210 47855
20971 22681
43255 45308
32606 33173
9563 31904
43949 45406
12819 28982
15024 24205
45566 48286
30703 37477
5764 45675
21881 22765
42629 42897
114...

output:

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

result:

ok 2 lines

Test #30:

score: 0
Accepted
time: 179ms
memory: 43768kb

input:

100000 100000
60795 78352
43095 95182
38481 56157
82772 85899
86334 98131
18279 18676
50670 60088
53336 95275
79499 84104
86799 95333
91740 95423
70907 95053
75229 95605
45214 70745
24024 35821
28323 91218
76657 88589
40940 70577
60242 69826
36951 55313
95990 97884
37471 50645
47317 51936
35991 3682...

output:

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

result:

ok 2 lines

Test #31:

score: 0
Accepted
time: 189ms
memory: 43748kb

input:

100000 100000
34261 51639
14443 95068
7389 16661
55341 47457
48779 7541
80144 18393
4756 54330
73177 13960
70647 87450
51696 34854
69886 12245
40534 33664
15470 2423
52773 84333
75104 93567
47180 38355
28503 71832
3875 4750
39121 75186
72245 46462
84808 25756
1269 79360
70316 20468
1003 82215
27305 ...

output:

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

result:

ok 2 lines

Test #32:

score: 0
Accepted
time: 185ms
memory: 43748kb

input:

100000 100000
43996 82136
88631 140
99697 65516
93002 77018
8047 7510
10473 17910
24962 47220
68325 29133
56978 89775
27595 95387
1226 21001
55667 89940
36953 85790
16093 16176
9452 44010
36045 60772
57439 96764
79492 64417
22709 56571
73983 38928
1025 79029
5329 91366
30333 76950
23789 81453
74781 ...

output:

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

result:

ok 2 lines

Test #33:

score: 0
Accepted
time: 191ms
memory: 43816kb

input:

100000 100000
15317 90557
96935 25331
17797 4615
37961 61346
65220 22349
32701 98127
21548 81644
1834 89099
79899 87879
37883 99471
34572 81185
74892 17420
19370 10073
37066 14415
100000 40100
26003 77425
97621 16282
14268 45370
67244 95612
78993 19445
24655 19974
32270 46444
33730 88138
94644 41930...

output:

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

result:

ok 2 lines

Test #34:

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

input:

5 4
1 3
2 3
3 4
4 5

output:

1
1 2 5 

result:

ok 2 lines

Test #35:

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

input:

2 1
1 2

output:

0


result:

ok single line: '0'

Test #36:

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

input:

10 1
4 8

output:

8
1 2 3 4 5 6 7 8 9 10 

result:

ok 2 lines

Test #37:

score: 0
Accepted
time: 11ms
memory: 23036kb

input:

100000 1
5 101

output:

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

result:

ok 2 lines

Test #38:

score: 0
Accepted
time: 3ms
memory: 5376kb

input:

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

output:

1
1 4 5 6 

result:

ok 2 lines