QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#641420#6388. NetworkXY_Eleven100 ✓372ms61820kbC++235.4kb2024-10-14 20:26:262024-10-14 20:26:28

Judging History

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

  • [2024-10-14 20:26:28]
  • 评测
  • 测评结果:100
  • 用时:372ms
  • 内存:61820kb
  • [2024-10-14 20:26:26]
  • 提交

answer

#include <bits/stdc++.h>
// #include <windows.h>
// #include <bits/extc++.h>
// using namespace __gnu_pbds;
using namespace std;
//#pragma GCC optimize(3)
#define DB double
#define LL long long
#define ULL unsigned long long
#define in128 __int128
#define cint const int
#define cLL const LL
#define For(z,e1,e2) for(int z=(e1);z<=(e2);z++)
#define Rof(z,e1,e2) for(int z=(e2);z>=(e1);z--)
#define For_(z,e1,e2) for(int z=(e1);z<(e2);z++)
#define Rof_(z,e1,e2) for(int z=(e2);z>(e1);z--)
#define inint(e) scanf("%d",&e)
#define inll(e) scanf("%lld",&e)
#define inpr(e1,e2) scanf("%d%d",&e1,&e2)
#define in3(e1,e2,e3) scanf("%d%d%d",&e1,&e2,&e3)
#define outint(e) printf("%d\n",e)
#define outint_(e) printf("%d%c",e," \n"[i==n])
#define outint2_(e,e1,e2) printf("%d%c",e," \n"[(e1)==(e2)])
#define outll(e) printf("%lld\n",e)
#define outll_(e) printf("%lld%c",e," \n"[i==n])
#define outll2_(e,e1,e2) printf("%lld%c",e," \n"[(e1)==(e2)])
#define exc(e) if(e) continue
#define stop(e) if(e) break
#define ret(e) if(e) return
#define ll(e) (1ll*(e))
#define pb push_back
#define ft first
#define sc second
#define pii pair<int,int> 
#define pli pair<long long,int> 
#define vct vector 
#define clean(e) while(!e.empty()) e.pop()
#define all(ev) ev.begin(),ev.end()
#define sz(ev) ((int)ev.size())
#define debug(x) printf("%s=%d\n",#x,x)
#define x0 __xx00__
#define y1 __yy11__
#define ffo fflush(stdout)
cLL mod=998244353,G=404;
// cLL mod[2]={1686688681ll,1666888681ll},base[2]={166686661ll,188868881ll};
template <typename Type> void get_min(Type &w1,const Type w2) { if(w2<w1) w1=w2; } template <typename Type> void get_max(Type &w1,const Type w2) { if(w2>w1) w1=w2; }
template <typename Type> Type up_div(Type w1,Type w2) { return (w1/w2+(w1%w2?1:0)); }
template <typename Type> Type gcd(Type X_,Type Y_) { Type R_=X_%Y_; while(R_) { X_=Y_; Y_=R_; R_=X_%Y_; } return Y_; } template <typename Type> Type lcm(Type X_,Type Y_) { return (X_/gcd(X_,Y_)*Y_); }
template <typename Type> Type md(Type w1,const Type w2=mod) { w1%=w2; if(w1<0) w1+=w2; return w1; } template <typename Type> Type md_(Type w1,const Type w2=mod) { w1%=w2; if(w1<=0) w1+=w2; return w1; }
void ex_gcd(LL &X_,LL &Y_,LL A_,LL B_) { if(!B_) { X_=1ll; Y_=0ll; return ; } ex_gcd(Y_,X_,B_,A_%B_); X_=md(X_,B_); Y_=(1ll-X_*A_)/B_; } LL inv(LL A_,LL B_=mod) { LL X_=0ll,Y_=0ll; ex_gcd(X_,Y_,A_,B_); return X_; }
template <typename Type> void add(Type &w1,const Type w2,const Type M_=mod) { w1=md(w1+w2,M_); } void mul(LL &w1,cLL w2,cLL M_=mod) { w1=md(w1*md(w2,M_),M_); } template <typename Type> Type pw(Type X_,Type Y_,Type M_=mod) { Type S_=1; while(Y_) { if(Y_&1) mul(S_,X_,M_); Y_>>=1; mul(X_,X_,M_); } return S_; }
template <typename Type> Type bk(vector <Type> &V_) { auto T_=V_.back(); V_.pop_back(); return T_; } template <typename Type> Type tp(stack <Type> &V_) { auto T_=V_.top(); V_.pop(); return T_; } template <typename Type> Type frt(queue <Type> &V_) { auto T_=V_.front(); V_.pop(); return T_; }
template <typename Type> Type bg(set <Type> &V_) { auto T_=*V_.begin(); V_.erase(V_.begin()); return T_; } template <typename Type> Type bk(set <Type> &V_) { auto T_=*prev(V_.end()); V_.erase(*prev(V_.end())); return T_; }
mt19937 gen(time(NULL)); int rd() { return abs((int)gen()); }
int rnd(int l,int r) { return rd()%(r-l+1)+l; }
void main_init()
{

}
cint N=2.01e5,M=2.01e5,K=20;
int n,m;
vct <int> v[N];
int dep[N],up[N][K+1],in[N],out[N],c[N],id;
void dfs(int p,int fa)
{
    in[p]=out[p]=++id; c[id]=p;
    dep[p]=dep[fa]+1;
    up[p][0]=fa;
    for(auto i:v[p])
    {
        exc(i==fa);
        dfs(i,p);
        out[p]=out[i];
    }
}
int lca(int x,int y)
{
    if(dep[x]<dep[y]) swap(x,y);
    for(int c=dep[x]-dep[y],i=0;c;c>>=1,i++)
        if(c&1) x=up[x][i];
    if(x==y) return x;
    Rof(i,0,K)
    {
        exc(up[x][i]==up[y][i]);
        x=up[x][i],y=up[y][i];
    }
    return up[x][0];
}
array <int,3> a[M];
int uf[N];
int fin(int w)
{
    if(uf[w]==w) return w;
    return (uf[w]=fin(uf[w]));
}
void mer(int w1,int w2)
{
    w1=fin(w1),w2=fin(w2);
    ret(w1==w2);
    if(w1<w2) swap(w1,w2);
    uf[w2]=w1;
}
vct <int> g[N];
bool check(int p)
{
    return (fin(p)!=p);
}
void fill(int l,int r)
{
    // printf("[%d,%d]\n",l,r);
    // printf("hey\n");
    for(int i=fin(l);i<=r;i=fin(i))
        mer(i,i+1);
    // printf("okay\n");
}
int hav[N];
void main_solve()
{
    inpr(n,m);
    For_(i,1,n)
    {
        int x,y; inpr(x,y);
        v[x].pb(y),v[y].pb(x);
    }
    id=0; dfs(1,0);
    For(j,1,K) For(i,1,n)
        up[i][j]=up[up[i][j-1]][j-1];
    For(i,1,m)
    {
        inpr(a[i][0],a[i][1]);
        a[i][2]=lca(a[i][0],a[i][1]);
        // printf("%d\n",a[i][2]);
        g[a[i][2]].pb(i);
    }
    For(i,1,n+1) uf[i]=i;
    int ans=0;
    Rof(num,1,n)
    {
        int p=c[num];
        for(auto i:g[p])
        {
            exc(check(in[a[i][0]])||check(in[a[i][1]]));
            hav[++ans]=p;
            fill(in[p],out[p]);
            break;
        }
    }
    outint(ans);
    For(i,1,ans) outint2_(hav[i],i,ans);
}
int main()
{
    // ios::sync_with_stdio(0); cin.tie(0);
    // freopen("in.txt","r",stdin);
    // freopen("out.txt","w",stdout);
    // srand(time(NULL));
    main_init();
    // int _; inint(_); For(__,1,_) // T>1 ?
        // printf("\n------------\n\n"),
        main_solve();
    return 0;
}
/*

*/

