QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#101806#1173. Knowledge Is...1kriWA 25ms5924kbC++141.2kb2023-05-01 10:42:222023-05-01 10:42:24

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-01 10:42:24]
  • 评测
  • 测评结果:WA
  • 用时:25ms
  • 内存:5924kb
  • [2023-05-01 10:42:22]
  • 提交

answer

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
using namespace std;
int n,m;
struct Seg{
	int l,r,id;
	bool operator <(const Seg &y)const{
		return l<y.l;
	}
}a[200005];
struct node{
	int p,id;
	bool operator <(const node &y)const{
		if (p==y.p)return id<y.id;
		return p<y.p;
	}
};
node make_node(int p,int id){
	node ans;
	ans.p=p,ans.id=id;
	return ans;
}
set<node> c,d;
int t[200005];
int ans[200005];
int main(){
	cin>>n>>m;
	for (int i=1;i<=n;i++)scanf("%d%d",&a[i].l,&a[i].r),a[i].id=i;
	sort(a+1,a+1+n);
	for (int i=1;i<=n;i++){
		set<node>::iterator it=c.begin();
		if (it!=c.end()&&((*it).p<a[i].l)){
			t[a[i].id]=(*it).id;
			c.erase(it);
			d.insert(make_node(a[i].r,a[i].id));
		}
		else{
			it=d.begin();
			if (it!=d.end()&&((*it).p<a[i].r)){
				t[a[i].id]=t[(*it).id];
				t[(*it).id]=0;
				d.erase(it);
				c.insert((*it));
				d.insert(make_node(a[i].r,a[i].id));
			}
			else c.insert(make_node(a[i].r,a[i].id));
		}
	}
	for (int i=1;i<=n;i++)
		if (m>0&&t[i]>0)ans[t[i]]=ans[i]=m,m--;
	for (int i=1;i<=n;i++)
		if (m>0&&ans[i]==0)ans[i]=m,m--;
	for (int i=1;i<=n;i++)printf("%d ",ans[i]);
	cout<<endl; 
	return 0;
}

詳細信息

Test #1:

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

input:

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

output:

5 2 3 4 4 3 5 

result:

ok answer = 7

Test #2:

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

input:

2 2
1 2
3 4

output:

2 2 

result:

ok answer = 2

Test #3:

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

input:

2 1
1 2
2 3

output:

1 0 

result:

ok answer = 1

Test #4:

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

input:

1 1
4 26

output:

1 

result:

ok answer = 1

Test #5:

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

input:

500 258
1 3
3 5
2 4
3 5
4 5
4 5
1 4
1 2
3 5
2 5
2 5
4 5
4 5
4 5
2 3
1 4
1 4
1 4
4 5
4 5
2 3
4 5
3 5
3 5
1 5
1 4
2 5
1 5
3 5
3 4
4 5
2 3
3 5
3 5
4 5
2 3
1 5
1 5
2 3
2 3
3 4
3 5
3 4
1 3
1 2
1 5
4 5
2 3
2 4
1 3
4 5
4 5
4 5
1 3
3 5
4 5
3 5
1 5
1 2
1 2
3 5
3 5
4 5
3 4
3 5
2 3
2 5
2 4
2 5
3 5
2 3
1 5
4 5
...

output:

237 258 140 257 256 255 139 235 254 138 137 253 252 251 238 136 135 134 250 249 156 248 247 246 133 132 131 130 245 129 244 216 243 242 241 215 128 127 161 160 126 240 125 159 223 124 239 158 123 197 238 237 122 241 236 121 235 120 165 189 234 233 119 118 232 213 117 116 115 231 214 114 113 112 111 ...

result:

ok answer = 376

Test #6:

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

input:

500 242
8 9
9 10
2 9
8 10
9 10
6 10
4 8
4 5
2 6
7 10
3 8
1 8
1 6
5 9
7 8
8 10
8 9
8 10
2 9
2 3
6 8
3 10
5 9
1 3
6 8
4 10
9 10
8 9
8 10
1 9
3 9
3 7
2 3
6 10
3 6
6 10
3 4
3 6
9 10
5 7
8 10
6 10
5 6
5 7
7 8
1 3
4 7
9 10
4 9
2 4
8 9
1 3
8 10
3 4
9 10
4 9
5 10
8 9
1 3
1 5
8 10
3 4
8 9
3 9
3 6
3 10
6 7
7 ...

