QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#359417#410. Telegraphbonkar40 7ms3828kbC++141.7kb2024-03-20 17:40:212024-03-20 17:41:40

Judging History

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

  • [2024-03-20 17:41:40]
  • 评测
  • 测评结果:40
  • 用时:7ms
  • 内存:3828kb
  • [2024-03-20 17:40:21]
  • 提交

answer

/* Generated by the powerful Sio Tool
 * You can download the binary file here: https://github.com/Arapak/sio-tool
 * Author:  (Karol Bonat)
 * Time of creation: 2024-03-20 09:51:30
 * Notes: 
**/

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

constexpr int MAXN = 106;

int n;
int A[MAXN];
int C[MAXN];

int per[MAXN];

bool usd[MAXN];

bool odw[MAXN];
bool cur[MAXN];
int msk;

// int ile_cyc;
bool DFS(int i){
	if(cur[i]) return 1;// Error
	if(odw[i]){
		return 0;// No Error
	}
	if(((1<<i) & msk ) == 0) return 0; // No error
	cur[i]=1;
	odw[i]=1;
	if(DFS(A[i])) return 1;
	cur[i]=0;
	return 0;
}

bool verify(vector<int> & act){
	for(int i = 0; i <= n; i++){
		odw[i] = 0;
		cur[i] = 0;
	}
	for(auto st : act){
		int i = st;
		if(odw[i]) continue;
		if(DFS(i)) return 1;
	}
	return 0;
	// if(msk < (1<<n)-1) return ile >= 2;
	// return ile >= ;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> A[i] >> C[i];
		A[i]--;
	}
	ll res = LLONG_MAX;
	//Check if input is correct
	int t = 0;
	int cnt = 0;
	while(!odw[t]){
		odw[t] = 1;
		t = A[t];
		cnt++;
	}
	if(cnt == n && t == 0){
		cout << 0 << '\n';
		return 0;
	}
	for(msk = 0; msk < (1 << n)-1; msk++){
		ll r = 0;
		for(int i = 0; i <= n; i++){
			usd[i] = 0;
		}
		vector<int> act;
		for(int i = 0; i < n; i++){
			if((1<<i) & msk){
				if(usd[A[i]]) r=LLONG_MAX;
				usd[A[i]]=1;
				act.push_back(i);
			}
		}
		if(r>0) continue;
		if( verify(act)) continue;

		//Cycklon B

		for(int i = 0; i < n; i++){
			if(!(((1<<i) & msk)>0)){
				r+=C[i];
			}
		}

		res = min(res, r);
	}
	cout << res << '\n';
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 1ms
memory: 3568kb

input:

10
3 85377744
3 191391530
4 553475509
8 344887257
9 812158120
1 880268352
4 686078706
7 182546394
4 220137367
3 89957933

output:

1081551750

result:

ok single line: '1081551750'

Test #2:

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

input:

10
3 688989554
5 112566798
1 294281317
1 96941112
6 746415334
2 612836992
9 629868215
1 406822326
10 638640051
8 199983696

output:

503789227

result:

ok single line: '503789227'

Test #3:

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

input:

10
3 292601364
7 33742065
7 35087125
3 996478615
4 828156197
3 197921984
8 426174077
4 631098259
5 57142735
5 457493107

output:

1212506407

result:

ok single line: '1212506407'

Test #4:

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

input:

10
6 43696822
9 954917333
7 923376581
5 896016118
1 762413411
4 930490625
3 369963586
9 855374192
2 475645419
1 567518871

output:

1936096612

result:

ok single line: '1936096612'

Test #5:

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

input:

10
6 647308632
3 876092601
4 664182389
6 648069973
7 844154274
5 663059265
1 166269448
3 79650124
7 894148102
7 825028282

output:

2396141312

result:

ok single line: '2396141312'

Test #6:

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

input:

10
5 415342264
1 248144257
7 494844360
9 110058957
4 614196536
3 303926057
10 44559777
2 165167138
6 41487942
8 935054045

output:

0

result:

ok single line: '0'

Test #7:

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

input:

10
10 898367504
9 980712897
2 504348852
3 53848467
7 33871940
1 528201989
6 811131714
5 583669822
8 801282745
4 45079808

output:

0

result:

ok single line: '0'

Test #8:

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

input:

10
7 381392744
6 713281537
2 366369696
5 850154328
3 306063696
8 752477922
10 430220003
1 2172506
4 413593900
9 302589220

output:

0

result:

ok single line: '0'

Test #9:

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

input:

10
8 864417984
5 298366530
2 375874188
1 793943838
6 578255452
4 976753854
3 49308293
10 420675190
7 25905054
9 412614983

output:

0

result:

ok single line: '0'

Test #10:

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

input:

10
8 199959576
4 30935170
2 237895032
7 590249700
10 997930856
5 53546139
1 668396582
6 839177874
3 638216209
9 670124394

output:

0

result:

ok single line: '0'

Test #11:

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

input:

10
3 682984816
1 750527363
4 747399524
9 770122612
4 277822071
1 763503810
2 780150157
3 534039209
2 787484871
9 110196910

output:

2452735710

result:

ok single line: '2452735710'

Test #12:

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

input:

10
3 609420368
6 510322166
8 542314367
1 330345071
2 37659569
1 666010057
6 348588802
2 554056808
3 502098004
8 528699593

output:

1761005813

result:

ok single line: '1761005813'

Test #13:

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

input:

10
8 274134580
10 961989771
9 622633320
10 947202277
2 726373936
3 147685332
9 81157442
2 618924860
8 649035297
3 673145097

output:

2069104491

result:

ok single line: '2069104491'

Test #14:

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

input:

10
2 734181527
3 792233387
5 734944475
1 950649869
6 632060537
1 628429351
3 257711095
6 70440442
2 365704961
5 813726083

output:

2057230324

result:

ok single line: '2057230324'

Test #15:

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

input:

10
5 911321676
6 14229951
10 398811075
1 784207645
10 847255630
8 990450195
5 515220506
1 506373283
8 174925801
6 967602129

output:

1609560616

result:

ok single line: '1609560616'

Test #16:

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

input:

10
6 926048691
6 399201736
4 999954689
7 999954691
4 131379719
5 399201738
1 958019465
5 131379717
1 926048690
7 958019463

output:

2546029325

result:

ok single line: '2546029325'

Test #17:

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

input:

10
10 198240446
6 861975533
2 861975531
9 863948357
6 754325322
10 754325324
8 623477668
9 623477670
2 863948359
8 198240447

output:

2636259416

result:

ok single line: '2636259416'

Test #18:

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

input:

10
5 2
6 1
2 2
9 4
2 4
4 4
4 2
2 2
5 4
9 2

output:

11

result:

ok single line: '11'

Test #19:

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

input:

10
9 4
1 4
2 2
2 4
9 2
9 2
4 4
4 2
7 1
1 2

output:

11

result:

ok single line: '11'

Test #20:

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

input:

10
4 729237416
6 914170628
10 148821816
1 56295050
7 162299358
2 743005359
5 438210203
9 722952110
8 360316619
3 154246770

output:

1470738202

result:

ok single line: '1470738202'

Test #21:

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

input:

10
9 256452
7 373097749
6 470342382
8 605026203
10 234516065
3 358737448
2 773335059
4 499255620
1 668606205
5 434491114

output:

1465863334

result:

ok single line: '1465863334'

Test #22:

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

input:

10
7 854166518
5 231824260
10 701295161
3 280917360
6 178305574
9 597373681
4 392423348
2 727851793
8 418759136
1 614530695

output:

459222934

result:

ok single line: '459222934'

Test #23:

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

input:

10
8 476551539
5 837877557
10 122095084
6 40712162
3 964392900
1 36836753
4 11511637
7 126358274
2 837261820
9 821649614

output:

133606721

result:

ok single line: '133606721'

Test #24:

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

input:

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

output:

5

result:

ok single line: '5'

Test #25:

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

input:

10
6 2
9 2
2 2
6 2
6 1
7 1
3 1
1 1
2 2
9 1

output:

6

result:

ok single line: '6'