详细

Subtask #1:

score: 4
Accepted

Test #1:

score: 4
Accepted
time: 85ms
memory: 61820kb

input:

200000 200000
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 ...

output:

200000
200000 199999 199998 199997 199996 199995 199994 199993 199992 199991 199990 199989 199988 199987 199986 199985 199984 199983 199982 199981 199980 199979 199978 199977 199976 199975 199974 199973 199972 199971 199970 199969 199968 199967 199966 199965 199964 199963 199962 199961 199960 199959...

result:

ok correct plan

Test #2:

score: 4
Accepted
time: 84ms
memory: 38468kb

input:

192791 177013
15163 96594
16414 102268
89243 170228
57950 132600
162574 32273
2947 78186
41636 62390
73315 15163
159645 21314
185962 122448
75023 149485
145294 145941
154151 174468
11494 16133
14507 183387
92177 141072
71628 187859
123587 177507
55726 185406
170316 48341
28477 167274
76200 94096
717...

output:

113
172229 174897 172088 160222 181824 156918 178042 158782 185784 166906 163157 168460 167780 167052 177820 191866 184702 158538 167132 157539 162182 163887 171441 159731 156447 189298 167978 171306 161153 177065 183928 167438 177530 174817 165206 183845 171449 159220 160383 173907 185459 175392 16...

