QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#390767#6830. Just Some Bad MemoryNahidameowAC ✓160ms51124kbC++203.4kb2024-04-15 21:24:572024-04-15 21:24:58

Judging History

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

  • [2024-04-15 21:24:58]
  • 评测
  • 测评结果:AC
  • 用时:160ms
  • 内存:51124kb
  • [2024-04-15 21:24:57]
  • 提交

answer

#include<bits/stdc++.h>
#define pd push_back
#define all(A) A.begin(),A.end()
#define lower_bound lb
#define ve std::vector
typedef long long ll;
typedef long long ll;
typedef __int128 Int;
typedef unsigned long long ul;
typedef long double LD;
bool FileIfstream(std::string name){
	std::ifstream f(name.c_str());
	return f.good();
}
namespace Math{
	ll QP(ll x,ll y,ll mod){ll ans=1;for(;y;y>>=1,x=x*x%mod)if(y&1)ans=ans*x%mod;return ans;}
	ll inv(ll x,ll mod){return QP(x,mod-2,mod);}
}
const int N=2e5+10;
const int mod=998244353;
int n,m;
struct none{
	ve<ve<int>>v;
	ve<bool>vis;
	void init(ve<ve<int>>&rv){
		v=rv;vis.assign(n+1,false);
	}
	bool dfs(int x,int F){
		vis[x]=true;
		for(auto y:v[x]){
			if(y^F){
				if(vis[y])return true;
				if(dfs(y,x))
					return true;
			}
		}
			
		return false;
	}
	bool work(){
		for(int i=1;i<=n;i++)
			if(!vis[i]){
				if(dfs(i,0))
					return true;
			}
		return false;
	}
	bool dfs2(int x,int dep){
		if(dep==4)return true;
		vis[x]=true;
		for(auto y:v[x]){
			if(!vis[y]){
				if(dfs2(y,dep+1))
					return true;
			}
		}
		vis[x]=false;
		return false;
	}
	bool find_list(){
		vis.assign(n+1,false);
		for(int i=1;i<=n;i++)
			if(dfs2(i,1))
				return true;
		return false;
	}
}E1;
struct odd{
	ve<ve<int>>v;
	ve<int>col;
	void init(ve<ve<int>>&rv){
		v=rv;col.assign(n+1,-1);
	}
	bool dfs(int x,int c){
		col[x]=c;
		for(auto y:v[x])
			if(col[y]==-1){
				if(dfs(y,c^1))
					return true;
			}else if(col[y]^col[x]^1)return true;
		return false;
	}
	bool work(){
		for(int i=1;i<=n;i++)
			if(col[i]==-1){
				if(dfs(i,0))
					return true;
			}
		return false;
	} 
}E2;
struct even{
	std::map<std::pair<int,int>,int>mp1,mp2;
	ve<ve<int>>v;
	ve<int>dep;
	ve<bool>cov;
	ve<int>f;
	void init(ve<ve<int>>&rv){
		v=rv;dep.assign(n+1,0);
		cov.assign(n+1,false);
		f.assign(n+1,0);
	}
	void dfs(int x,int F){
		dep[x]=dep[F]+1;f[x]=F;
		for(auto y:v[x])
			if(y!=F&&!dep[y])
				mp1[{x,y}]=mp1[{y,x}]=1,dfs(y,x);
	}
	bool work(){
		for(int i=1;i<=n;i++)
			if(!dep[i])dfs(i,0);
		for(int i=1;i<=n;i++)
			for(auto p:v[i])
				if(dep[p]<dep[i]&&mp1[{i,p}]!=1){
					int x=i,y=p;
					if(dep[x]<dep[y])std::swap(x,y);
					if((dep[x]-dep[y])&1)
						return true;
					while(x^y){
						if(mp2[{x,f[x]}]==1)
							return true;
						mp2[{x,f[x]}]=1;
						x=f[x];
					}
				}
		return false;
	}
}E3;
void solve(){
	//don't forget to open long long
	std::cin>>n>>m;
	if(n<=3)return std::cout<<"-1\n",void();
	if(m<=2)return std::cout<<5-m<<'\n',void(); 
	ve<ve<int>>v(n+1);
	for(int i=1;i<=m;i++){
		int x,y;std::cin>>x>>y;
		v[x].pd(y);v[y].pd(x);
	}
	E1.init(v);
	E2.init(v);
	E3.init(v);
	bool f1=E1.work(),f2=E2.work(),f3=E3.work();
	if(!f1){
		if(E1.find_list())
			return std::cout<<2<<'\n',void();
		else std::cout<<3<<'\n',void();
	}else if(f2&&f3)return std::cout<<0<<'\n',void();
	else if(f2){
		if(E1.find_list())
			return std::cout<<1<<'\n',void();
		else std::cout<<2<<'\n',void();
	}else{
		std::cout<<1<<'\n',void();
		return; 
	}
}
int main(){
#ifndef ONLINE_JUDGE
	if(!FileIfstream("IO.in")){
		freopen("IO.in","w",stdout);
		return 0;
	}
	freopen("IO.in","r",stdin);
	freopen("IO.out","w",stdout);
#endif
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	std::cout.tie(0);
	int T=1;
	//std::cin>>T;
	while(T--)solve();

	return 0;
}




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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 3
1 2
2 3
1 3

