QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#380559#6671. Zadatakltunjic14 28ms82308kbC++144.1kb2024-04-07 05:54:412024-04-07 05:54:42

Judging History

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

  • [2024-04-07 05:54:42]
  • 评测
  • 测评结果:14
  • 用时:28ms
  • 内存:82308kb
  • [2024-04-07 05:54:41]
  • 提交

answer

#include <cstdio> 
#include <algorithm> 
#include <vector> 
#include <cstring> 
#include <set> 
#include <cassert>

#define X first
#define Y second
#define PB push_back

using namespace std; 

typedef long long ll;
typedef pair<int, int> pii;

const int LOG = 18;
const int N = 1 << LOG; 
const int PERZ = LOG * N;
const bool DEB = 0;

struct node {
	ll sum, in;
	bool prop; 
	node *l, *r;
	node() {}
	node(ll sum, ll in, bool prop, node *l = NULL, node *r = NULL) : sum(sum), in(in), prop(prop), l(l), r(r) {}
};

int NEW;
node NEWN[PERZ];

node* get() { 
	assert(NEW < PERZ); 
	NEWN[NEW].l = NEWN[NEW].r = NULL;
	NEWN[NEW].sum = NEWN[NEW].in = NEWN[NEW].prop = 0;
	return &NEWN[NEW++]; 
}

void merge(node *u, node *v, node *w) {
	w->in = u->in + v->in;
	w->sum = u->sum + v->sum;
	w->prop = 0;
}

void child(node *u) {
	if(u->l == NULL) u->l = get(); 
	if(u->r == NULL) u->r = get();
}

node* _update(node *u) {
	node* v = get();
	v->l = u->l;
	v->r = u->r;
	v->in = u->sum - u->in;
	v->sum = u->sum;
	v->prop = u->prop ^ 1;
	return v;
}

void propagate(node *u) {
	if(!u->prop) return;
	assert(u->l != NULL && u->r != NULL);
	u->l = _update(u->l);
	u->r = _update(u->r);
	u->prop = 0;
}

node* update(int l, int r, node *u, int lo = 0, int hi = N) { assert(u != NULL);
	if(r <= lo || hi <= l) return u;
	if(l <= lo && hi <= r) return _update(u);
	propagate(u);
	int mi = (lo + hi) / 2;
	node *v = get();
	v->l = update(l, r, u->l, lo, mi);
	v->r = update(l, r, u->r, mi, hi);
	merge(v->l, v->r, v);
	return v;
}

ll query(int l, int r, node *u, int lo = 0, int hi = N) { assert(u != NULL);
	if(r <= lo || hi <= l) return 0;
	if(l <= lo && hi <= r) return u->in;
	propagate(u);
	int mi = (lo + hi) / 2;
	return query(l, r, u->l, lo, mi) + query(l, r, u->r, mi, hi);
}

vector<int> C; // DODAJ 0

node* build(int lo = 0, int hi = N) {
	node* u = get();
	u->prop = 0;
	if(lo + 1 == hi) {
		u->sum = lo < (int) C.size() - 1 ? (ll) C[lo + 1] * C[lo + 1] - (ll) C[lo] * C[lo] : 0;
		u->in = 0;
		u->l = u->r = NULL;
		if(DEB && lo < (int) C.size() - 1) printf("%lld ", u->sum);
		return u;
	}
	int mi = (lo + hi) / 2;
	u->l = build(lo, mi); 
	u->r = build(mi, hi);
	merge(u->l, u->r, u);
	return u;
}

int n, A[N];

int TO[N], TMP[N]; 
node* RT[N];
set<int> S[N]; 

void debug(node *u, bool f = 0, int lo = 0, int hi = N) {
	f ^= u != NULL ? u->prop : 0;
	if(lo + 1 == hi) {
		printf("%d ", (int) f);
		return;
	}
	int mi = (lo + hi) / 2;
	debug(u != NULL ? u->l : NULL, f, lo, mi);
	debug(u != NULL ? u->r : NULL, f, mi, hi);
}