output:

13 242 12 241 240 239 33 239 49 238 35 21 80 11 242 237 10 236 9 180 18 8 7 194 240 235 234 6 233 5 4 39 123 232 218 231 58 37 230 163 229 228 200 229 32 201 181 227 3 20 226 209 225 223 224 2 223 1 217 149 222 15 221 0 174 220 184 14 0 219 51 218 217 216 176 215 36 146 164 0 114 116 214 213 213 212...

result:

ok answer = 471

Test #7:

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

input:

500 250
50 84
36 68
94 98
13 88
4 62
45 74
80 89
56 87
65 89
44 52
69 78
29 76
61 90
91 99
16 98
69 92
50 77
86 95
73 79
83 90
78 89
1 79
81 86
14 37
91 94
27 48
11 73
94 97
49 80
15 60
26 39
34 76
69 77
22 72
6 78
92 96
46 83
83 94
62 95
77 80
32 72
46 90
41 88
47 91
68 75
14 36
26 43
14 87
49 74
2...

output:

250 166 249 214 127 38 248 247 246 197 181 80 245 244 243 242 28 241 240 239 238 132 237 51 236 225 83 235 234 245 116 229 115 99 178 233 232 231 230 229 13 228 227 226 210 182 228 77 131 227 225 224 109 223 201 126 58 222 221 220 44 219 72 218 217 216 215 45 214 213 212 211 210 235 209 233 93 208 2...

result:

ok answer = 500

Test #8:

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

input:

500 250
614 964
380 709
272 969
626 788
156 927
270 842
448 984
184 224
602 953
249 887
665 904
212 300
715 787
557 948
906 977
117 824
504 567
848 884
817 824
462 930
768 816
890 940
193 784
653 897
973 974
21 64
515 700
361 595
670 1000
854 943
530 739
816 828
918 979
270 354
288 369
56 697
622 92...

output:

250 148 249 187 248 247 246 132 245 244 243 58 203 242 241 5 134 240 239 238 237 236 115 235 234 97 193 93 233 232 241 231 230 89 190 86 229 228 227 226 177 225 130 170 224 223 222 221 220 186 219 218 60 33 217 7 216 215 214 229 213 121 248 43 212 157 9 35 211 1 150 26 210 172 123 75 209 214 185 240...

result:

ok answer = 500

Test #9:

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

input:

500 250
7369 7544
7194 8983
8758 9759
1077 5486
8604 9375
9468 9854
9259 9276
6147 7585
2527 2818
1034 2634
1382 3694
1863 8040
5952 6207
685 3506
3618 9242
1204 3382
569 8063
6515 6861
6025 7856
2053 7457
961 3813
87 9321
2787 9389
4754 8473
6781 7817
7113 9489
6831 9207
5210 9788
7003 8417
9361 99...

output:

220 250 249 151 248 247 246 133 155 4 17 166 97 186 245 224 139 118 125 86 98 13 244 243 49 242 241 240 239 238 145 237 236 6 183 14 95 107 235 234 233 232 241 231 230 159 229 140 41 228 56 150 227 90 27 226 225 224 249 223 2 35 222 24 221 195 148 220 219 218 217 239 216 113 215 197 200 143 214 213 ...

result:

ok answer = 500

Test #10:

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

input:

500 250
94664 97792
42412 79567
78199 93246
1309 6050
21787 62661
32852 47312
72165 96025
22335 87724
98737 98949
32333 45109
98197 98696
66004 84303
64971 93765
48220 78217
75132 77121
3250 99214
76296 83179
18937 19783
24224 29268
76617 77302
64571 88215
56891 67172
32945 97861
75 35393
74113 9254...

output:

250 249 248 223 92 155 247 246 245 159 244 243 242 214 143 241 240 140 78 116 239 171 238 120 237 236 235 231 91 234 233 10 232 231 230 203 243 229 74 50 228 197 160 227 226 69 225 224 62 223 75 20 6 222 221 220 219 218 123 217 30 49 64 216 8 215 124 214 213 212 137 36 211 210 149 209 208 109 79 96 ...

result:

ok answer = 500

Test #11:

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

input:

500 250
249258 633953
692064 923461
236526 494453
63236 665418
813697 915066
231324 853677
850867 946695
354813 439441
555846 920488
978644 998640
280905 357712
300337 869138
111591 375301
754196 825433
681966 906746
566646 913535
958025 996696
122927 989918
162477 948024
464228 474279
735561 874801...

output:

9 250 114 14 249 181 248 83 247 246 165 245 106 244 243 242 241 240 239 25 238 47 30 209 197 237 236 2 235 246 234 233 232 149 231 148 230 229 228 76 220 227 228 226 232 225 71 237 224 223 222 145 222 34 221 226 220 219 218 63 217 216 16 161 19 55 215 89 214 94 213 212 143 132 129 211 210 22 209 208...

result:

ok answer = 500

Test #12:

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

input:

500 250
6592945 8873042
9610368 9920200
3224618 6472104
7312354 9075859
366928 6614625
7107690 8990826
4712035 4850963
8634845 9127832
7054047 9358572
9187658 9589004
6621468 7586829
7375455 9328669
2076424 5016969
8848028 9107864
6625184 7368290
801465 9195989
3228163 3972918
3386844 9342995
366556...

output:

250 249 99 248 190 247 217 246 245 244 226 243 131 242 117 42 135 241 28 1 22 9 240 45 239 88 238 237 236 235 148 140 142 3 206 234 233 232 231 230 89 229 228 21 62 240 227 226 225 130 224 218 154 150 87 223 222 125 221 220 198 219 218 217 96 239 216 215 8 223 214 213 6 171 75 212 182 211 210 209 15...

result:

ok answer = 500

Test #13:

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

input:

500 250
80571694 85803063
51768736 93848632
66413497 76615996
83050382 99992350
8073944 91324998
18047715 58689728
8708611 51201572
29489394 73271018
24239602 65348190
64220050 71579063
50414980 65877100
86190696 92867069
34515283 94334986
8551872 68258618
18296336 36436754
94799273 95174013
8666001...

output:

250 249 10 248 79 127 210 5 43 223 55 247 246 184 7 245 244 243 156 26 11 242 241 240 84 239 238 237 236 59 38 119 83 37 201 174 74 235 234 173 6 233 231 132 232 195 110 231 113 230 229 211 228 227 52 226 225 67 224 130 223 222 23 244 50 221 60 220 219 218 8 217 204 216 176 215 175 230 214 213 212 2...

result:

ok answer = 500

Test #14:

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

input:

500 250
966174904 986708402
946554500 952001265
914838165 993300555
89795526 975540133
235762788 364735276
340662053 547524158
330027012 366955963
633114013 756706517
868314624 992777729
843328851 965147665
943958099 956095329
243336632 710281553
576757478 948905845
778782824 978759308
370097409 470...

output:

250 249 248 224 184 82 248 205 247 246 245 62 244 243 240 129 217 10 242 241 51 240 187 239 166 157 238 237 236 235 137 37 225 99 234 233 232 161 79 231 230 238 20 28 229 228 1 165 196 227 226 225 224 223 222 221 61 136 95 220 219 209 218 217 66 216 93 47 81 215 214 142 213 212 16 211 210 209 208 11...

result:

ok answer = 500

Test #15:

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

input:

500 67
1 2
1 2
2 3
1 2
2 3
1 3
1 3
2 3
2 3
1 2
1 3
2 3
1 2
1 2
2 3
2 3
2 3
1 3
2 3
1 2
1 3
2 3
2 3
2 3
2 3
1 2
2 3
2 3
1 3
2 3
1 3
2 3
1 2
1 2
1 2
2 3
1 2
2 3
2 3
2 3
1 2
2 3
1 3
2 3
1 2
1 2
2 3
1 2
1 3
1 2
2 3
2 3
1 3
1 3
1 2
1 2
1 2
1 2
2 3
2 3
1 2
2 3
1 2
1 3
1 3
2 3
1 3
1 3
2 3
1 3
1 3
2 3
1 3
1...

output:

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

result:

ok answer = 67

Test #16:

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

input:

500 379
2 5
2 4
4 5
4 5
4 5
1 4
2 5
4 5
4 5
4 5
1 5
4 5
3 5
3 5
3 5
1 3
1 5
3 5
1 2
4 5
4 5
4 5
3 4
4 5
4 5
4 5
3 5
3 5
1 3
2 4
1 2
4 5
2 3
1 5
2 5
2 5
1 3
1 4
4 5
1 2
3 5
4 5
1 3
1 5
1 5
3 5
4 5
3 4
4 5
4 5
3 5
3 4
2 4
4 5
1 4
1 3
1 4
4 5
1 4
4 5
1 4
4 5
4 5
4 5
2 3
1 2
3 4
1 3
3 4
2 5
1 3
3 4
1 5
...

output:

275 274 379 378 377 273 272 376 375 374 271 373 372 371 370 324 270 369 310 368 367 366 269 365 364 363 268 267 294 266 360 362 322 265 264 263 359 262 361 300 360 359 342 261 260 358 357 259 356 355 354 258 257 256 255 341 254 253 252 251 250 249 248 247 292 302 246 340 245 244 293 243 242 357 241 ...

result:

ok answer = 483

Test #17:

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

input:

500 273
1 9
7 10
1 2
2 9
5 6
9 10
8 10
5 6
2 3
3 10
4 8
4 7
9 10
8 9
1 9
1 4
3 5
9 10
9 10
1 6
2 10
7 9
8 9
9 10
5 8
7 10
4 8
5 6
8 9
1 2
1 5
6 8
7 10
9 10
3 7
7 9
3 8
1 9
2 9
3 6
5 10
4 5
5 9
3 9
5 8
1 8
5 8
7 10
7 8
9 10
1 8
7 9
5 9
7 9
7 10
9 10
1 8
2 4
7 8
1 8
3 6
4 7
6 8
7 10
2 7
9 10
2 3
6 8
1...

output:

52 273 270 51 123 272 271 212 98 270 57 88 269 268 50 61 152 267 266 60 49 265 264 263 68 262 64 208 261 135 210 75 260 259 79 258 58 48 47 230 257 207 46 45 225 189 191 256 192 255 196 254 44 253 252 251 202 124 206 213 224 183 214 250 70 249 179 217 73 163 76 248 247 246 147 119 227 180 245 101 24...

result:

ok answer = 494

Test #18:

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

input:

500 250
47 82
75 84
56 61
27 57
32 48
28 85
15 38
36 39
56 65
88 94
87 97
64 79
15 51
50 93
83 100
74 77
59 74
66 99
57 78
51 90
47 76
64 68
89 97
15 71
38 54
57 83
26 91
90 94
98 100
70 73
40 75
52 82
67 100
14 85
57 62
47 53
40 63
79 97
3 33
16 61
4 94
94 99
68 80
23 30
41 81
54 81
51 52
36 45
54 ...

output:

250 249 7 70 68 248 178 139 45 247 246 245 144 244 243 8 31 242 15 241 142 222 240 117 226 239 238 237 236 194 94 235 234 67 22 217 246 233 21 2 78 232 231 134 230 229 187 130 228 204 113 82 227 226 225 34 224 223 222 221 220 219 218 205 81 217 216 215 214 146 213 125 212 141 211 210 188 209 208 242...

result:

ok answer = 500

Test #19:

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

input:

500 250
151 592
747 974
832 938
56 960
567 882
851 900
338 901
168 265
916 964
581 880
177 284
456 921
298 540
378 651
190 785
908 992
180 371
271 823
245 983
328 603
211 425
561 996
61 134
820 934
934 975
595 945
896 982
245 443
208 487
567 945
999 1000
483 748
882 887
383 459
607 910
57 797
12 771...

output:

236 250 249 73 248 247 246 141 245 244 14 243 173 139 206 242 172 241 240 231 44 239 137 238 237 236 235 51 108 234 233 178 232 166 231 103 136 230 229 9 78 198 228 207 227 226 34 104 225 132 151 29 90 224 223 222 125 221 28 102 27 220 219 204 218 217 216 215 140 214 134 109 203 97 243 213 212 167 2...

result:

ok answer = 500

Test #20:

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

input:

500 250
8878 9054
7943 8545
9886 9945
6698 8053
3466 6453
8106 8870
7114 9642
4807 4824
2334 4079
2778 3817
5111 7104
1252 4542
3555 6851
3663 5645
5567 7655
324 2086
4056 8603
1406 7470
9064 9448
1484 5836
7466 7945
2607 3711
5253 6112
3192 4008
9549 9852
9198 9709
4169 8558
2268 7806
5575 6209
826...