output:

-1

result:

ok "-1"

Test #2:

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

input:

4 0

output:

5

result:

ok "5"

Test #3:

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

input:

5 4
1 2
2 3
3 4
4 5

output:

2

result:

ok "2"

Test #4:

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

input:

4 6
1 2
1 3
1 4
2 3
2 4
3 4

output:

0

result:

ok "0"

Test #5:

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

input:

4 4
1 2
2 3
3 4
4 1

output:

1

result:

ok "1"

Test #6:

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

input:

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

output:

0

result:

ok "0"

Test #7:

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

input:

4 3
1 2
2 3
3 1

output:

2

result:

ok "2"

Test #8:

score: 0
Accepted
time: 131ms
memory: 38924kb

input:

100000 99999
13413 22698
22698 36667
13413 64418
36667 75207
36667 73542
75207 91445
64418 3222
36667 96990
73542 61771
96990 33073
22698 32560
33073 24210
33073 38905
75207 46243
75207 89600
89600 11756
36667 94609
89600 6427
3222 46213
11756 43560
46243 50875
36667 45066
24210 54458
36667 80150
22...

output:

2

result:

ok "2"

Test #9:

score: 0
Accepted
time: 127ms
memory: 39088kb

input:

100000 99999
77731 86926
77731 23800
86926 89529
23800 33493
86926 30923
23800 25737
23800 48382
25737 35288
48382 23623
35288 83350
35288 43718
89529 46770
30923 29
30923 73178
86926 8382
46770 75585
48382 67116
30923 20689
30923 97292
23800 82313
35288 85630
82313 74213
86926 48620
97292 86647
257...

output:

2

result:

ok "2"

Test #10:

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

input:

100000 99999
4582 99058
99058 87803
87803 5778
5778 21286
99058 64435
5778 25340
99058 84070
99058 92757
87803 48753
21286 71681
21286 50429
71681 22737
21286 48717
48717 81253
64435 23411
5778 30866
81253 76210
50429 16277
81253 16082
99058 32379
84070 95446
76210 40309
76210 35756
25340 71091
2273...

output:

2

result:

ok "2"

Test #11:

score: 0
Accepted
time: 127ms
memory: 39076kb

input:

100000 99999
34790 25024
25024 36551
34790 82646
82646 38938
25024 1562
34790 95790
1562 76262
76262 24681
38938 4943
95790 8669
95790 88401
4943 41293
38938 21530
41293 66721
34790 9066
25024 73316
76262 47595
25024 59910
66721 46517
82646 46936
21530 22361
9066 94253
1562 46296
94253 13074
59910 7...

output:

2

result:

ok "2"

Test #12:

score: 0
Accepted
time: 129ms
memory: 39088kb