ll unija(int a, int b, int ind) {
	if(S[a].size() < S[b].size()) swap(a, b);
	TO[ind] = a;
	
	if(DEB) {
		printf("{"); for(int x : S[a]) printf("%d ", x); printf("}\n");
		printf("{"); for(int x : S[b]) printf("%d ", x); printf("}\n");
		printf("  "); debug(RT[a]); 
		printf("\n^ "); debug(RT[b]);
	}

	ll ret = 0;

	auto it = S[b].begin();
	for(int i = 0; i < S[b].size(); ++i) {
		TMP[i] = *it;
		it = next(it);
	}

	for(int i = (int) S[b].size() - 1; i >= 0; i -= 2) {
		int r = TMP[i], l = i != 0 ? TMP[i - 1] : 0; /// |(l) .... |(r)    |(r + 1)
		ret += query(l, r, RT[a]);
	}

	for(int i = 0; i < S[b].size(); ++i) {
		int x = TMP[i];
		RT[a] = update(0, x, RT[a]);
		if(S[a].find(x) == S[a].end()) S[a].insert(x);
		else S[a].erase(x);
	}
	
	if(DEB) {
		printf("\n= "); debug(RT[a], 0); printf("\n");
		printf("{"); for(int x : S[a]) printf("%d ", x); printf("}\n");
	}
	return ret;
}

int main() {
	C.PB(0); 
	
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) {
		scanf("%d", A + i); 
		C.PB(A[i]); 
		TO[i] = i;
	}

	sort(C.begin(), C.end());
	C.erase(unique(C.begin(), C.end()), C.end());

	RT[0] = build();
	if(DEB) printf("\n");

	for(int i = 1; i <= n; ++i) {
		int ind = lower_bound(C.begin(), C.end(), A[i]) - C.begin();
		RT[i] = update(0, ind, RT[0]);
		S[i].insert(ind);
		if(DEB) { debug(RT[i]); printf("\n"); }
	}

	for(int i = n + 1; i < 2 * n; ++i) {
		int a, b; scanf("%d%d", &a, &b); 
		printf("%lld\n", unija(TO[a], TO[b], i));
		if(DEB) printf("~~~\n");
	}
	return 0;
}


詳細信息

Subtask #1:

score: 14
Accepted

Test #1:

score: 14
Accepted
time: 12ms
memory: 67564kb

input:

5000
217378 945562 533764 323494 69148 240722 205370 463122 552700 31800 616898 678076 893816 258468 34822 905360 967562 731346 340940 584418 684926 785402 107584 995542 363278 255302 196912 870994 329464 338390 154870 977540 65120 130388 350020 239660 553428 710306 385138 633274 841672 740778 17929...

output:

359872811236
632705703184
113223620400
251229507984
470237900880
0
142492660324
492745033764
0
89244392644
551725099524
278399748496
311560446976
233709556800
476939443200
0
172741415748
92640103936
28418613120
60443205904
0
341931572900
73529592508
193225675856
248612109488
393354817264
21576167436...

result:

ok 4999 lines

Test #2:

score: 0
Accepted
time: 24ms
memory: 66004kb

input:

5000
557036 70224 982294 274570 679032 366976 367038 112802 876614 935716 371614 748288 542664 882900 375142 764194 914714 950008 82332 319528 450794 411332 35640 777836 965926 318372 6094 65570 826320 399704 140548 712120 856166 958862 954558 237084 220868 113964 724714 640422 190452 583740 374746 ...

output:

2605489936
833671259136
414614936836
0
11179255824
0
13449040900
38313579296
2854337476
252799910572
35219278224
39983911600
26199954496
11528446148
230055599996
63127615760
259097657560
20563560000
15511706116
19994158784
56455910604
30454011016
521586821584
6342848164
356728474752
229864631364
0
6...

result:

ok 4999 lines

Test #3:

score: 0
Accepted
time: 20ms
memory: 68412kb

input:

5000
936198 118156 843936 409048 88156 445792 461900 986578 327034 983586 217476 66650 311086 444006 281024 421540 906380 127956 116660 221082 3444 251782 237620 706530 840660 250016 385806 752038 46452 743864 699406 282492 591478 997902 782384 294532 530466 483054 382552 819706 3168 817104 704402 1...