Test #26:

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

input:

10
8 2
3 2
1 2
8 1
2 2
8 1
1 2
4 1
7 2
6 2

output:

4

result:

ok single line: '4'

Test #27:

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

input:

10
9 1
4 2
7 2
1 1
1 1
9 3
6 1
7 1
3 3
2 2

output:

4

result:

ok single line: '4'

Test #28:

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

input:

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

output:

5

result:

ok single line: '5'

Test #29:

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

input:

10
9 3
6 3
2 2
5 2
3 3
1 2
9 3
5 3
6 1
7 1

output:

6

result:

ok single line: '6'

Test #30:

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

input:

10
2 4
8 3
8 5
5 4
8 4
2 3
8 4
9 3
3 4
3 3

output:

18

result:

ok single line: '18'

Test #31:

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

input:

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

output:

5

result:

ok single line: '5'

Test #32:

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

input:

10
3 2
3 3
5 1
9 2
4 1
2 3
1 3
7 4
4 4
5 3

output:

6

result:

ok single line: '6'

Test #33:

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

input:

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

output:

2

result:

ok single line: '2'

Test #34:

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

input:

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

output:

2

result:

ok single line: '2'

Test #35:

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

input:

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

output:

2

result:

ok single line: '2'

Test #36:

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

input:

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

output:

2

result:

ok single line: '2'

Test #37:

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

input:

10
3 724712539
3 253848450
6 356739170
3 814029021
3 121198630
3 482935623
3 674461095
3 302762682
3 263140130
3 908035622

output:

3637088170

result:

ok single line: '3637088170'

Test #38:

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

input:

10
8 373165894
8 38304954
8 946652851
8 68020615
8 672351134
8 520346777
8 246552191
4 839764410
8 740286919
8 586733383

output:

3245761867

result:

ok single line: '3245761867'

Test #39:

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

input:

10
2 322789650
7 800589256
5 218844607
10 132657931
8 115097238
4 90853818
1 596237875
3 42858053
4 630675305
6 359375208

output:

456501521

result:

ok single line: '456501521'

Test #40:

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

input:

10
8 509356502
1 125947146
7 339373171
3 638520011
8 740701068
9 805814890
4 986647562
2 892452734
10 533157896
6 458258719

output:

1306988392

result:

ok single line: '1306988392'

Test #41:

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

input:

4
2 73822429
1 696182050
1 415286834
3 921421058

output:

489109263

result:

ok single line: '489109263'

Test #42:

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

input:

6
3 258660948
4 317460220
5 307161079
3 306951059
2 624381722
3 329784054

output:

565612007

result:

ok single line: '565612007'

Test #43:

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

input:

6
3 443499466
1 86222039
4 199035324
3 692481060
1 107406962
3 339288546

output:

1068045375

result:

ok single line: '1068045375'

Test #44:

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

input:

7
6 628337985
3 707500209
2 90909568
5 78011060
4 590432202
4 201309390
6 874770682

output:

998568003

result:

ok single line: '998568003'

Test #45:

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

input:

7
4 813176504
5 328778380
4 130267461
5 611024709
1 73457443
1 210813882
4 146962438

output:

679465722

result:

ok single line: '679465722'

Test #46:

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

input:

2
2 998015023
1 939245867

output:

0

result:

ok single line: '0'

Test #47:

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

input:

10
9 218687433
6 82339218
7 150723185
10 838829597
4 909304699
8 607048818
5 143907993
3 326114464
2 953332355
1 396378244

output:

0

result:

ok single line: '0'

Test #48:

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

input:

10
6 951256073
8 91843710
1 94512695
9 111021353
2 133580631
5 226137107
3 562410677
4 938425619
10 63358118
7 32163581

output:

0

result:

ok single line: '0'

Subtask #2:

score: 30
Accepted

Dependency #1:

100%
Accepted

Test #49:

score: 30
Accepted
time: 6ms
memory: 3760kb

input:

15
12 85377744
1 191391530
11 553475509
9 344887257
3 812158120
7 880268352
8 686078706
11 182546394
13 220137367
6 89957933
10 715669848
3 196032869
5 68706224
12 212567593
13 964776170