input:

100000 99999
98079 73822
73822 63887
73822 71664
98079 65268
65268 72803
71664 77367
65268 85207
77367 39346
65268 55506
63887 49410
85207 35890
55506 51351
85207 87756
51351 47722
87756 31267
35890 91571
39346 9577
31267 31563
91571 59354
87756 27975
85207 59323
27975 34647
63887 52810
31267 83138
...

output:

2

result:

ok "2"

Test #13:

score: 0
Accepted
time: 140ms
memory: 51124kb

input:

100000 100000
42276 12823
12823 87747
87747 59217
59217 2160
2160 85115
85115 75999
75999 74783
74783 84010
84010 20464
20464 41872
41872 31981
31981 2637
2637 97876
97876 70375
70375 63190
63190 65186
65186 42079
42079 60599
60599 76194
76194 30514
30514 69887
69887 87790
87790 88443
88443 63301
63...

output:

1

result:

ok "1"

Test #14:

score: 0
Accepted
time: 121ms
memory: 39024kb

input:

100000 99839
3777 83777
92737 22487
3405 34804
3405 63348
71869 16450
25024 77034
45886 70138
46420 99380
71372 15729
62782 59134
62782 17644
40931 60627
41776 72468
26424 19072
26424 62020
82982 49540
57857 19904
13263 65383
30740 28382
30740 59687
76880 49124
88187 10493
56456 27193
56456 95532
76...

output:

0

result:

ok "0"

Test #15:

score: 0
Accepted
time: 132ms
memory: 39524kb

input:

100000 99846
66429 19818
1142 65323
89629 2650
89629 42870
60529 13997
20679 78690
20679 5269
8110 28183
34782 58319
26797 17740
21871 93617
83053 29948
14688 55200
52483 73309
56841 6633
56841 55711
95177 89002
57442 17594
16875 7796
16875 8418
33959 24119
33959 33295
67593 42353
36122 96814
36122 ...

output:

1

result:

ok "1"

Test #16:

score: 0
Accepted
time: 118ms
memory: 39348kb

input:

100000 99840
61287 64073
89052 6689
89052 74027
83146 40301
55950 89689
89833 57298
89833 42280
19736 77515
19736 50538
31174 39104
14153 51424
14153 31424
56843 90058
46315 9861
81108 51034
47276 31883
47276 13174
25797 42555
18853 97994
67050 80142
7186 30565
45598 65037
72065 47586
72065 52587
44...

output:

0

result:

ok "0"

Test #17:

score: 0
Accepted
time: 127ms
memory: 39356kb

input:

100000 99837
52632 49066
8207 69824
92267 29339
87828 81159
86585 34918
5072 88375
5072 46372
4237 72777
4237 66222
32455 3061
17684 42281
41275 34536
72839 74066
45095 66825
45095 188
31633 52839
14240 7205
14240 62813
37523 40559
37523 22436
95403 86964
95403 75
24404 73
54534 32797
46562 88745
70...

output:

0

result:

ok "0"

Test #18:

score: 0
Accepted
time: 129ms
memory: 46924kb

input:

100000 200000
91756 69297
91756 4545
91756 53749
91756 54529
91756 72391
91756 1260
91756 94514
69297 56396
69297 94148
69297 44667
69297 73169
69297 81731
19501 62537
19501 96669
19501 78118
19501 59314
19501 21054
19501 96372
19501 39387
19501 50363
19501 80139
19501 8413
34623 10037
34623 20572
1...

output:

0

result:

ok "0"

Test #19:

score: 0
Accepted
time: 132ms
memory: 46908kb

input:

100000 199999
94566 78687
94566 29032
94566 67782
94566 6508
22336 61573
22336 97677
22336 16991
22336 37766
22336 58704
22336 6768
22336 60250
22336 33412
22336 11114
56860 62498
56860 75679
56860 66179
56860 8667
56860 29468
27072 73747
27072 41786
58625 45299
58625 63322
58625 47995
58625 92457
5...

output:

1