output:

775502151876
0
304072839184
0
22885638400
54715759396
184898280004
0
383151096064
0
426080648736
87190278400
4551931024
131871923712
323870547764
4551931024
308671256992
65806494996
203741618808
34333542612
25275890160
31018028976
437116414852
457568843248
289529607920
219397605508
663670915600
0
33...

result:

ok 4999 lines

Test #4:

score: 0
Accepted
time: 20ms
memory: 67796kb

input:

5000
121584 789584 304802 181686 868074 745276 196204 806990 247270 169050 975132 510442 333770 131006 529210 792 495796 783576 203742 207786 602330 279034 617006 128012 777130 434758 456494 336586 145644 141816 993702 712904 946054 585370 758128 584160 597890 612480 979628 171206 336738 710642 9106...

output:

29028662884
141989977052
491256732772
318296815684
0
410656875748
0
16125952144
2480239204
181518602500
216895118400
0
172029175696
332017964100
0
693795600
365552360372
238019409744
15039892756
22703859684
397928825856
0
400243014688
204745381412
377539155004
121347102076
338335126128
106793011264
...

result:

ok 4999 lines

Test #5:

score: 0
Accepted
time: 25ms
memory: 73052kb

input:

5000
404518 895646 728 551730 441144 663970 911906 202138 760402 998632 72706 548234 494136 531482 308906 577000 456816 283090 832164 599136 916570 581988 705372 669868 855538 433682 149626 792300 293058 897870 781874 158196 325714 844204 264120 863366 35388 93746 665458 619392 766046 405570 203190 ...

output:

2289622500
181990972816
6492169476
575319216004
177609987844
18764616256
150857667216
241440545956
3748378176
494884516
107392533264
432753465600
11819168656
512867957904
234598797316
5088539556
89609225104
89383060900
109746576
17012506624
254183355556
217769688964
57062916
176746249744
48852492676...

result:

ok 4999 lines

Test #6:

score: 0
Accepted
time: 25ms
memory: 73580kb

input:

5000
752312 142808 417760 470364 864646 418622 637574 546366 446842 948448 8550 570858 271826 900940 883516 418196 223402 705522 357554 499844 532594 733774 914428 360906 108086 240508 277210 256304 447250 855114 844436 302508 357160 529718 151672 245070 932614 849410 539324 885118 588226 350790 394...

output:

217904107204
192543376
138315560464
260176900
9622040464
376730798656
5040148036
4221880576
857864964100
91315169856
105336597136
6462230544
123379372516
497670989764
427776170116
49994276836
28861252996
231690120964
53699719824
127361906884
108803661316
193441632400
163992601600
790374340900
156518...

result:

ok 4999 lines

Test #7:

score: 0
Accepted
time: 27ms
memory: 72008kb

input:

5000
436954 47476 52076 589460 128386 109214 271220 125134 839512 278774 190056 248348 201358 200708 121880 826946 25852 925492 460978 613114 31464 544200 520582 443038 581704 736154 533806 101656 383912 659874 235732 616968 172646 611552 10274 506406 959642 80038 599110 795778 603900 619396 409452 ...

output:

1292690116
505097332804
6888336016
13522433796
2170814464
231695897104
685276018596
676779347556
54596995600
2147580964
130716956304
124827956100
20891233444
137206531396
222353743936
285604736400
16792531396
20677289616
4376087104
145501050916
135899873316
35295888384
685706596
5676718336
166996457...

result:

ok 4999 lines

Test #8:

score: 0
Accepted
time: 28ms
memory: 74180kb

input:

5000
387386 205266 759342 626556 505280 677734 215636 957320 226240 906976 540386 281280 363764 881310 209068 10712 556208 843932 574332 533894 420768 292358 107602 886448 359842 341028 934320 582746 895426 51672 257666 673900 713982 934680 16204 172816 679016 426878 651968 535050 108088 256908 8193...

output:

218227253904
26714594916
646416
97416900
340633315044
82416074724
158744871184
476810896
22502400064
19066638724
33822152464
70427605924
87159571984
154555914496
89558941696
72739168804
192203328100
135773088676
168879902500
258029457156
21356315044
129486264964
365043139344
55582777600
19466388484
...

result:

ok 4999 lines

Test #9:

score: 0
Accepted
time: 8ms
memory: 73560kb

input:

5000
818528 139418 713436 973196 218198 474142 88054 992454 771924 362848 289096 482670 809732 860704 421954 282650 913876 586386 170848 960430 551294 540194 872974 320712 573430 317160 114892 465576 364400 305298 687724 58246 89204 330628 83812 574694 381340 22292 387276 482598 540696 648456 715556...

output:

6978263296
120199503204
102136489744
105508032400
91153271056
19032961600
6508939684
26832405636
247277452900
3784956484
98805863556
18815060224
2838545284
14412482704
25989604
89003175556
460500674404
10713078016
16893240676
140058571536
297040260196
66375277956
2525263504
21829471504
94126240000
6...

result:

ok 4999 lines

Test #10:

score: 0
Accepted
time: 13ms
memory: 62600kb

input:

5000
825916 768584 389520 662548 484706 571376 100514 854360 806310 382770 292874 300182 806806 111032 997166 264070 31324 608548 293620 999208 916766 501230 411936 988926 952440 860080 349206 704524 243754 71864 721228 847554 940248 428526 670358 537788 554852 761740 719560 331164 776644 289970 999...

output:

12328105024
85775179876
169691268096
10103064196
151725830400
981192976
73884599376
286343004732
453394601668
499210091236
284117963904
234939906436
341249807520
0
182653339700
69732964900
59416012516
68578173200
366040763200
90109233124
284895158436
71301749352
496354066576
146512872900
10700702954...

result:

ok 4999 lines

Test #11:

score: 0
Accepted
time: 18ms
memory: 64392kb

input:

5000
497488 754538 326118 477000 989854 177652 196602 489742 149270 673280 207624 882494 253612 480540 637094 735464 64754 446888 438852 677332 273778 336550 162548 58534 834314 53488 611526 572138 165074 46846 162734 393168 889340 843992 372408 690872 747934 90086 773800 592452 128018 641774 853518...

output:

4193080516
247494310144
74954393284
0
38652346404
188876653596
26421852304
188397997388
252387497760
827573172
2194547716
1998532800
453305958400
3426229156
0
113265902500
31560233104
154581076224
37824773232
350999372304
138687718464
213565404252
373964048676
559405268356
22281532900
243766611128
0...

result:

ok 4999 lines

Test #12:

score: 0
Accepted
time: 18ms
memory: 64324kb

input:

5000
241436 720524 486278 391126 426152 429950 773406 459974 754950 487372 837770 757950 645884 596344 928448 655240 446878 423942 608080 961064 733530 783608 321056 117932 177136 969266 686844 670228 45612 578416 412022 305096 291942 842512 715082 5020 974332 419728 207924 903588 460212 935782 2203...

output:

417166141456
101988693120
237531466384
0
13907956624
614041497664
184857002500
181605527104
179726819364
296733549556
2080454544
0
139071591252
0
85230131364
345475155348
701858572900
0
355626166336
90941462620
120853622324
0
25200400
236466293284
95261340912
214608717168
214323336164
13907956624
22...

result:

ok 4999 lines

Test #13:

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

input:

5000
848080 85808 21344 780400 450264 620146 310630 511338 256466 767706 76074 357082 800470 580558 428280 953270 143346 796858 35286 609414 981392 675536 713468 831192 113610 450524 14342 364424 569342 334508 574268 724792 942060 415914 173052 248382 686360 319074 860676 650304 11712 384118 381588 ...

output:

20548075716
1245101796
509036587024
455566336
0
65774809156
61732745568
5787253476
589372502436
96035430564
19651657564
337047591364
0
132804851776
324150312964
202971874576
162875682684
146359977424
24159741228
719239686400
0
202737669696
7363012864
261466550244
21660661520
0
34337832032
1290723210...

result:

ok 4999 lines

Test #14:

score: 0
Accepted
time: 26ms
memory: 63596kb

input:

5000
117244 497834 991492 740976 813962 332028 81048 927812 711248 824320 668418 148498 425246 170966 931826 901652 60746 747784 735270 474036 461340 375886 936404 379308 952450 581620 209238 805584 305506 144054 774252 650172 114184 833572 808260 7650 239744 229082 868994 486232 538174 440372 25276...

output:

13746155536
29229373156
180834160516
0
540621972900
446782622724
30034385108
59091094780
648965581056
212834595600
218609318400
3690076516
559180910656
13037985856
599466159504
422723629584
13746155536
654192601016
679503462400
213510169600
0
29229373156
22051656004
0
0
110242592784
318940239976
206...

result:

ok 4999 lines

Test #15:

score: 0
Accepted
time: 19ms
memory: 58832kb

input:

5000
815262 81750 586266 564148 835846 685342 332298 334950 278210 566816 726560 750078 46746 943606 974816 712556 833566 632398 918366 871578 507592 734118 390348 901932 623976 136686 210630 895960 837840 825522 66352 522196 920168 988736 988648 29046 650220 571884 144036 932068 809644 755990 15435...

output:

469693656964
110421960804
194958471680
318262965904
3017411952
112191502500
233285861952
125985834208
2185188516
4497873984
77400804100
353702248716
536690034520
261520065008
694832276356
79170345796
507736053136
147873687120
295911888904
0
18683062596
0
109180930628
414743318964
258320693496
585910...

result:

ok 4999 lines

Test #16:

score: 0
Accepted
time: 12ms
memory: 58548kb

input:

5000
535072 752232 938336 80064 134104 191370 964742 304440 41052 139512 959622 890590 836502 586988 943128 924914 916198 710648 765570 450966 26898 264054 495266 900078 862876 907042 30374 644048 918214 560984 685170 316788 975454 348480 715938 444068 50014 980766 557762 330720 444288 567286 651942...

output:

6410244096
30212232804
880474448896
1685266704
17983882816
565852981824
0
256089812380
1479715328
443645783624
411820123772
86985384436
227297566276
505020579904
612750211568
90998446896
0
245288410756
340809014144
29456019880
16989857984
221510955756
112371886260
392606426880
314703048256
922579876...

result:

ok 4999 lines

Test #17:

score: 0
Accepted
time: 20ms
memory: 58112kb

input:

5000
582728 865914 56650 302012 985474 79686 680600 138536 259610 996108 499694 855924 255146 547058 977796 579762 183926 812606 245220 558868 271974 425940 974310 638870 983146 158020 591792 368108 350736 871758 396434 105264 694540 261644 870734 788046 41934 281630 26298 273368 704160 70170 635442...

output:

6349858596
3209222500
456866501404
339571921984
0
67397352100
3140636096
19192223296
91211248144
468887436932
438941229812
33828773476
329579235612
302295203168
60132848400
187263374452
0
181424883600
46379131984
158813027396
321604494224
100875921760
629112292228
24970320400
541124194888
2188378156...

result:

ok 4999 lines

Test #18:

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

input:

5000
147264 794156 201808 418676 250374 416480 434198 355094 472080 159122 245362 571544 996736 561700 205704 651322 760666 885650 608734 364876 755538 720486 388494 492120 766676 213062 321292 476150 521908 354876 993492 814938 582088 729348 84688 141258 608638 236630 184126 155258 195530 843410 31...

output:

173455590400
0
126091748836
21686685696
0
3633125188
40726468864
21310044756
609373707580
38681010428
222859526400
92647363600
21310044756
402910302928
86442283816
329394630792
284114798940
150927588036
120383170740
242182094400
45395415844
223254716868
158411249936
226992544620
7705420772
453954158...

result:

ok 4999 lines

Test #19:

score: 0
Accepted
time: 16ms
memory: 59676kb

input:

5000
718466 506566 709212 225152 960794 916300 170184 790884 454022 128026 46484 912458 257822 227992 856 735694 590900 589848 876774 618624 209216 986370 524292 751280 155488 139150 874908 212632 106234 468046 837092 109444 218146 591226 280046 115794 861828 657776 587880 901316 891396 583546 13576...