output:

250 249 248 247 2 246 245 188 32 185 229 220 165 72 99 199 244 87 243 155 242 168 122 182 241 240 239 120 103 238 62 237 243 17 236 129 83 235 158 102 234 233 232 231 230 229 228 227 208 226 162 225 16 79 242 13 224 53 227 46 223 107 222 221 220 219 218 217 232 216 215 214 213 212 80 211 64 210 117 ...

result:

ok answer = 500

Test #21:

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

input:

500 251
46165 49590
70151 85269
27899 40324
62135 64549
79159 94410
75003 79189
50178 81874
56192 88209
21577 95025
84261 96039
18414 90970
81196 83290
83331 83488
14574 39965
4268 32434
88164 89600
12144 29112
870 72365
9975 51580
92179 98369
28511 57700
33237 75390
24902 28700
94544 95300
65682 97...

output:

74 251 174 220 250 249 248 247 246 245 244 243 242 115 84 241 4 146 67 240 228 88 86 239 238 118 237 98 113 119 215 194 182 22 226 236 9 56 249 237 77 235 134 140 234 233 198 233 229 232 231 78 230 234 229 228 227 226 225 89 202 224 223 245 105 138 222 94 108 61 101 142 221 220 204 219 218 83 217 39...

result:

ok answer = 500

Test #22:

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

input:

500 250
997100 999305
50160 723310
530874 700434
482814 725372
898138 942005
227563 606578
465297 983061
288595 865469
971584 983736
84196 662089
716660 851207
874207 995804
742642 760966
412491 418432
721831 897885
453604 941851
404413 589262
363242 694198
71736 189776
340057 706243
591745 899767
9...

output:

250 201 40 185 249 213 248 247 246 158 245 244 235 20 243 242 206 231 182 193 241 240 46 65 150 236 240 147 87 239 68 238 237 90 103 236 235 60 25 234 110 233 232 231 224 230 229 167 228 227 153 226 59 229 84 69 225 184 224 223 72 222 61 221 220 148 172 217 219 218 217 216 215 96 214 213 99 212 211 ...

result:

ok answer = 500

Test #23:

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

input:

500 250
816808 8979893
577273 5159166
6890110 9974354
7539249 9013575
7780990 9685125
284302 8308896
2859745 8347237
5896988 9556377
4465806 5463028
8279297 8819929
1361353 5720171
2467636 8115256
5879674 7044297
661648 5198202
4725290 5204346
2612798 8161805
9812485 9996590
2285372 4614496
1962475 ...

output:

195 122 250 249 248 189 247 246 16 245 146 141 140 113 223 48 244 51 243 242 241 34 240 74 105 239 238 10 237 236 166 29 243 186 81 235 245 88 234 233 143 121 91 232 185 231 230 229 59 117 228 47 227 41 226 225 224 223 222 221 134 227 220 110 219 14 194 218 76 217 84 6 216 46 215 175 18 214 213 4 21...

result:

ok answer = 500

Test #24:

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

input:

500 250
81661382 94717306
89850268 94839225
72615579 73753927
19190949 39608724
129611 33966748
36897319 96344937
77381982 94746565
49637131 94881993
71774738 87773217
5955861 68864001
55863683 69339123
25998069 29895468
85528105 96959461
12833512 31610705
4726009 31932075
18119656 87239085
31722731...

output:

250 249 82 35 117 248 247 246 245 21 147 170 244 243 208 69 243 102 242 241 179 240 183 239 238 237 190 236 139 235 168 224 234 142 233 232 231 166 153 230 229 134 228 23 237 209 52 150 2 227 22 226 225 212 132 126 224 223 196 222 11 221 220 73 198 219 218 217 60 216 65 215 3 214 154 213 212 54 201 ...

result:

ok answer = 500

Test #25:

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

input:

500 250
159147753 849387872
678679305 958626578
736410066 762171088
51820203 846735349
483826312 744440062
76859389 682174032
127183476 195547079
339099076 948562984
46616987 234754210
871306758 893541852
261351936 390635591
441516403 995769500
522385081 715755202
729932064 859205804
998688267 99968...