result:

ok "1"

Test #20:

score: 0
Accepted
time: 151ms
memory: 46860kb

input:

100000 200000
63297 8550
8550 32177
51432 73182
51432 58376
51432 69230
51432 80665
51432 5820
51432 838
51432 56363
51432 54831
49996 90440
9454 36288
9454 28865
9454 29427
9454 65869
9454 3873
43428 11265
43428 94947
43428 42111
43428 37174
43428 7958
29294 9492
29294 8679
29294 35337
29294 36502
...

output:

1

result:

ok "1"

Test #21:

score: 0
Accepted
time: 156ms
memory: 46928kb

input:

100000 199999
56140 59888
56140 87488
56140 12141
56140 16288
21681 30305
72961 39652
72961 1100
72961 75323
72961 25863
72961 97742
72961 46985
1788 2783
1788 27296
1788 74570
1788 10383
29064 25383
29064 755
29064 53489
29064 48560
29064 4640
29064 40413
42669 67211
42669 57782
42669 27001
42669 2...

output:

1

result:

ok "1"

Test #22:

score: 0
Accepted
time: 134ms
memory: 48844kb

input:

100000 200000
76792 41618
76792 2994
76792 66994
41618 43132
41618 24683
98823 15907
98823 40831
98823 66868
98823 20541
98823 40792
98823 8862
98823 10058
2768 59758
2768 41077
2768 33608
2768 87768
2768 26657
2768 36724
46106 79741
46106 75290
46106 83070
46106 91390
46106 62979
39265 25194
39265 ...

output:

0

result:

ok "0"

Test #23:

score: 0
Accepted
time: 125ms
memory: 46832kb

input:

100000 199999
65590 91319
65590 30114
65590 46403
78314 98724
78314 21511
78314 13560
81894 16578
81894 93242
81894 9144
20393 51407
20393 88343
20393 83500
20393 12937
64544 47618
64544 36094
64544 4796
90796 93290
93993 77022
93993 43934
93993 17850
93993 54499
87485 77840
8296 48819
8296 50145
82...

output:

1

result:

ok "1"

Test #24:

score: 0
Accepted
time: 136ms
memory: 47000kb

input:

100000 200000
15100 2612
15100 51128
15100 41088
15100 52239
15100 2961
2612 75789
2612 46730
65642 55206
65642 59890
65642 53259
65642 14064
65642 29864
65642 62246
65642 74737
71880 76601
19815 84934
19815 38587
19815 56785
19815 14717
19815 28267
49803 74472
49803 44409
49803 5474
49803 77604
498...

output:

0

result:

ok "0"

Test #25:

score: 0
Accepted
time: 137ms
memory: 46996kb

input:

100000 199999
32285 28181
32285 90448
32285 48162
32285 32465
32285 73917
32285 87170
32285 7400
32285 93233
32285 75839
19581 94908
19581 18132
19581 55169
19581 93369
44561 68212
44561 54120
44561 33032
15002 30875
15002 96098
19544 89038
19544 163
19544 17494
19544 22947
80145 40370
80145 23557
8...

output:

1

result:

ok "1"

Test #26:

score: 0
Accepted
time: 128ms
memory: 46848kb

input:

100000 200000
49373 2369
49373 17483
49373 65652
49373 95405
49373 46786
2369 10898
2369 12967
86450 10641
86450 49822
86450 74852
86450 14764
77415 65769
82111 84889
82111 71051
82111 36801
53747 36450
53747 6525
53747 56059
53747 56492
53747 56916
53747 53186
53747 11007
83101 71005
83101 6329
557...

output:

0

result:

ok "0"

Test #27:

score: 0
Accepted
time: 134ms
memory: 46904kb

input:

100000 199999
88229 64926
88229 70300
88229 81123
97593 39624
61590 93936
61590 13567
61590 35093
61590 25373
61590 14275
61590 54335
99727 61899
99727 6861
99727 89069
6566 9055
6566 30372
6566 31216
6566 8889
94812 3459
94812 14488
94812 6244
94812 90653
94812 39129
94812 86539
23811 67599
23811 2...

