QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#41383#4401. Prizewilly10835 3164ms208564kbC++237.0kb2022-07-30 04:52:332022-07-30 04:52:35

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-07-30 04:52:35]
  • 评测
  • 测评结果:35
  • 用时:3164ms
  • 内存:208564kb
  • [2022-07-30 04:52:33]
  • 提交

answer


//misaka and elaina will carry me to master
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <cassert>
#include <algorithm>
#include <vector>
#include <functional>
#include <numeric>
#include <set>
#include <array>
#include <queue>
#include <map>
#include <chrono>
#include <random>

#define ll long long
#define lb long double
#define sz(vec) ((int)(vec.size()))
#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair
#define kill(x, s) {int COND = x; if(COND){ cout << s << "\n"; return ; }}

#ifdef ONLINE_JUDGE
#define cerr while(0) cerr
#endif

const lb eps = 1e-9;
const ll mod = 1e9 + 7, ll_max = 1e18;
//const ll mod = (1 << (23)) * 119 +1, ll_max = 1e18;
const int MX = 1e6 +10, int_max = 0x3f3f3f3f;

struct {
  template<class T>
  operator T() {
    T x; std::cin >> x; return x;
  }
} in;

using namespace std;

struct hld{
	vector<int> dep, sz, par, head, tin, out;
	vector<vector<int>> adj;
	int n, ind;
	hld(){}
	hld(vector<pair<int, int>> edges, int rt = 1){
		n = sz(edges) + 1;
		ind = 0;
		dep = sz = par = head = tin = out = vector<int>(n+1, 0);
		adj = vector<vector<int>>(n+1);
		for(auto [a, b] : edges){
			adj[a].pb(b);
			adj[b].pb(a);
		}
		dfs(rt, 0);
		head[rt] = rt;
		dfs2(rt, 0);
	}
	void dfs(int x, int p){
		sz[x] = 1;
		dep[x] = dep[p] + 1;
		par[x] = p;
		for(auto &i : adj[x]){
			if(i == p) continue;
			dfs(i, x);
			sz[x] += sz[i];
			if(adj[x][0] == p || sz[i] > sz[adj[x][0]]) swap(adj[x][0], i);
		}
	}
	void dfs2(int x, int p){
		tin[x] = ind++;
		for(auto &i : adj[x]){
			if(i == p) continue;
			head[i] = (i == adj[x][0] ? head[x] : i);
			dfs2(i, x);
		}
		out[x] = ind;
	}
	int lca(int a, int b){
		while(head[a] != head[b]){
			if(dep[head[a]] > dep[head[b]]) swap(a, b);
			b = par[head[b]];
		}
		if(dep[a] > dep[b]) swap(a, b);
		return a;
	}
};

vector<int> par1, par2;
int n, k, q, t;


struct bad_tree{
	hld tr;
	vector<ll> dep;
	vector<vector<pair<int, ll>>> depend;
	vector<int> vis;
	//vector<pair<int, int>> depend[MX];
	//int vis[MX];
	//ll dep[MX];
	int exi;
	bad_tree(){}
	bad_tree(vector<int>& par){
		vis = vector<int>(n+1, 0);
		dep = vector<ll>(n+1, 0);
		depend = vector<vector<pair<int, ll>>>(n+1);
		exi = -1;
		vector<pair<int, int>> edges;
		int rt = 0;
		for(int i = 1; i<=n; i++){
			if(par[i] == -1){
				rt = i;
			}else{
				edges.pb(mp(i, par[i]));
			}
		}
		tr = hld(edges, rt);
	}
	void add(int a, int b, int c, int d){
		int l = tr.lca(a, b);
		if(exi == -1 || tr.dep[exi] > tr.dep[l]) exi = l;
		depend[a].pb(mp(l, c));
		depend[l].pb(mp(a, c));
		depend[b].pb(mp(l, d));
		depend[l].pb(mp(b, d));
	}
	void dfs(int u, int p, int w){
		cerr << u << " " << p << " " << w << "\n";
		if(vis[u]){
			assert(dep[u] == dep[p] + w);
			return ;
		}
		vis[u] = 1;
		dep[u] = dep[p] + w;
		for(auto [v, e] : depend[u]){
			if(tr.dep[v] > tr.dep[u]){
				dfs(v, u, e);
			}else{
				dfs(v, u, -e);
			}
		}
	}
	void norm(){
		dfs(exi, 0, 0);
		//for(int i = 1; i<=n; i++){
			//for(int j = 1; j<=n; j++){
				//if(vis[i] && vis[j]){
					//assert(vis[tr.lca(i, j)]); //:trust:
				//}
			//}
		//}
	}
	ll answer(int a, int b){
		return dep[a] + dep[b] - 2ll*dep[tr.lca(a, b)];
	}
};