result:

ok correct plan

Test #3:

score: 4
Accepted
time: 103ms
memory: 57756kb

input:

193083 194390
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 ...

output:

122449
193083 193082 193079 193078 193075 193074 193073 193072 193071 193067 193066 193065 193064 193063 193060 193059 193057 193053 193052 193051 193048 193047 193043 193042 193040 193038 193037 193036 193035 193034 193033 193032 193026 193025 193024 193023 193022 193020 193018 193017 193016 193014...

result:

ok correct plan

Test #4:

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

input:

1 15
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1

output:

1
1

result:

ok correct plan

Test #5:

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

input:

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

output:

7
11 9 8 7 13 14 1

result:

ok correct plan

Test #6:

score: 4
Accepted
time: 1ms
memory: 12304kb

input:

2000 2000
646 1544
259 1127
1827 903
859 292
1520 1908
478 1986
1471 1556
1829 894
32 1676
876 1610
234 1082
36 1554
408 1056
1910 931
290 1091
1246 1491
280 1923
1244 1084
843 1940
227 756
961 733
856 255
1496 1750
1951 961
758 816
319 1413
302 1932
122 11
1853 53
113 1600
1391 1654
1995 1680
1626 ...

output:

1251
308 1170 1718 631 206 1705 429 931 564 1135 299 920 1623 826 769 894 1726 1873 805 1000 1258 516 1678 817 132 1185 1060 113 1158 1929 1233 380 1702 441 1817 8 39 1719 1482 543 1518 190 445 1189 1866 1955 1964 1879 768 448 579 1918 436 334 158 1252 1488 1272 236 383 1219 1175 1807 686 1647 593 2...

result:

ok correct plan

Test #7:

score: 4
Accepted
time: 140ms
memory: 46576kb

input:

198912 186079
95780 144147
156043 6576
73725 177413
193666 6531
3185 35106
50448 92669
57454 69007
125547 119658
48130 110361
134981 69883
112070 85977
55781 101462
142588 148493
22305 45089
54391 189769
82051 53939
76255 10560
143560 197809
117454 69061
134035 101491
23080 88239
132686 178401
59762...

output:

120929
116054 80946 105021 190239 134260 54750 182329 49074 127372 185501 153978 104733 88592 157004 77077 182828 118177 76920 193253 72123 94678 142449 133292 123851 62047 55965 151497 189128 143792 7452 70105 15602 174112 45462 58680 146678 66917 57368 79707 123271 69416 133639 126576 134764 18389...

result:

ok correct plan

Subtask #2:

score: 17
Accepted

Test #8:

score: 17
Accepted
time: 70ms
memory: 61424kb

input:

200000 200000
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 ...

output:

100001
200000 199998 199996 199994 199992 199990 199988 199986 199984 199982 199980 199978 199976 199974 199972 199970 199968 199966 199964 199962 199960 199958 199956 199954 199952 199950 199948 199946 199944 199942 199940 199938 199936 199934 199932 199930 199928 199926 199924 199922 199920 199918...

result:

ok correct plan

Test #9:

score: 17
Accepted
time: 210ms
memory: 58312kb

input:

199991 199988
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 ...

output:

502
199736 199187 199019 198812 198385 197865 197488 197434 196996 196548 195822 195297 194817 194425 194258 193854 193520 192880 192565 191928 191422 191006 190810 190632 190353 190170 189718 189184 188540 188102 187821 187626 187037 186379 186023 185915 185453 184741 184641 184033 183782 183605 18...