output:

1

result:

ok "1"

Test #28:

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

input:

100000 100000
12782 1427
12782 61539
12782 78356
61539 1427
38177 33360
38177 66105
66105 33360
59141 9717
59141 38018
38018 9717
41527 43338
41527 32581
32581 43338
587 29212
587 40292
40292 29212
74851 82018
74851 86189
86189 82018
60878 37373
60878 2716
2716 37373
27536 52232
27536 98625
98625 52...

output:

1

result:

ok "1"

Test #29:

score: 0
Accepted
time: 129ms
memory: 40804kb

input:

100000 99999
9725 47115
9725 92937
92937 47115
93074 10761
93074 77555
77555 10761
8980 21140
8980 77273
77273 21140
8690 28013
8690 28732
28732 28013
37675 18792
37675 46231
46231 18792
59492 37784
59492 22749
22749 37784
10016 39846
10016 92905
92905 39846
74448 99119
74448 88416
88416 99119
80499...

output:

2

result:

ok "2"

Test #30:

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

input:

100000 133332
20602 87942
20602 22875
20602 88828
87942 95568
87942 56514
87942 5201
87942 593
87942 15972
87942 2273
22875 87942
22875 16811
22875 1579
22875 99075
22875 13674
22875 49384
22875 31505
22875 28388
40170 13065
40170 95568
13065 13106
13065 40105
13065 63940
13065 94731
13065 74790
955...

output:

0

result:

ok "0"

Test #31:

score: 0
Accepted
time: 140ms
memory: 45028kb

input:

100000 133331
91850 2170
91850 99292
2170 33650
2170 42295
2170 13174
2170 54653
2170 45982
2170 83126
99292 2170
99292 56502
99292 56633
99292 24559
99292 5451
99292 74211
99292 85574
99292 72448
59067 56795
59067 33650
56795 85861
56795 29873
56795 65722
56795 32693
56795 65221
33650 56795
33650 7...

output:

1

result:

ok "1"

Test #32:

score: 0
Accepted
time: 109ms
memory: 39604kb

input:

100000 133332
45923 24693
45923 60220
45923 6524
24693 72775
24693 74123
24693 57104
24693 88516
24693 24785
60220 24693
60220 2460
60220 92453
60220 40116
60220 71744
60220 33638
60220 62622
87240 10451
87240 72775
10451 41287
10451 6484
10451 66385
10451 5512
10451 22504
10451 57692
10451 26762
10...

output:

0

result:

ok "0"

Test #33:

score: 0
Accepted
time: 146ms
memory: 45152kb

input:

100000 133331
91332 29023
91332 33541
29023 97139
29023 85847
29023 22094
29023 59626
29023 74196
33541 29023
33541 80475
33541 61117
33541 21237
33541 93539
33541 51217
98037 97139
98037 52061
97139 5437
97139 36784
97139 65590
97139 89510
52061 97139
52061 67162
52061 398
52061 62715
52061 69255
5...

output:

1

result:

ok "1"

Test #34:

score: 0
Accepted
time: 134ms
memory: 44632kb

input:

100000 133332
57275 80079
57275 13289
57275 24608
80079 88320
80079 46252
80079 51694
80079 27851
80079 85403
80079 57776
13289 80079
13289 38494
13289 78321
13289 56497
13289 55746
13289 13027
13289 95246
13289 15539
13289 78824
13289 53042
13289 38909
38494 1607
38494 16885
1607 15422
1607 59267
1...

output:

0

result:

ok "0"

Test #35:

score: 0
Accepted
time: 144ms
memory: 45000kb

input:

100000 133331
55897 54829
55897 15004
54829 13933
54829 2016
54829 63432
54829 36968
15004 54829
15004 27182
15004 21972
15004 63071
15004 32965
15004 95880
15004 10940
48169 26761
48169 27182
26761 97602
26761 48113
26761 97213
26761 50417
27182 26761
27182 79205
27182 51762
27182 80000
27182 68054...