output:

211 250 60 50 140 217 161 249 164 248 174 247 71 246 245 244 243 242 241 240 43 11 239 123 91 25 182 238 10 183 237 232 236 235 234 233 73 232 105 231 74 230 229 242 228 224 227 66 196 226 132 225 70 224 150 223 130 173 222 162 221 220 18 72 235 250 145 219 218 40 217 53 216 97 215 214 213 212 211 3...

result:

ok answer = 500

Test #26:

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

input:

500 236
1 3
1 3
1 2
2 3
2 3
1 3
1 3
2 3
2 3
1 3
2 3
1 2
1 2
2 3
2 3
1 2
1 2
2 3
2 3
2 3
2 3
1 3
2 3
1 2
2 3
1 2
1 2
1 3
1 3
2 3
2 3
1 3
2 3
2 3
2 3
2 3
1 2
1 2
1 3
2 3
2 3
2 3
1 2
1 3
1 2
1 2
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
1 3
2 3
1 2
2 3
1 3
1 2
1 3
1 2
2 3
2 3
2 3
1 3
2 3
2 3
1 2
2 3
2 3
2 3
2 3
...

output:

236 235 234 233 232 231 230 229 228 227 226 225 224 223 222 221 220 219 218 217 216 215 214 213 212 211 210 209 208 207 206 205 204 203 202 201 200 199 198 197 196 195 194 193 192 191 190 189 188 187 186 185 184 183 182 181 180 179 178 177 176 175 174 173 172 171 170 169 168 167 166 165 164 163 162 ...

result:

ok answer = 236

Test #27:

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

input:

500 450
1 5
4 5
4 5
3 5
2 5
3 4
4 5
4 5
1 3
1 4
4 5
3 4
3 4
3 4
3 4
2 3
4 5
4 5
1 5
3 4
2 3
3 4
1 3
2 5
2 4
4 5
1 3
1 2
2 4
3 5
4 5
2 5
4 5
4 5
2 3
1 5
1 4
2 5
2 3
4 5
2 4
1 3
2 4
1 5
4 5
3 5
3 4
4 5
1 3
4 5
4 5
3 5
2 3
4 5
3 4
2 4
4 5
1 4
2 3
1 3
3 4
1 4
2 4
4 5
2 3
1 5
4 5
3 4
1 2
2 4
2 4
4 5
1 3
...

output:

345 450 449 448 344 343 447 446 352 342 445 341 340 339 338 364 444 443 337 336 376 335 375 334 333 442 353 388 332 441 440 331 439 438 377 330 329 328 362 437 327 358 326 325 436 324 323 435 365 434 433 322 391 432 321 320 431 319 363 356 318 317 316 430 361 315 429 314 346 313 312 311 366 310 349 ...

result:

ok answer = 500

Test #28:

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

input:

500 321
6 10
3 6
4 6
5 10
5 7
5 10
3 7
3 8
3 8
4 8
7 8
6 8
3 5
5 9
8 9
4 7
4 9
3 9
9 10
1 8
3 9
5 10
8 9
6 8
4 9
8 10
9 10
2 4
1 10
4 5
5 8
1 7
7 8
7 9
8 9
6 9
4 8
8 9
5 9
1 9
9 10
7 8
1 10
5 9
7 10
7 8
5 6
4 7
9 10
5 8
4 8
3 4
7 9
5 9
2 8
5 9
2 3
3 10
9 10
9 10
6 8
9 10
7 10
1 5
5 10
3 9
2 5
4 6
5 ...

output:

321 175 167 320 272 319 229 263 302 130 309 236 139 118 117 251 116 115 318 288 114 317 113 261 112 316 315 186 111 226 264 141 278 110 109 108 166 314 107 106 313 169 105 104 312 300 286 145 311 235 124 128 310 103 170 102 135 101 309 308 268 307 306 221 305 100 201 306 160 304 303 314 234 302 99 3...

result:

ok answer = 500

Test #29:

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

input:

500 282
8 65
78 90
26 99
97 99
94 95
1 56
62 73
41 87
46 51
70 78
81 99
15 52
98 100
39 54
31 53
20 34
9 77
75 84
2 29
4 79
92 96
6 34
23 28
4 7
11 65
3 90
63 69
48 72
82 95
41 93
47 53
65 92
46 76
39 87
25 60
87 97
18 53
10 18
68 100
31 69
38 74
15 57
40 54
16 33
46 68
77 78
42 88
45 72
14 47
2 10
...

output:

79 282 281 280 279 216 165 278 51 234 277 257 276 187 193 133 41 275 232 129 274 279 195 150 97 43 119 178 273 272 139 271 107 270 38 269 123 191 268 103 221 89 106 122 153 72 267 252 144 120 272 266 138 98 265 76 102 169 264 268 93 263 262 85 261 208 33 100 242 260 259 258 257 256 237 175 206 255 2...

result:

ok answer = 500

Test #30:

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

input:

500 300
510 553
741 866
603 700
36 128
503 944
356 533
43 466
917 960
375 678
38 84
603 748
900 954
951 972
25 548
965 980
204 928
541 594
362 453
904 939
4 547
322 583
870 911
359 470
397 896
772 953
95 483
527 853
631 748
886 955
178 468
127 202
249 912
869 887
154 386
688 948
847 853
783 908
881 ...

output:

167 300 234 149 299 266 163 298 115 190 110 297 296 128 295 294 189 290 293 144 98 292 66 291 290 119 289 84 288 54 294 287 286 291 285 284 283 282 281 193 280 279 162 278 277 153 168 276 222 236 275 160 157 225 274 198 125 273 96 272 271 68 270 269 268 267 266 265 264 274 65 166 108 263 179 201 262...

result:

ok answer = 500

Test #31:

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

input:

500 324
9666 9764
5 7711
5764 6747
2737 5398
4206 7020
351 4635
4073 5399
3611 9328
1945 8418
7455 9537
4107 8882
1584 6200
3868 4517
9853 9898
2506 4277
4014 7539
3274 7131
4991 9996
9163 9430
3958 6082
4305 9426
1905 6005
545 3515
7652 9689
1027 1438
1658 2555
3483 3669
3645 9546
3339 6780
368 978...

output:

324 185 221 130 291 109 171 323 255 322 321 298 268 320 317 75 133 319 318 272 317 193 127 316 297 152 247 315 241 195 314 308 314 313 215 312 311 283 194 119 310 309 231 88 161 308 200 307 306 140 103 230 305 304 197 147 303 134 240 302 300 284 301 300 218 299 298 81 87 112 297 295 100 151 296 224 ...

result:

ok answer = 500

Test #32:

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

input:

500 470
48935 84694
99749 99923
67360 75782
2621 28649
97920 99396
43999 62734
31792 93093
27130 95814
86217 97217
96404 98372
24819 99995
19043 61210
48522 67115
9948 85463
68373 86119
41827 44815
3885 70986
61638 63427
71822 81341
44961 51570
35696 82618
54669 54869
24868 37898
67579 83939
10309 5...

output:

470 469 425 432 468 407 467 466 465 464 463 386 352 271 462 394 412 317 461 254 460 409 275 459 301 458 408 292 457 442 243 436 456 462 430 466 455 274 316 454 453 431 452 451 421 309 428 469 246 314 223 326 450 378 422 415 264 449 401 448 447 446 347 445 444 443 442 403 441 440 439 383 438 437 436 ...

result:

ok answer = 500

Test #33:

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

input:

500 365
45762 693754
534202 559740
475894 692574
187566 781410
918494 925845
248194 930644
769148 995474
849975 944570
274210 388210
809281 978707
881685 943753
593867 809666
941967 942436
917009 921677
623403 694445
14648 44821
973042 987690
275841 883296
587146 857139
601250 981414
602336 913679
2...

output:

233 153 212 172 365 364 363 362 289 361 360 359 358 357 361 160 356 355 354 353 352 215 351 350 185 349 254 348 146 347 346 142 211 345 178 237 344 280 343 342 341 306 340 199 339 338 347 337 336 355 335 334 159 333 332 214 138 331 330 195 263 329 328 208 240 320 202 327 326 183 325 120 166 324 323 ...

result:

ok answer = 500

Test #34:

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

input:

500 435
8942882 9009137
2960339 4249642
6469497 9548984
1335505 1977271
8656424 8708138
8855830 9941526
120428 6845949
4297409 6050960
4211118 5999754
5292184 6371662
1257452 1532520
4172544 8586887
420009 9449705
9256685 9947310
6863833 8506653
5057204 7529960
4548338 8379192
3876868 8854349
331804...

output:

435 397 434 286 433 432 393 405 362 323 375 431 430 429 428 384 427 426 321 425 424 232 329 195 363 423 254 392 415 422 421 325 330 395 420 419 418 417 355 416 409 415 414 413 412 411 427 431 257 410 409 340 253 385 408 376 334 304 407 406 405 292 404 403 263 428 402 273 426 401 357 264 404 400 209 ...

result:

ok answer = 500

Test #35:

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

input:

500 331
9630011 57589654
22572747 68645689
38328399 81622066
94933642 97311408
58050148 62455346
37318915 88117879
68029610 74080275
87750454 92553676
46660595 74511474
32473872 49596859
63350036 89789394
75407776 80074289
80027461 88388093
61349773 99476335
69370190 83482845
70440345 73157341
67787...

output:

178 153 331 330 164 329 106 328 215 128 327 326 325 324 323 238 92 143 322 320 141 116 321 302 329 320 319 316 298 318 317 249 250 220 135 316 315 237 283 314 313 205 312 202 311 229 227 310 309 308 307 306 305 304 217 294 303 243 246 255 193 302 301 300 271 299 298 179 104 297 296 299 295 294 293 2...

result:

ok answer = 500

Test #36:

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

input:

500 477
343566419 927547482
827556406 860923139
786265094 867699424
768873550 983848460
587486802 980298997
991532621 996136199
878431940 941182908
689945290 738517801
517657626 628309437
983790110 985304593
272482247 338862765
740802646 818566102
938911500 949187177
185204729 426499829
724561978 76...

output:

477 476 475 474 473 472 471 262 438 470 407 469 468 437 267 428 337 368 467 231 279 466 465 363 329 464 367 455 357 360 260 458 467 303 327 463 462 461 460 442 423 456 430 459 364 458 457 369 434 435 275 347 456 380 348 455 454 425 429 372 453 452 451 450 439 449 448 323 447 446 426 424 445 256 464 ...

result:

ok answer = 500

Test #37:

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

input:

500 500
2 3
1 2
2 3
2 3
1 2
1 2
2 3
1 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
2 3
1 2
1 3
1 3
2 3
2 3
2 3
1 2
1 2
2 3
1 2
1 2
1 2
2 3
2 3
2 3
2 3
1 3
1 3
1 3
1 3
1 2
2 3
2 3
2 3
1 2
2 3
2 3
2 3
2 3
2 3
2 3
1 2
1 2
2 3
2 3
2 3
1 2
2 3
1 2
2 3
2 3
1 2
1 2
1 2
1 2
1 2
2 3
1 3
2 3
2 3
1 2
2 3
2 3
2 3
2 3
1 2
...

output:

500 499 498 497 496 495 494 493 492 491 490 489 488 487 486 485 484 483 482 481 480 479 478 477 476 475 474 473 472 471 470 469 468 467 466 465 464 463 462 461 460 459 458 457 456 455 454 453 452 451 450 449 448 447 446 445 444 443 442 441 440 439 438 437 436 435 434 433 432 431 430 429 428 427 426 ...

result:

ok answer = 500

Test #38:

score: -100
Wrong Answer
time: 25ms
memory: 5924kb

input:

300000 167770
1 5
1 3
1 2
2 3
2 5
2 4
1 2
4 5
4 5
2 5
4 5
4 5
3 4
4 5
3 5
4 5
1 4
2 4
2 5
3 4
4 5
4 5
1 3
4 5
4 5
2 5
4 5
2 3
3 4
3 4
1 3
2 5
2 4
4 5
2 5
3 5
2 5
2 3
4 5
4 5
4 5
3 4
2 4
3 4
4 5
2 5
1 2
2 4
3 4
2 3
1 3
2 5
2 5
2 4
1 3
4 5
3 4
1 3
4 5
3 4
4 5
1 4
2 4
1 3
2 3
1 5
1 2
4 5
4 5
1 4
3 4
2 ...

output:

3 2 1 0 

result:

wrong output format Unexpected end of file - int32 expected