namespace identical{
	hld tr;
	vector<int> tak;
	vector<int> adj[MX];
	int w[MX];
	ll dep[MX];
	vector<pair<int, int>> queries, edges;
	void dfs(int u, int p){
		if(sz(tak) < k) tak.pb(u);
		for(int v : adj[u]){
			if(v != p) dfs(v, u);
		}
	}
	void dfs2(int u, int p){
		dep[u] = dep[p] + w[u];
		for(int v : adj[u]){
			if(v != p)
				dfs2(v, u);
		}
	}	
	void solve(){
		vector<int> par = par1;
		int rt = 0;
		for(int i = 1; i<=n; i++){
			if(par[i] != -1){
				adj[par[i]].pb(i);
				adj[i].pb(par[i]);
				edges.pb(mp(par[i], i));
			}else{
				rt = i;
			}
		}
		assert(rt != 0);
		dfs(rt, 0);
		assert(sz(tak) == k);
		assert(tak[0] == rt);
		assert(k - 1 == q);
		for(int i = 0; i<k; i++){
			cout << tak[i];
			if(i == k-1) cout << endl;
			else cout << " ";
		}
		for(int i = 1; i<k; i++){
			cout << "? " << tak[i] << " " << par1[tak[i]] << "\n";
		}
		cout << "!" << endl;
		cout.flush();
		for(int i = 1; i<k; i++){
			int a = in, b = in, c = in, d = in;
			//assert(b == 0 && d == 0);
			//assert(a == c);
			w[tak[i]] = a;
		}
		for(int i = 0; i<t; i++){
			int a = in, b = in;
			queries.pb(mp(a, b));
		}
		dfs2(rt, 0);
		tr = hld(edges, rt);
		for(int i = 0; i<t; i++){
			auto [u, v] = queries[i];
			ll ans = dep[u] + dep[v] - 2ll*dep[tr.lca(u, v)];
			cout << ans << " " << ans << "\n";;
		}
		cout.flush();
	}
}

namespace big_query{
	bad_tree A, B;

	bool cmp1(int a, int b){
		return A.tr.tin[a] < A.tr.tin[b];
	}

	bool cmp2(int a, int b){
		return B.tr.tin[a] < B.tr.tin[b];
	}
	void solve(){
		A = bad_tree(par1);
		B = bad_tree(par2);
		vector<int> rel1(k), rel2(k);
		iota(all(rel1), 1);
		iota(all(rel2), 1);
		sort(all(rel1), cmp1);
		sort(all(rel2), cmp2);
		for(int i = 0; i<k; i++){
			cout << i+1;
			if(i == k-1) cout << endl;
			else cout << " ";
		}

		for(int i =1 ; i<k; i++){
			cout << "? " << rel1[i-1] << " " << rel1[i] << endl;
		}
		for(int i =1 ; i<k; i++){
			cout << "? " << rel2[i-1] << " " << rel2[i] << endl;
		}
		cout << "!" << endl;
		for(int i = 0; i<q; i++){
			int a= in, b = in, c = in, d = in;
			int u = (i >= k-1) ? rel2[i- (k-1)] : rel1[i];
			int v = (i >= k-1) ? rel2[i- (k-1) +1] : rel1[i +1];
			cerr << u << " " << v << " " << a << " " << b << " " << c << " " << d << "\n";
			A.add(u, v, a, b);
			B.add(u, v, c, d);
		}
		A.norm();
		B.norm();
		vector<pair<int, int>> queries;
		for(int i = 0; i<t; i++){
			int a = in, b = in;
			queries.pb(mp(a, b));
		}
		for(int i = 0; i<t; i++){
			auto [a, b] = queries[i];
			cout << A.answer(a, b) << " "<< B.answer(a, b) << endl;
		}
		
	}
}