output:

1

result:

ok "1"

Test #36:

score: 0
Accepted
time: 149ms
memory: 45080kb

input:

100000 133332
95747 57100
95747 30124
95747 45134
57100 39344
57100 86447
57100 4560
57100 2089
30124 57100
30124 76643
30124 7072
30124 40945
30124 14425
74183 76643
74183 81658
76643 98402
76643 76432
76643 95791
76643 63492
76643 41571
81658 76643
81658 48889
81658 25225
81658 43314
81658 74915
8...

output:

0

result:

ok "0"

Test #37:

score: 0
Accepted
time: 160ms
memory: 44992kb

input:

100000 133331
42034 84866
42034 93541
84866 1090
84866 15818
84866 52591
84866 48764
84866 16189
84866 46065
93541 84866
93541 9575
93541 65894
93541 96143
93541 32250
93541 48749
93541 52479
63806 9575
63806 36426
9575 41405
9575 10127
36426 9575
36426 38099
36426 92933
36426 91373
36426 73603
1090...

output:

1

result:

ok "1"

Test #38:

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

input:

100000 1
73796 73658

output:

4

result:

ok "4"

Test #39:

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

input:

1 0

output:

-1

result:

ok "-1"

Test #40:

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

input:

100000 4
65605 44332
51507 44332
51507 65605
65605 30171

output:

1

result:

ok "1"

Test #41:

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

input:

100000 5
45875 83164
83164 27206
27206 69086
69086 35608
45875 69086

output:

1

result:

ok "1"

Test #42:

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

input:

100000 5
43465 64107
58999 64107
67634 58999
67634 5008
5008 43465

output:

1

result:

ok "1"

Test #43:

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

input:

100000 6
77974 27608
11521 27608
33686 11521
33686 88732
88732 77974
88732 79851

output:

1

result:

ok "1"

Test #44:

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

input:

100000 2
90920 72062
29894 73477

output:

3

result:

ok "3"

Test #45:

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

input:

100000 2
2755 38946
47079 1382

output:

3

result:

ok "3"

Test #46:

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

input:

100000 2
25450 83037
25450 32030

output:

3

result:

ok "3"

Test #47:

score: 0
Accepted
time: 5ms
memory: 13664kb

input:

100000 5
98393 5420
98393 76746
5420 76746
98393 56661
76746 56661

output:

0

result:

ok "0"

Test #48:

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

input:

100000 5
73916 10016
73916 40612
10016 40612
73916 21880
40612 21880

output:

0

result:

ok "0"

Test #49:

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

input:

100000 5
51214 23953
51214 62794
23953 62794
51214 71193
62794 71193

output:

0

result:

ok "0"

Test #50:

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

input:

100000 5
29461 98984
29461 58533
98984 58533
29461 31408
58533 31408

output:

0

result:

ok "0"

Test #51:

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

input:

100000 5
64928 95264
64928 16114
95264 16114
64928 39868
16114 39868

output:

0

result:

ok "0"

Test #52:

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

input:

100000 5
20623 55739
20623 5249
55739 5249
20623 29665
5249 29665

output:

0

result:

ok "0"

Test #53:

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

input:

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

output:

2

result:

ok "2"

Test #54:

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

input:

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

output:

1

result:

ok "1"

Test #55:

score: 0
Accepted
time: 5ms
memory: 13940kb

input:

100000 6
91118 6768
6768 46412
91118 46412
41180 42073
42073 17466
41180 81636

output:

1

result:

ok "1"

Test #56:

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

input:

100000 6
11482 91423
91423 38065
11482 38065
27151 28140
27151 95519
27151 65886

output:

2

result:

ok "2"

Test #57:

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

input:

100000 6
98629 68209
68209 46000
98629 46000
2353 3760
3760 79720
2353 84439

output:

1

result:

ok "1"

Test #58:

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

input:

100000 6
43200 46353
46353 1696
43200 1696
93647 15138
93647 73126
93647 97937

output:

2

result:

ok "2"