output:

684094374

result:

ok single line: '684094374'

Test #50:

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

input:

15
7 688989554
6 112566798
7 294281317
6 96941112
14 746415334
4 612836992
2 629868215
9 406822326
8 638640051
14 199983696
4 705596425
6 905127765
7 507689114
3 728980284
3 46064176

output:

2277185531

result:

ok single line: '2277185531'

Test #51:

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

input:

15
2 292601364
11 33742065
4 35087125
3 996478615
12 828156197
2 197921984
12 426174077
7 631098259
3 57142735
9 457493107
14 548039354
11 614222660
11 799188357
8 245392975
7 274835829

output:

1639126475

result:

ok single line: '1639126475'

Test #52:

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

input:

15
14 43696822
3 954917333
2 923376581
13 896016118
9 762413411
14 930490625
6 369963586
7 855374192
13 475645419
3 567518871
10 537965931
3 323317556
14 90687600
13 761805666
11 356123834

output:

2650070396

result:

ok single line: '2650070396'

Test #53:

score: 0
Accepted
time: 7ms
memory: 3580kb

input:

15
9 647308632
7 876092601
12 664182389
10 648069973
6 844154274
12 663059265
2 166269448
5 79650124
8 894148102
12 825028282
3 380408860
6 32412452
1 529670491
3 130734709
2 584895488

output:

1656658263

result:

ok single line: '1656658263'

Test #54:

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

input:

15
10 303926057
6 44559777
2 165167138
1 41487942
4 935054045
12 494604551
11 370335437
14 48311303
5 888990996
13 830561190
9 821169733
7 128365592
15 647147401
3 648156432
8 666183493

output:

0

result:

ok single line: '0'

Test #55:

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

input:

15
4 528201989
15 811131714
9 583669822
5 801282745
11 45079808
3 130389889
6 212778366
7 819579429
12 598085892
8 411735302
2 112668976
14 755814271
10 163560092
1 171593356
13 894955146

output:

0

result:

ok single line: '0'

Test #56:

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

input:

15
8 752477922
3 430220003
4 2172506
10 413593900
11 302589220
14 913658874
2 202704943
6 443363906
7 307180788
5 140393062
13 551651867
15 383262950
1 679972783
12 695030280
9 976243151

output:

0

result:

ok single line: '0'

Test #57:

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

input:

15
15 976753854
14 49308293
12 420675190
11 25905054
2 412614983
13 696927860
9 45147872
7 214632031
3 16275684
4 721567174
1 843151110
10 10711628
8 48901826
6 218467204
5 57531157

output:

0

result:

ok single line: '0'

Test #58:

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

input:

15
8 53546139
14 668396582
1 839177874
15 638216209
10 670124394
4 332713198
13 35074449
6 985900156
7 725370579
12 302741286
3 134650352
2 638160307
11 565314517
9 889387776
5 286302810

output:

0

result:

ok single line: '0'

Test #59:

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

input:

14
8 787484871
11 573633243
10 615982183
3 25001026
1 110196910
13 277822071
8 780150157
3 750527363
12 81727208
11 609684634
12 883915398
13 765608986
1 770122612
10 434465475

output:

2290330804

result:

ok single line: '2290330804'

Test #60:

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

input:

14
8 502098004
11 528699593
4 598139899
8 540541312
7 37659569
10 899251169
6 510322166
11 542314367
10 143560371
14 880952759
7 554056808
6 867443955
14 865132486
4 965089510

output:

3185612088

result:

ok single line: '3185612088'

Test #61:

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

input:

14
3 504737236
3 156631729
10 546263623
10 114552590
8 961989771
13 622633320
1 138915
6 673145097
6 147685332
5 667989991
8 947202277
13 857370533
1 535036507
5 726373936

output:

2656834154

result:

ok single line: '2656834154'

Test #62:

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

input:

14
5 734181527
13 257711095
5 365704961
6 595614619
13 792233387
12 774921383
1 950649869
12 483481633
14 709233811
11 699813462
14 818305492
1 795438670
11 734944475
6 776005362

output:

3906998251

result:

ok single line: '3906998251'

Test #63:

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

input:

14
2 689740039
9 601574478
9 418328707
2 847255630
10 174925801
13 784207645
4 515220506
11 999894324
14 547273487
13 506373283
10 922887349
14 887113862
4 911321676
11 856095495

output:

3707957318

result:

ok single line: '3707957318'

Test #64:

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

input:

14
14 459566784
5 399201736
14 55226683
3 55226682
10 399201738
7 532182968
5 532182970
13 625246270
10 530409965
3 530409967
12 737359816
7 737359818
12 625246272
13 459566786

output:

2525852865

result:

ok single line: '2525852865'

Test #65:

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

input:

14
7 149498254
9 473729367
7 623477670
3 623477669
14 522109547
14 520628805
2 149498256
6 520628803
10 71877941
6 882755685
9 71877939
2 473729365
10 882755683
3 522109549

output:

2006119547

result:

ok single line: '2006119547'

Test #66:

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

input:

14
10 4
8 2
10 2
5 4
1 4
10 2
5 2
12 4
8 4
9 1
12 2
4 4
4 2
1 2

output:

15

result:

ok single line: '15'

Test #67:

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

input:

14
4 4
5 2
5 4
12 4
7 4
12 2
1 4
13 2
13 2
1 2
7 2
13 4
3 1
4 2

output:

15

result:

ok single line: '15'

Test #68:

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

input:

14
11 111286834
10 418724310
12 360316619
13 148821816
9 56295050
7 196921980
6 108646817
14 639577372
5 729237416
2 434474131
1 409449704
3 722952110
4 154246770
8 207614390

output:

1411705836

result:

ok single line: '1411705836'

Test #69:

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

input:

14
2 358737448
1 470342382
14 773335059
12 835063069
9 879914943
10 256452
11 990623816
13 942161234
5 186848557
6 668606205
7 820381730
4 931076615
8 950886822
3 373097749

output:

3516546239

result:

ok single line: '3516546239'

Test #70:

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

input:

14
11 280917360
9 462511748
1 392423348
12 418759136
2 571797928
13 222575858
4 597373681
6 529476626
3 854166518
5 503699420
10 142006434
14 727851793
7 319815865
8 29291486

output:

171297920

result:

ok single line: '171297920'

Test #71:

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

input:

14
11 837261820
4 836228556
10 925275419
1 821649614
2 661558748
13 126358274
6 89960427
7 152972040
5 238571521
8 274967545
14 837877557
3 40712162
12 11511637
9 19218063

output:

30729700

result:

ok single line: '30729700'

Test #72:

score: 0
Accepted
time: 6ms
memory: 3516kb

input:

15
2 2
13 2
4 2
5 1
10 1
7 1
5 1
3 2
10 2
1 2
5 1
11 1
8 1
3 1
13 2

output:

6

result:

ok single line: '6'

Test #73:

score: 0
Accepted
time: 6ms
memory: 3828kb

input:

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

output:

5

result:

ok single line: '5'

Test #74:

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

input:

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

output:

7

result:

ok single line: '7'

Test #75:

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

input:

15
4 1
13 2
9 2
10 1
2 1
1 3
3 1
13 1
8 3
12 2
4 3
8 2
1 1
4 3
10 1

output:

9

result:

ok single line: '9'

Test #76:

score: 0
Accepted
time: 6ms
memory: 3560kb

input:

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

output:

7

result:

ok single line: '7'

Test #77:

score: 0
Accepted
time: 6ms
memory: 3576kb

input:

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

output:

10

result:

ok single line: '10'

Test #78:

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

input:

15
5 4
12 3
12 5
13 4
6 4
8 3
3 4
9 3
10 4
12 3
3 4
8 5
9 4
6 2
10 5

output:

22

result:

ok single line: '22'

Test #79:

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

input:

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

output:

10

result:

ok single line: '10'

Test #80:

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

input:

15
10 2
8 3
7 1
7 2
1 1
2 3
8 3
6 4
14 4
1 3
6 5
5 2
14 2
1 4
6 3

output:

17

result:

ok single line: '17'

Test #81:

score: 0
Accepted
time: 7ms
memory: 3708kb

input:

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

output:

2

result:

ok single line: '2'

Test #82:

score: 0
Accepted
time: 7ms
memory: 3580kb

input:

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

output:

2

result:

ok single line: '2'

Test #83:

score: 0
Accepted
time: 7ms
memory: 3628kb

input:

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

output:

2

result:

ok single line: '2'

Test #84:

score: 0
Accepted
time: 7ms
memory: 3560kb

input:

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

output:

2

result:

ok single line: '2'

Test #85:

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

input:

15
3 263140130
3 623555286
8 814029021
3 335303059
3 332482739
3 907086607
3 460867359
3 121198630
3 6139331
3 253848450
3 908035622
3 103399081
3 731860554
3 993288255
3 316692873

output:

5363609721

result:

ok single line: '5363609721'

Test #86:

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

input:

15
3 313034666
3 520346777
6 38304954
3 106571185
3 672351134
3 740286919
3 789408317
3 430523530
3 835731184
3 771465630
3 373165894
3 332170734
3 169962255
3 139967977
3 944141552

output:

6194986202

result:

ok single line: '6194986202'

Test #87:

score: 0
Accepted
time: 6ms
memory: 3808kb

input:

15
15 953960454
3 825657761
9 730355662
13 359375208
6 572677302
8 132657931
1 508897020
5 630675305
2 879057151
12 41692427
4 115097238
14 62964872
11 90853818
10 571590230
7 413458739

output:

1409018577

result:

ok single line: '1409018577'

Test #88:

score: 0
Accepted
time: 7ms
memory: 3584kb

input:

15
7 25309711
8 125947146
10 208462640
14 668100690
9 354464115
3 740701068
12 477397378
11 509356502
13 199038909
6 892452734
2 339373171
1 642230393
5 622866539
15 501623787
4 588152047

output:

1060382193

result:

ok single line: '1060382193'

Test #89:

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

input:

3
2 73822429
1 696182050
1 415286834

output:

489109263

result:

ok single line: '489109263'

Test #90:

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

input:

14
13 258660948
13 317460220
1 307161079
5 306951059
7 624381722
8 329784054
8 182903522
2 364123724
10 117075043
11 775000611
5 896676390
10 785214763
10 601419915
1 671754874

output:

1774171566

result:

ok single line: '1774171566'

Test #91:

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

input:

9
4 443499466
8 86222039
8 199035324
8 692481060
3 107406962
8 339288546
3 602578926
9 983212013
1 729386198

output:

1085145385

result:

ok single line: '1085145385'

Test #92:

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

input:

5
2 628337985
4 707500209
4 90909568
3 78011060
2 590432202

output:

681341770

result:

ok single line: '681341770'

Test #93:

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

input:

14
4 813176504
12 328778380
8 130267461
3 611024709
8 73457443
5 210813882
11 146962438
9 221388592
2 101492155
7 977323920
3 62997118
6 676220747
11 483765951
10 242065645

output:

283416999

result:

ok single line: '283416999'

Test #94:

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

input:

11
7 72834726
11 206933676
9 566637842
2 685028766
3 987960529
8 872888957
5 713803309
10 843306592
6 613109258
4 165209208
1 834265243

output:

0

result:

ok single line: '0'

Test #95:

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

input:

7
2 382084710
3 32630246
4 892024275
6 218687433
7 82339218
5 150723185
1 838829597

output:

0

result:

ok single line: '0'

Test #96:

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

input:

2
2 781596402
1 192612891

output:

0

result:

ok single line: '0'

Subtask #3:

score: 0
Runtime Error

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #97:

score: 0
Runtime Error

input:

3000
2020 85377744
1809 191391530
681 553475509
1252 344887257
1810 812158120
1961 880268352
978 686078706
261 182546394
2253 220137367
1367 89957933
535 715669848
784 196032869
1136 68706224
301 212567593
2203 964776170
2030 301950428
1584 426542625
2743 941604921
2909 994719311
2512 659998485
1485...

output:


result:


Subtask #4:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

0%