result:

ok correct plan

Test #10:

score: 17
Accepted
time: 127ms
memory: 55768kb

input:

199994 199989
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 ...

output:

5417
199976 199959 199936 199923 199911 199897 199886 199873 199862 199850 199835 199828 199817 199811 199802 199788 199776 199769 199746 199732 199719 199711 199702 199683 199682 199667 199648 199629 199613 199598 199582 199572 199564 199549 199527 199522 199517 199515 199501 199486 199478 199463 1...

result:

ok correct plan

Test #11:

score: 17
Accepted
time: 3ms
memory: 12412kb

input:

2000 2000
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 52
5...

output:

45
1995 1959 1903 1861 1830 1809 1772 1709 1619 1593 1569 1538 1509 1463 1397 1346 1290 1206 1152 1064 1035 1020 995 958 933 859 803 749 679 654 636 584 552 477 401 349 284 188 180 159 152 98 71 47 5

result:

ok correct plan

Test #12:

score: 17
Accepted
time: 93ms
memory: 52796kb

input:

200000 200000
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 ...

output:

1
14123

result:

ok correct plan

Test #13:

score: 17
Accepted
time: 179ms
memory: 54720kb

input:

200000 200000
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 ...

output:

4
145045 107588 78878 34415

result:

ok correct plan

Test #14:

score: 17
Accepted
time: 0ms
memory: 12180kb

input:

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

output:

1
1

result:

ok correct plan

Subtask #3:

score: 14
Accepted

Test #15:

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

input:

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

output:

2
2 4

result:

ok correct plan

Test #16:

score: 14
Accepted
time: 2ms
memory: 10124kb

input:

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

output:

7
6 5 10 12 9 13 1

result:

ok correct plan

Test #17:

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

input:

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

output:

3
7 5 9

result:

ok correct plan

Subtask #4:

score: 29
Accepted

Dependency #3:

100%
Accepted

Test #18:

score: 29
Accepted
time: 3ms
memory: 10132kb

input:

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

output:

29
14 5 15 6 40 9 35 30 11 37 21 19 2 4 17 32 16 22 36 38 26 18 24 23 10 33 27 28 1

result:

ok correct plan

Test #19:

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

input:

2000 40
324 734
227 1309
485 1789
300 1206
1035 1390
1789 62
576 629
1997 1787
668 848
1075 1768
1920 1601
876 1223
619 309
557 870
1381 394
1202 1857
786 1851
1614 938
1142 1779
489 1652
927 1035
800 1424
494 176
1643 576
1130 1970
36 1148
1076 656
1229 284
990 427
1229 1774
422 602
1467 1528
408 1...

output:

6
1761 1923 909 1570 1911 104

result:

ok correct plan

Test #20:

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

input:

1999 1998
921 63
1320 19
754 1091
454 1602
840 679
1713 852
1959 984
250 1751
1407 949
1949 208
1884 1560
703 636
1628 582
1736 1810
1998 955
1041 840
1591 1776
1032 1877
1319 1178
360 583
691 129
1510 1799
440 1807
307 939
976 880
1326 81
1386 1782
69 477
1234 1896
999 322
1136 931
1507 1780
1916 2...

output:

378
1866 46 842 910 629 1406 1463 41 572 161 1255 1557 1700 1109 1241 1117 1979 484 52 1375 1485 799 833 1721 1949 208 650 998 103 1297 1333 1507 431 597 1612 1228 58 652 1210 290 443 1247 1977 710 219 1544 376 1218 786 1370 345 1343 561 1819 635 1243 1703 1937 54 768 349 1103 1311 565 60 1453 1267 ...

result:

ok correct plan

Test #21:

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

input:

2000 2000
1242 38
3 1172
1653 105
616 917
721 704
563 53
1643 1708
1743 1969
638 763
1603 1855
624 55
616 707
471 1725
233 838
691 1691
82 1799
902 1396
1741 1071
870 1979
100 1113
883 1612
738 533
372 1132
1467 1259
1953 994
1286 1980
156 796
1319 976
1481 213
506 1748
1908 7
1440 1655
927 498
1254...

output:

29
935 1418 1197 1104 984 1229 1431 1564 1565 1203 1408 1252 583 1866 1114 595 1492 1156 1864 1378 948 1481 1531 1529 1220 1822 723 1106 1763