output:

516193393156
50693423104
0
256609112356
28962593856
0
2160762256
64311421428
766107418080
24965611072
732736
51980352064
541244928900
84252572556
139663792800
382694920640
192237241908
732736
274882101264
9946623724
1242146896
19361989764
453325338828
732736
0
535794274624
178229443796
296427116712
...

result:

ok 4999 lines

Test #20:

score: 0
Accepted
time: 16ms
memory: 54356kb

input:

5000
891982 849278 664622 162148 182562 946370 53024 786914 538694 846416 767478 540838 298250 726856 962094 246546 547168 826706 159518 616466 360764 909870 272020 168430 16582 988462 319290 804800 237508 154584 938628 874484 120182 927426 850172 118026 70390 603986 615168 610876 284990 259274 8452...

output:

721273121284
0
26291973904
7036909940
509044259984
0
187359695028
280342771120
258566033424
427642848720
12162971124
79104607984
360303278292
303064894160
9848454516
259061716716
307572688956
22634447748
239238813544
57839490072
379407605588
42881307972
3657526156
0
488025339016
34545774260
29536531...

result:

ok 4999 lines

Test #21:

score: 0
Accepted
time: 16ms
memory: 54480kb

input:

5000
906560 412120 896056 62246 811910 582314 39976 925394 693498 221418 535698 9150 396644 619030 909894 440748 105650 7410 324212 648614 916288 554110 138630 619612 700296 877156 486458 6598 119692 115344 395812 68894 622100 265470 271350 447116 876812 60244 151552 523980 290316 498646 100220 1576...

output:

169842894400
633073460736
3874564516
165968329884
173121264712
0
506609342428
171523184136
46749446784
123093447616
83722500
46665724284
271898737560
358815303116
135076643556
8801716060
54908100
40169306564
214282640048
415287139216
170174093744
10361652740
179467316080
264691069472
335928218380
12...

result:

ok 4999 lines

Test #22:

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

input:

5000
469444 917364 545838 977384 230220 736402 844008 101120 50466 714948 88868 698340 667824 734560 711292 3088 223244 676342 527492 734812 713112 342796 593094 256012 441344 326274 782398 650470 119220 992796 524108 496208 905686 232532 202750 340402 929694 662086 709722 211532 563296 634978 52953...

output:

220377669136
77561453108
763995255388
0
130562701508
411725204096
10225254400
0
122884264264
5350704268
361990604224
125688151376
343772630704
167378012000
9535744
4865014388
360399062616
65898520180
290175512612
246780962828
109480718364
130588262952
57513764892
59995332724
57513764892
340465982780...

result:

ok 4999 lines

Test #23:

score: 0
Accepted
time: 18ms
memory: 82308kb

input:

5000
867064 465288 50778 756406 39130 253346 762384 725156 753708 131170 867514 231690 108674 627514 931996 280590 17204 514280 7062 208870 121020 837932 612926 690742 173148 952858 844864 632456 518758 630010 969622 366608 92818 390642 207254 252704 217442 886364 456402 353338 680542 970438 839128 ...

output:

216492922944
2578405284
1531156900
525851224336
17205568900
53680256100
11810038276
78730748100
295977616
49871844
14645840400
375678281476
29980229904
400000591936
269109862564
134401425664
8615181124
42954220516
47281023364
124847742244
463137413764
560033709316
486299811904
263750036356
818726659...

result:

ok 4999 lines

Test #24:

score: 0
Accepted
time: 16ms
memory: 81040kb

input:

5000
414946 431094 269466 388646 791328 357496 892794 191904 610482 579054 298912 580106 554598 459164 767128 79722 41414 82162 704248 144002 427854 302202 546074 979430 218172 868540 577868 103974 439196 118290 103130 203680 946058 455464 134976 939954 723426 932688 52902 231826 800788 51754 547302...

output:

172180182916
72611925156
127803390016
36827145216
335303534916
89348383744
210831578896
6355597284
1715119396
20736576004
91326048804
298196813476
47599021584
10810592676
13992524100
10635796900
207447455296
18218520576
523345177476
2798621604
2678476516
299539479204
549058624
1827904516
20931357006...