void solve(){
	n = in, k = in, q =in, t = in;
	par1 = par2 = vector<int>(n+1, 0);
	for(int i = 1; i<=n; i++){
		par1[i] = in;
	}
	for(int i = 1; i<=n; i++){
		par2[i] = in;
	}
	if(par1 == par2){
		identical::solve();
	}else if(q == 2*k -2){
		big_query::solve();
	}else{
		int ans[2][10][10];
		memset(ans, 0, sizeof(ans));
		cout << "1 5 7" << endl;
		cout << "? 1 5" << endl;
		cout << "? 1 7" << endl;
		cout << "!" << endl;
		vector<pair<int, int>> queries;
		for(int i = 0; i<k-1; i++){
			int a = in, b = in, c = in, d = in;
		}			
	
		for(int i = 0; i<t; i++){
			int a = in, b = in;
			queries.pb(mp(a, b));
		}	
		ans[0][1][5] = ans[0][5][1] = 2;
		ans[0][1][7] = ans[0][7][1] = 3;
		ans[0][5][7] = ans[0][7][5] = 5;
		ans[1][1][5] = ans[1][5][1] = 8;
		ans[1][5][7] = ans[1][7][5] = 3;
		ans[1][7][1] = ans[1][1][7] = 5;
		for(auto [a, b] : queries){
			cout << ans[0][a][b] << " " << ans[1][a][b] << endl;
		}
	}
}

signed main(){
  cin.tie(0) -> sync_with_stdio(0);

  int T = 1;
  //cin >> T;
  for(int i = 1; i<=T; i++){
		solve();
	}
  return 0;
}



详细

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 1001ms
memory: 130320kb

input:

500000 64682 64681 100000
46115
470589
209303
2979
473162
343535
79503
299539
404621
102085
237721
279170
392890
165201
441593
456314
218991
358478
86614
410800
159785
169761
95368
285837
297549
370283
378974
26449
444381
39320
149913
404523
144109
174828
263837
49847
468694
478535
152644
216598
301...

output:

422989 414496 290928 388223 160563 301045 470257 259625 222733 231286 345214 169817 435263 277447 386014 210139 455433 225855 264772 199736 355788 288506 233893 146148 454958 267562 498596 183745 352665 151125 266374 43142 9414 204593 212097 311775 25324 300764 6643 94847 396968 428563 311355 255767...

result:

ok good job!

Test #2:

score: 0
Accepted
time: 1074ms
memory: 129036kb

input:

500000 90967 90966 100000
122547
312039
290084
118442
352297
175176
294396
496975
127062
90539
132654
408480
493670
419897
53432
141795
264165
60368
473480
5634
253119
64236
85346
422987
28583
262389
111931
271291
13577
415079
132797
256502
76402
265607
11274
289667
398726
32021
302401
410650
369760...

output:

3090 193269 3028 186608 498475 64618 82114 231445 7541 329983 134623 235591 70401 18906 403427 280451 146897 355174 160090 144279 193430 332022 488244 228900 80781 84465 218682 27818 6035 368489 155673 440755 443926 241570 193717 143661 374105 56616 323329 95909 337798 20531 236329 28564 437244 4969...