result:

ok correct plan

Test #22:

score: 29
Accepted
time: 3ms
memory: 10216kb

input:

2000 2000
1100 1952
822 756
1211 1245
1457 33
554 224
894 1548
1909 1991
365 1489
428 1489
1952 1746
1289 1280
206 1503
1109 375
881 1205
1812 769
431 1597
127 873
242 1570
1952 1735
931 1356
245 1969
1345 873
1138 57
1994 122
1628 1243
1503 1414
743 756
756 431
756 1447
1883 1993
1217 1952
1969 105...

output:

17
1280 1871 1489 520 1941 873 224 1152 455 1969 1952 1503 637 1113 57 1343 756

result:

ok correct plan

Test #23:

score: 29
Accepted
time: 4ms
memory: 12268kb

input:

1922 1993
913 460
1350 1848
1551 225
1692 301
1415 885
1751 254
1257 425
323 475
665 783
612 763
272 1016
747 480
715 1550
321 1609
1111 1669
1003 1413
881 1742
331 1829
519 1087
1080 668
900 1846
1386 1760
1352 183
1148 481
1156 1683
662 1861
188 716
1643 1425
1433 1029
1834 1195
1070 254
1590 454
...

output:

40
1154 1718 1016 1664 1018 446 1345 511 1122 1602 1652 157 650 928 297 598 523 357 810 288 850 1902 1912 1812 695 1109 319 937 1395 639 300 1700 1825 1583 301 1739 65 1570 507 1441

result:

ok correct plan

Test #24:

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

input:

150 2000
119 133
136 119
86 119
119 34
119 100
119 13
76 119
119 65
119 71
119 130
119 66
143 119
119 150
119 115
119 9
119 25
64 119
119 73
74 119
40 119
119 82
119 35
119 110
111 119
119 132
119 20
50 119
87 119
119 120
119 6
7 119
119 90
92 119
126 119
32 119
119 29
119 144
96 119
119 42
8 119
11...

output:

12
15 91 28 131 118 54 141 42 73 65 76 119

result:

ok correct plan

Subtask #5:

score: 36
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #25:

score: 36
Accepted
time: 22ms
memory: 10776kb

input:

1000 200000
962 786
10 602
689 122
331 609
456 224
682 555
258 809
340 387
460 90
850 387
305 977
139 820
73 439
783 713
855 235
302 3
271 474
468 946
93 308
819 976
69 548
790 83
25 642
506 841
39 853
665 520
186 952
282 704
192 544
206 756
903 458
207 461
222 293
305 620
167 473
218 838
436 963
33...

output:

365
99 292 503 294 169 899 584 854 374 479 826 76 664 771 790 863 848 241 522 104 741 473 569 843 135 204 114 198 906 570 705 146 98 250 912 208 571 596 519 335 819 242 972 815 492 594 136 723 789 125 845 759 901 633 449 184 332 172 346 418 186 235 402 827 551 650 798 585 929 284 545 100 236 602 464...

result:

ok correct plan

Test #26:

score: 36
Accepted
time: 98ms
memory: 38060kb

input:

200000 1000
95107 88168
164771 85445
66359 162412
163788 180604
34366 91353
106881 49515
160504 82649
164411 27137
8466 118113
76696 110444
183716 55642
183361 57033
35294 82872
72862 71258
142773 21106
143580 42596
110137 165652
146176 170264
198469 142707
69183 43753
38091 114103
184519 46414
3837...

output:

35
105664 164459 159029 85967 46465 93930 123748 185421 157460 118112 113563 162238 94292 108306 138039 140609 24248 39248 54009 55215 118099 128781 87736 97190 47353 30322 136181 15485 185863 19204 83571 106804 8208 6870 1

result:

ok correct plan

Test #27:

score: 36
Accepted
time: 149ms
memory: 39884kb

input:

185187 190124
129481 181690
140662 95760
169227 45363
139452 85447
33367 61989
11211 71033
184146 43438
177997 67240
112457 114889
169331 31429
157559 26171
30228 104581
72925 124203
60734 119134
182866 88147
159343 61451
142062 70863
160999 80006
132410 61922
184613 135766
88844 13399
28172 171484
...

output:

368
147251 48610 146003 39437 68207 168683 169224 13161 120056 73004 44669 72612 75499 140927 96577 23910 158075 87968 90422 1213 119524 46834 14630 162597 76051 4735 113313 105475 158766 15948 46306 145177 170897 113156 160001 75477 181043 69631 124052 78942 63026 5430 128180 178183 80736 13616 663...

result:

ok correct plan

Test #28:

score: 36
Accepted
time: 146ms
memory: 44580kb

input:

199023 194992
112150 381
61419 62872
61493 109624
197795 111364
137979 61211
1807 100136
98752 183589
27951 9284
5836 93144
78987 24773
17566 123497
44908 183698
119459 186104
145308 130621
157247 189676
18511 169097
7633 180862
87954 29481
155086 118436
61203 62285
53853 31684
162988 46237
153023 1...

output:

15303
122033 105596 9487 68345 177388 66214 178092 184493 139722 26968 29798 171147 126975 195072 188201 171268 178257 175837 180420 187934 53390 147427 32258 117477 178897 31936 99625 182170 20859 182430 175426 34918 136169 132248 110099 152792 67139 94996 161732 171105 19331 87872 78150 22219 7241...

result:

ok correct plan

Test #29:

score: 36
Accepted
time: 213ms
memory: 42416kb

input:

199675 197898
16067 23538
35080 107246
156465 86388
58637 139661
18908 67140
157193 188391
177753 80905
33730 68936
14860 156486
182042 62689
78274 133213
65374 179074
159979 180325
1191 11882
177049 5310
142145 148996
180278 105063
164908 46889
35330 25704
167829 77893
107073 87455
118234 84839
122...

output:

485
189772 122577 111730 118894 43852 95805 29352 22425 61983 26297 9929 192624 197652 33415 86800 34054 39245 19189 154286 52814 81625 88879 149075 9367 161177 112274 104414 45833 88449 129401 30112 143164 188285 111503 133369 95536 138687 60725 112405 47130 98519 118560 47242 38954 102709 100348 1...

result:

ok correct plan

Test #30:

score: 36
Accepted
time: 124ms
memory: 38596kb

input:

188144 189189
113457 126804
172368 902
135979 124925
52117 30447
50855 151736
10826 79905
112635 160398
36405 76006
115641 49725
118723 160596
36598 64055
56276 6591
106106 50501
55734 13740
84294 46053
2132 106130
38498 127898
47536 23430
109961 129969
111107 28576
142369 142132
148458 108051
14537...

output:

109
175324 126335 180080 174089 128887 180021 179397 163652 173871 175601 148422 162346 166581 122853 120849 157321 131089 155940 144519 167257 127444 151689 176059 176538 142013 163210 150277 126429 131588 168388 128146 147908 133280 147561 161935 151097 112016 131930 168258 158415 149615 149128 10...

result:

ok correct plan

Test #31:

score: 36
Accepted
time: 135ms
memory: 40452kb

input:

197567 197283
76986 5176
162491 82631
153709 153234
122448 119015
46542 134867
144078 36712
87847 56340
55550 152283
131639 157934
69114 80854
95441 107667
87709 108324
194073 78052
23351 173199
92762 23785
107493 145155
36686 114909
95441 26463
23558 418
24192 95441
188076 182221
122910 196908
8147...

output:

181
122810 70608 44619 87061 55406 167927 75986 147170 138126 74681 126705 19802 138392 131577 87847 34244 30202 144332 29222 50600 156631 100948 145155 92044 45010 51637 116432 67535 180181 34396 70358 170053 84326 115507 180043 73951 108324 150394 27030 195645 164883 137299 177934 57554 74184 1950...

result:

ok correct plan

Test #32:

score: 36
Accepted
time: 238ms
memory: 43204kb

input:

199999 199998
57299 111055
31703 48204
138530 64729
4600 166389
182536 187355
100197 82429
35502 24171
35688 91780
44623 157178
7241 184089
140355 193065
13714 166126
11578 184978
12311 58219
21287 118071
166322 177326
88842 196118
139280 79683
145174 41137
32309 4491
145206 58270
132044 47673
34482...

output:

499
92184 187318 173838 139517 129306 60058 169051 93080 170144 134942 8143 58407 115416 28736 52211 61694 62639 73146 169370 106374 79803 126710 181810 81947 121301 128568 85468 90661 147725 195641 67311 170213 106185 176408 31463 183979 72407 79722 35802 21047 49248 141300 106227 132331 48610 1939...

result:

ok correct plan

Test #33:

score: 36
Accepted
time: 125ms
memory: 40568kb

input:

200000 200000
135271 36583
109466 135271
40256 135271
135271 111522
141759 135271
188471 135271
133818 135271
135271 88349
115520 135271
96459 135271
117693 135271
135271 99209
135271 75826
135271 167880
135271 99672
135271 176594
183481 135271
77190 135271
197698 135271
193882 135271
135271 154656
...

output:

1
135271

result:

ok correct plan

Test #34:

score: 36
Accepted
time: 372ms
memory: 52764kb

input:

200000 200000
76496 153200
107795 113185
159406 16131
127262 90537
43113 182602
170954 168070
83387 3383
15385 116831
191157 42268
142379 72960
156347 53592
163269 159122
29345 40574
61150 40382
65207 22984
94675 160869
26519 154814
10651 22764
60852 114858
191065 166952
47089 70874
128594 115795
18...

output:

492
193881 119543 157475 68948 70481 3193 59142 43539 157449 90389 58438 5639 56151 169174 37986 187277 145196 156402 16192 131331 121179 175744 187516 130970 114843 136046 23167 124552 40481 102142 36845 55114 53224 73215 96651 178112 80186 110869 164050 91039 167456 75302 83459 2603 168879 112649 ...

result:

ok correct plan

Test #35:

score: 36
Accepted
time: 179ms
memory: 40392kb

input:

200000 200000
14980 136780
44323 79762
56355 132044
158375 82833
189773 80348
14529 178342
62749 130697
61919 36105
186627 167479
136960 128736
73870 123049
1448 25238
46365 167002
123272 150814
62234 145472
9864 176429
127389 42159
41705 13715
112747 158444
136311 138613
168668 49610
43693 143003
7...

output:

461
170783 57919 98537 105252 32544 168271 79272 165804 53577 71586 119488 102948 191754 82172 186964 123533 65550 117579 138072 98569 135818 126735 185010 98818 31758 190336 133988 195765 142071 144279 199769 13151 182225 171165 34852 26065 68822 74657 45924 168674 60739 23894 88422 46286 129752 18...

result:

ok correct plan

Test #36:

score: 36
Accepted
time: 306ms
memory: 49472kb

input:

200000 200000
91610 157149
169751 144801
164986 81171
89525 134455
30949 57500
184578 30443
84434 27008
89793 156988
199474 182061
33191 99697
86720 164130
83125 1073
42970 184483
1335 1032
154225 25386
130159 123083
129354 99811
50757 82711
90620 89351
53688 31659
42135 146681
29266 7620
31387 5316...

output:

5
60638 76505 145436 7717 1

result:

ok correct plan

Test #37:

score: 36
Accepted
time: 201ms
memory: 53512kb

input:

199999 199999
1 2
2 3
3 4
3 184691
3 187429
4 5
5 6
6 7
7 8
8 9
8 190964
9 10
10 11
11 12
12 13
13 14
14 15
15 16
15 169232
15 175253
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
23 192679
24 25
25 26
25 163741
26 27
27 28
28 29
29 30
29 170209
30 31
31 32
31 178883
32 33
33 34
34 35
35 36
36 37
...

output:

220
159205 158356 157683 156569 155864 155515 155164 154318 153961 152929 151898 151159 150416 149744 149023 148245 147425 146740 146155 146077 145591 145039 143743 142141 141497 141418 140996 139764 139561 138744 137363 137185 136602 135967 135643 134975 134094 133808 133733 133099 132312 131357 13...

result:

ok correct plan

Test #38:

score: 36
Accepted
time: 178ms
memory: 55856kb

input:

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

output:

100
188701 186530 184449 182162 180927 179792 179142 178777 177524 176036 174573 174474 170959 169568 168677 167204 166872 162624 161775 161018 159676 159380 156191 153980 151266 147262 144369 141276 140583 139495 136532 135579 131724 128667 126164 123691 121661 120165 116941 116191 114242 112421 11...

result:

ok correct plan

Extra Test:

score: 0
Extra Test Passed