result:

ok 4999 lines

Test #25:

score: 0
Accepted
time: 20ms
memory: 67532kb

input:

5000
87946 119846 425200 121842 370912 734400 943468 748164 848736 774582 16534 687404 460956 346576 12560 990764 189010 748402 967134 369024 188930 881070 609214 941060 519912 918758 380200 930612 430520 713846 406146 118976 929688 266684 287208 591214 848016 772644 802332 900284 442838 440396 9831...

output:

7734498916
6628564800
8216908164
129358803580
51436236420
487907123580
71842247316
648510550380
71842247316
0
421361395952
51162863264
112171388768
0
334073544452
27623491492
416160596716
309536786792
92491432284
27593256292
443667745364
145065793072
522936289888
145065793072
342834535312
1133803991...

result:

ok 4999 lines

Test #26:

score: 0
Accepted
time: 27ms
memory: 66912kb

input:

5000
194380 496598 358256 902416 145760 512082 842652 743658 41996 748676 232256 642808 774522 346358 198612 322118 18650 755828 293868 94618 101200 162758 466890 220604 619878 709926 718016 838404 209302 73032 414980 147622 780828 347338 561096 72096 859928 821950 743328 388906 866286 78998 128676 ...

output:

37783584400
128347361536
21245977600
553027220964
1763664016
53942849536
119963864164
39446726544
347822500
8952565924
10241440000
48666124816
384248734884
515546976256
5333673024
21792254884
120643686244
5197833216
675601802500
151247876836
6240684004
7393592196
420331788900
438916850064
8463677377...

result:

ok 4999 lines

Subtask #2:

score: 0
Runtime Error

Test #27:

score: 0
Runtime Error

input:

100000
590812 862538 815196 397712 773198 172122 270600 609324 841858 4868 597128 216378 982576 385590 842010 55844 671758 885088 577804 194248 229770 859754 274744 678176 607974 791062 607192 210234 863164 619708 804538 430978 237704 10512 840374 843732 875326 255462 970338 898540 925508 661464 413...

output:

349058819344
315485699072
158174834944
190883984400
29625982884
43598377116
136793375460
505222145492
23697424
122055789444
17217153424
363561360060
92672441524
343745206436
23697424
301341472004
256291624008
271426226484
26531127972
17175971548
316411631620
19435877084
392412501116
57202957148
3506...

result:


Subtask #3:

score: 0
Runtime Error

Test #40:

score: 0
Runtime Error

input:

65536
131908 883754 813278 197778 704074 981802 297078 903698 485360 496064 726120 251990 462786 129558 704500 920556 903884 454552 949354 328526 921462 975888 780002 276668 675308 49774 83014 136308 679916 42174 151084 358830 284218 259680 65684 526980 516764 200170 265060 294150 128046 658864 2984...

output:

17399720464
39116137284
495720197476
88255338084
235574329600
63498960100
16785275364
496320250000
206617520704
107929332676
849092217444
76545182224
2477451076
6891324196
1778646276
22826375056
67433702400
4314387856
40068028900
70256803600
16395778116
89086728676
242284466176
8531108496
4721146752...

result:


Subtask #4:

score: 0
Runtime Error

Dependency #1:

100%
Accepted

Test #55:

score: 0
Runtime Error

input:

30000
661696 503000 699742 77676 355652 951964 547530 995494 826958 507670 922616 912230 156860 940532 968682 956144 246570 848384 667618 325586 243364 686712 702884 886970 464904 683582 988952 366634 181150 458260 166988 24486 265810 968456 443392 293464 464548 546438 344684 283952 634108 496766 79...

output:

5757167376
276582031360
745726864
44717869156
455082461604
11878820100
0
70070281260
6924719776
37793149380
34816689084
363301404072
142427579528
725413330944
348458812416
30933450180
435883098880
390282575076
6192745636
93283819776
123483365604
10649836960
150751618544
0
274809727716
456266573184
4...

result:


Subtask #5:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%