result:

ok good job!

Test #3:

score: 0
Accepted
time: 750ms
memory: 103384kb

input:

500000 68287 68286 100000
273928
229768
65518
144983
311611
494773
489379
439644
467893
456131
430188
247387
485565
272285
474827
476962
338340
365804
344570
390867
390170
456217
43185
447057
385874
305750
107742
230530
259907
252254
280920
16831
45761
185191
117450
55891
175190
255615
35904
14855
2...

output:

242387 146602 106115 32426 8390 3821 314935 201979 171459 413397 469146 119187 74265 167902 479051 182695 260054 235048 135315 280891 13044 240704 209304 211564 188960 481631 289686 273785 175837 385737 204887 288861 330677 315423 120726 278204 129910 396267 322633 472675 325914 329277 67326 391455 ...

result:

ok good job!

Test #4:

score: 0
Accepted
time: 756ms
memory: 104876kb

input:

500000 63976 63975 100000
230132
63748
303785
13497
431672
370351
360004
412191
378555
409703
485802
218204
475692
27602
220794
398856
89157
166559
116145
350738
277404
196706
40307
118602
171802
378360
389092
485168
224465
383516
33147
322617
254917
274019
57283
272241
216098
421952
489927
75641
40...

output:

210552 1449 40773 30337 3831 195031 251118 21848 332855 402436 374839 357357 42119 382885 377328 13863 386544 201759 32946 323963 484564 215037 277370 472684 81309 484227 89315 381707 431727 439267 216824 485515 421976 411697 230680 43213 25204 68073 30255 143879 164080 135142 441489 282767 310382 1...

result:

ok good job!

Test #5:

score: 0
Accepted
time: 785ms
memory: 104520kb

input:

500000 87673 87672 100000
151599
456749
347511
703
348209
260440
488627
416030
419890
408089
83617
120781
133411
374231
460689
211838
137587
252914
392401
321583
55161
335205
334340
4527
14086
142229
197076
17695
262896
258702
273353
51181
10968
366799
324067
299421
281975
7236
420627
92324
299845
1...

output:

51300 4033 3297 46811 80464 284515 347374 116368 204675 12242 236061 42585 91081 312035 285728 234206 326918 231575 193431 385908 123360 219570 237308 488275 146973 278867 303046 17686 461933 83949 100486 65040 253090 278869 342370 141292 167787 205320 41653 29945 83893 40950 348576 412681 220300 26...

result:

ok good job!

Test #6:

score: 0
Accepted
time: 942ms
memory: 108836kb

input:

500000 77912 77911 100000
270576
129318
366297
25873
179787
473782
221947
331327
209469
412992
410608
286179
37554
355546
297085
420463
496948
223036
122019
151250
478469
468136
19073
318549
398897
364415
23730
407160
26064
436939
30150
336421
375149
131841
58480
259944
117641
414831
64311
336164
31...

output:

210887 26617 47747 209286 31977 243665 65697 394458 66936 330203 111706 400826 188117 490312 451749 377213 451432 482110 450513 372367 243217 17878 326862 79427 343913 203244 140881 256494 329204 164961 461047 338802 166743 393825 25540 420037 374407 50003 96053 427346 365280 191816 338726 463407 32...

result:

ok good job!

Test #7:

score: 0
Accepted
time: 943ms
memory: 108300kb

input:

500000 77688 77687 100000
433011
472346
395389
187114
436024
138403
189990
398859
136147
195283
331183
46789
19828
335128
387768
442181
65556
72327
318927
462834
421288
227912
37067
387794
145879
258896
185861
356020
202881
490952
443694
95413
137215
137239
112863
481338
167802
304239
309781
391976
...

output:

176419 131882 35390 373863 172713 204978 297105 474574 443479 326538 390969 34874 492305 157831 85371 217598 310810 104348 344506 18218 34919 284048 191391 375157 93215 437374 179027 95313 246201 105486 90705 261692 432138 60063 214041 101698 415529 126781 367122 27413 85730 36224 346513 104818 2238...

result:

ok good job!

Test #8:

score: 0
Accepted
time: 925ms
memory: 108920kb

input:

500000 70973 70972 100000
449081
8094
7358
89457
426121
454508
470543
485236
63347
441977
422774
88672
243638
499709
170209
157788
229166
106888
228931
289706
435222
496384
381579
323479
499140
1511
385050
44171
413854
248273
352221
305112
24289
277461
391744
395003
85800
396455
355110
186446
285096...

output:

449195 92100 139432 131622 170991 324408 396138 18454 365411 494280 359470 62857 516 49116 212775 228269 406044 238351 73730 344036 164637 142035 62522 287306 191612 27113 107127 151520 273425 3029 266766 489355 250496 60335 369915 212496 230914 324800 64090 294847 116290 472262 346162 136322 249997...

result:

ok good job!

Test #9:

score: 0
Accepted
time: 835ms
memory: 103608kb

input:

500000 66403 66402 100000
297237
432967
138046
88503
315699
372893
55309
335404
127581
165919
247543
254268
285147
289728
275281
44427
94393
302830
489861
429097
425153
11083
439096
414157
386411
152968
394984
46119
149177
369378
413029
198215
134317
366218
281170
465540
39702
367778
247925
64320
86...

output:

294428 15990 60747 1844 173342 476686 180822 429820 298329 356039 58547 290254 180015 476506 20120 265956 172302 27153 59287 30817 110197 441521 428010 2003 112355 265905 198312 129358 442298 120472 138884 373998 58266 256425 7274 137614 43114 65060 393472 137647 293565 81701 495260 317778 230822 47...

result:

ok good job!

Test #10:

score: 0
Accepted
time: 841ms
memory: 104696kb

input:

500000 82328 82327 100000
280281
366446
183709
14447
442815
440473
121531
103568
472324
479656
337467
424742
474404
340302
269686
457628
230012
484228
422877
10759
156759
66102
130428
307888
123685
460634
235321
98667
93133
489886
479420
34961
352500
322001
129001
121871
135775
235639
100221
221760
...

output:

185494 36690 87374 138798 36564 181594 428424 260437 178882 134288 146942 90320 210326 241671 445549 121178 164319 184591 354583 355428 247773 281684 307841 387907 97435 102464 184979 164216 317633 56960 295193 191071 295961 328549 299162 27136 188202 118130 161902 236258 147998 155971 322975 474055...

result:

ok good job!

Test #11:

score: 0
Accepted
time: 830ms
memory: 103792kb

input:

500000 53948 53947 100000
287984
258934
272973
481182
131565
217198
34714
463056
337977
495727
310042
26372
320480
231799
249741
340990
365501
267377
460708
248843
285777
172137
492784
201463
213559
259528
461602
235849
398717
25475
241699
451061
188952
251790
83551
169967
335575
209367
55705
6381
2...

output:

490646 30912 58228 256224 419416 179276 226624 297156 434671 224297 66900 102019 206352 345445 170824 216398 382142 38139 295276 461808 479814 117039 338283 434145 494560 141370 72417 19374 27632 289877 24100 185985 333545 136905 137035 102602 147548 27797 299360 304944 475001 306860 73631 185755 27...

result:

ok good job!

Test #12:

score: 0
Accepted
time: 814ms
memory: 104160kb

input:

500000 77935 77934 100000
38748
422564
39441
105430
38474
225464
237519
121832
72613
477531
321661
29181
307418
314049
120252
261006
88761
17726
492112
460837
55199
354114
417097
133271
231933
436973
110894
478550
291976
50101
38774
316091
306160
121826
315769
361823
82990
188508
124574
13093
235123...

output:

423149 92225 16389 129241 166449 184539 134974 114717 355886 329721 379424 292962 421117 497443 381527 149162 408 10702 212632 50138 317213 372008 378849 113411 195237 172507 239020 420304 489080 360466 438166 227686 419986 209153 382570 15084 218300 418265 483901 215816 378626 452355 214360 491276 ...

result:

ok good job!

Subtask #2:

score: 25
Accepted

Test #13:

score: 25
Accepted
time: 2863ms
memory: 208564kb

input:

500000 88721 177440 100000
30974
23891
211201
125199
180489
387190
218020
498838
230147
307989
484136
257785
353027
304420
311738
169842
334090
486070
126212
328609
174959
368840
238722
418092
488389
226349
427271
457322
332454
12958
197530
264474
355717
482774
221286
282148
216441
266659
213750
628...

output:

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

result:

ok good job!

Test #14:

score: 0
Accepted
time: 2232ms
memory: 193048kb

input:

500000 50267 100532 100000
68723
142685
445548
215087
478634
201362
177405
373123
227456
161487
276716
452818
230715
466238
250886
368974
77152
493722
129115
154402
319190
170867
27898
338290
170229
428001
62611
19188
164329
435154
128
358453
137653
430592
160391
407392
125236
320137
27945
393135
17...

output:

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

result:

ok good job!

Test #15:

score: 0
Accepted
time: 2673ms
memory: 170824kb

input:

500000 67604 135206 100000
269046
235003
144646
314602
323547
204450
484229
26672
78499
602
110738
117079
125630
408912
188317
256853
71590
365703
370008
194267
342683
400737
369194
127912
96314
269751
219125
431887
398790
200053
279314
365797
187505
75025
48264
492515
387506
13267
80948
378737
1106...

output:

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

result:

ok good job!

Test #16:

score: 0
Accepted
time: 2958ms
memory: 180272kb

input:

500000 90109 180216 100000
153893
273609
184853
157428
466683
457867
343783
259618
87262
260826
466902
41972
482221
496695
293976
300490
455874
320279
314574
128316
280220
2566
383716
351629
219577
29212
26631
73182
458601
318651
105942
60715
392339
265615
387177
110713
319395
336826
483543
70790
36...

output:

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

result:

ok good job!

Test #17:

score: 0
Accepted
time: 2969ms
memory: 173624kb

input:

500000 74321 148640 100000
477030
412534
57969
357009
116485
327483
437765
67781
471780
418080
308252
138279
338053
95055
275789
97204
386829
122048
57181
436136
222481
395950
352928
73438
250800
184259
16097
398913
456107
105407
39764
116186
80552
65160
316601
284871
313136
414498
414938
343247
310...

output:

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

result:

ok good job!

Test #18:

score: 0
Accepted
time: 2532ms
memory: 172016kb

input:

500000 54262 108522 100000
150680
169780
208423
114492
398775
47217
58682
258733
452080
54148
451364
196867
75350
134397
51280
339529
475503
166592
224426
358444
423175
366761
49422
400504
398619
18773
429051
59685
291626
145365
261042
445752
234123
21931
318295
94503
388014
414710
346782
466751
205...

output:

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

result:

ok good job!

Test #19:

score: 0
Accepted
time: 2981ms
memory: 182364kb

input:

500000 81364 162726 100000
321857
75911
117294
148668
322025
103777
419430
187082
374875
230927
338513
433399
305556
363405
457801
70917
297078
386374
322110
76493
189187
21851
453679
296595
389232
386129
310835
432013
450769
74142
284176
90713
430145
142503
212302
384600
157386
490862
201498
415387...

output:

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

result:

ok good job!

Test #20:

score: 0
Accepted
time: 2976ms
memory: 183532kb

input:

500000 84343 168684 100000
92159
3025
19095
171545
269452
230103
428411
105653
130154
107687
352956
242321
444883
277419
59579
326919
4318
292812
326242
108917
253600
261383
320680
353469
283662
437811
470379
170617
46289
454830
253014
4165
381169
328908
493243
143442
265851
59330
347945
264421
2460...

output:

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

result:

ok good job!

Test #21:

score: 0
Accepted
time: 3095ms
memory: 184256kb

input:

500000 88757 177512 100000
445069
77200
391318
333565
435416
362966
141662
45522
355791
256039
214614
450379
170016
467327
282215
243533
183175
463770
163579
461662
317411
261187
253905
468654
231023
3749
90566
45210
343865
165800
136852
383910
367984
413623
325053
41177
298566
351228
15540
262375
2...

output:

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

result:

ok good job!

Test #22:

score: 0
Accepted
time: 3047ms
memory: 187448kb

input:

500000 96344 192686 100000
195205
422258
407338
9779
476600
35329
336839
237680
366318
378932
386654
353800
118734
312717
156858
133692
72221
189109
391324
145763
38629
330117
404936
68820
255606
431020
392503
176884
178395
275064
488090
130311
314587
217628
462496
28966
425413
116762
437176
468713
...

output:

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

result:

ok good job!

Test #23:

score: 0
Accepted
time: 2836ms
memory: 174340kb

input:

500000 62967 125932 100000
228958
294130
161634
80333
361275
345422
393334
286611
311452
453264
275215
289266
452502
447517
458518
295775
420774
426985
410788
79249
309720
61573
250760
5587
481312
161015
303445
8961
463259
24340
331413
237498
488929
475822
425952
251105
487129
230062
368282
264038
1...

output:

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

result:

ok good job!

Test #24:

score: 0
Accepted
time: 3164ms
memory: 186952kb

input:

500000 94830 189658 100000
104237
453576
334546
43320
88991
174623
80118
405142
341990
225030
164655
136865
106241
208562
67332
289772
379828
245569
190369
136859
196296
376390
298773
202031
129266
220643
477229
76909
267607
412545
178338
100575
280161
390719
280691
294766
490870
175723
312546
47683...

output:

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

result:

ok good job!

Subtask #3:

score: 0
Wrong Answer

Test #25:

score: 0
Wrong Answer
time: 373ms
memory: 32064kb

input:

500000 200 199 40000
76296
130139
291501
292412
139543
433345
372726
451574
18315
465578
324564
477223
237354
81532
65170
465332
342130
9670
193303
193680
129668
149532
268907
89969
398275
356210
324593
433492
482232
466692
135343
433758
102545
287283
432859
351864
305769
489532
101532
450535
295762...

output:

1 5 7
? 1 5
? 1 7
!

result:

wrong answer format  Expected integer, but "?" found

Subtask #4:

score: 0
Wrong Answer

Test #37:

score: 0
Wrong Answer
time: 578ms
memory: 36220kb

input:

1000000 1000 999 100000
678746
439069
32542
85937
936926
284219
461661
203235
533462
940676
230275
621140
780674
254931
562355
229273
201341
493976
358955
963527
880412
91220
474599
160086
698841
591551
718276
844558
39859
765917
34722
401724
219774
443004
682244
545401
968419
968020
354030
411187
1...

output:

1 5 7
? 1 5
? 1 7
!

result:

wrong answer format  Expected integer, but "?" found

Subtask #5:

score: 0
Wrong Answer

Test #49:

score: 0
Wrong Answer
time: 547ms
memory: 36920kb

input:

1000000 91074 91073 100000
844855
360256
604500
520288
3402
603913
199722
732526
574997
429775
182518
190073
386932
693624
254661
333433
557929
350362
247817
201441
960948
519977
461212
493412
852908
455639
732827
432452
320916
223796
413293
969300
617038
438432
2369
51283
908991
374139
410798
19612...

output:

1 5 7
? 1 5
? 1 7
!

result:

wrong answer format  Expected integer, but "?" found