UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#196384#2401. 移动snow_trace10049669ms159800kbC++112.9kb2023-10-24 11:41:042023-10-24 12:20:08

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
int dis[105][105];
int b[4][4],w[400005][4];
int n,m,c,k,a,t;
struct nd{
	int a[4][4];
};
struct node{
	int l,r;
	nd aa;
	void add(){
		memset(aa.a,31,sizeof(aa.a));
	//	cout << 11 << endl;
		for(int i =0;i<k;i++){
			for(int j =0;j<k;j++){
				int p[5],h = 0;
				for(int ll =0;ll<k;ll++)if(ll!=i)p[++h] = ll;
				do{
					int tot = dis[w[l][i]][w[l+1][j]]*a;
					//cout << tot << endl;
					for(int ii =1;ii<=k-1;ii++)tot+=dis[w[l][p[ii]]][w[l+1][ii-1+(j<=ii-1)]];
					aa.a[i][j] = min(aa.a[i][j],tot);
				}while(next_permutation(p+1,p+1+h));
			}
		}//cout << 111 << endl;
	}
}tree[1500000];
void push_up(int kk){
	memset(tree[kk].aa.a,63,sizeof(tree[kk].aa.a));
	//cout << 11 << endl;
	for(int i =0;i<k;i++){
		for(int j =0;j<k;j++){
			for(int l =0;l<k;l++){
				tree[kk].aa.a[i][j] = min(tree[kk].aa.a[i][j],tree[kk<<1].aa.a[i][l]+tree[kk<<1|1].aa.a[l][j]);
			}
		}
	}//cout << 111 << endl;
	return;
}
void build(int l,int r,int k){
	//cout << " "<< l << " " << r << " " << k << endl;
	tree[k].l =l ,tree[k].r = r;
	if(l+1 == r){
		tree[k].add();return;
	}build(l,l+r>>1,k<<1),build(l+r>>1,r,k<<1|1);
	push_up(k);return;
}void upd(int k,int pos){
	int l = tree[k].l,r =tree[k].r;
	if(pos>=r or pos<l)return;
	if(l+1 == r and l==pos){
		tree[k].add();return;
	}upd(k<<1,pos),upd(k<<1|1,pos);push_up(k);
}nd query(int kk,int l,int r){
	//cout << " " << k << " " << l << " " << r << endl;
	int ll = tree[kk].l,rr = tree[kk].r;
	//cout << ll << " " << rr << endl;
	int mid = ll+rr>>1;
	if(l<=ll and rr<=r)return tree[kk].aa;
	if(r<=mid)return query(kk<<1,l,r);
	if(l>=mid)return query(kk<<1|1,l,r);
	nd aa = query(kk<<1,l,r),bb = query(kk<<1|1,l,r);
	nd cc;memset(cc.a,63,sizeof(cc.a));
	for(int i =0;i<k;i++){
		for(int j =0;j<k;j++){
			for(int l =0;l<k;l++){
				cc.a[i][j] = min(cc.a[i][j],aa.a[i][l]+bb.a[l][j]);
			}
		}
	}return cc;
}
signed main(){
	ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
	memset(dis,31,sizeof(dis));
	for(int i =0;i<=n;i++)dis[i][0] = dis[0][i] = 0;
	cin >> n >> m >> c >> k >> a >> t;
	for(int i = 1;i<=n;i++)dis[i][i] = 0;
	for(int i = 1;i<=m;i++){
		int a,b,c;cin >> a >> b >> c;
		dis[a][b] = dis[b][a] = min(dis[a][b],c);
	}for(int i = 1;i<=c;i++){
		for(int j =0;j<k;j++)cin>> w[i][j];
	}for(int l = 1;l<=n;l++){
		for(int i =1;i<=n;i++){
			for(int j = 1;j<=n;j++){
				dis[i][j] = min(dis[i][j],dis[i][l]+dis[l][j]);
			}
		}
	}
	build(1,c,1);//cout << 111 << endl;
	//cout << 11 << endl;
	for(int i = 1;i<=t;i++){
		int op;cin >> op;
		if(op == 1){
			int pos;cin >> pos;
			for(int j =0;j<k;j++)cin >> w[pos][j];
			upd(1,pos-1),upd(1,pos);
		}else{
			int l,r;cin >> l >> r;nd res= query(1,l,r);
			int mx =2000000000000005;
			for(int ii =0;ii<k;ii++)for(int jj =0;jj<k;jj++)mx = min(mx,res.a[ii][jj]);
			cout << mx << endl;
		}
	}
	return 0;
}

Details

小提示:点击横条可展开更详细的信息

Subtask #1:

score: 12
Accepted

Test #1:

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

input:

100 4950 100 3 8 100
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 100000
1 ...

output:

19200000
12200000
9200000
37829960
15000000
34225944
38025944
64029960
44607896
16407896
41506760
18...

result:

ok 46 lines

Test #2:

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

input:

100 4950 100 3 8 100
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 100000
1 ...

output:

2744035
18167501
22006605
28818212
6907240
3612361
1444312
15553517
13735954
4591565
4200000
1069568...

result:

ok 51 lines

Test #3:

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

input:

100 4950 100 3 10 100
1 2 100000
1 3 100000
1 4 100000
1 5 854
1 6 100000
1 7 100000
1 8 100000
1 9 ...

output:

2163754
1581882
4584278
748775
3283128
3480438
2495086
114215
3821547
5358185
4313402
890444
3096741...

result:

ok 50 lines

Test #4:

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

input:

100 4950 100 3 10 100
1 2 100000
1 3 100000
1 4 100000
1 5 854
1 6 100000
1 7 100000
1 8 100000
1 9 ...

output:

301121
176103
221604
529067
152483
613265
330344
427487
349829
67672
494405
644591
394554
46287
2035...

result:

ok 53 lines

Test #5:

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

input:

100 4950 100 3 10 100
1 2 100000
1 3 100000
1 4 100000
1 5 854
1 6 100000
1 7 100000
1 8 100000
1 9 ...

output:

214746
312576
267986
222726
31947
265087
205965
345227
258188
69899
217721
545186
325254
44551
24503...

result:

ok 51 lines

Test #6:

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

input:

100 4950 100 3 10 100
1 2 100000
1 3 100000
1 4 100000
1 5 854
1 6 100000
1 7 100000
1 8 100000
1 9 ...

output:

33748
44248
119485
6631
51563
6631
24981
92302
60144
86235
16781
38527
18750
70525
133610
59469
1517...

result:

ok 54 lines

Test #7:

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

input:

100 4950 100 3 10 100
1 2 109
1 3 4
1 4 100000
1 5 903
1 6 244
1 7 692
1 8 314
1 9 100000
1 10 146
1...

output:

45744
33380
24997
22184
46315
32760
27868
1599
13696
24006
10331
28711
13217
28384
9406
2047
37767
1...

result:

ok 46 lines

Test #8:

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

input:

100 4950 100 3 10 100
1 2 492
1 3 703
1 4 100000
1 5 733
1 6 244
1 7 902
1 8 314
1 9 100000
1 10 157...

output:

2700
8092
28638
22475
14174
352
10133
27330
33418
12893
1535
17896
10909
14810
3088
2586
12262
10852...

result:

ok 52 lines

Test #9:

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

input:

100 4950 100 3 10 100
1 2 415
1 3 568
1 4 422
1 5 81
1 6 361
1 7 468
1 8 816
1 9 544
1 10 356
1 11 5...

output:

519
24398
18644
4240
589
547
3027
17678
14897
3641
5928
22165
1399
1941
2674
11649
8689
11315
20169
...

result:

ok 44 lines

Subtask #2:

score: 15
Accepted

Test #10:

score: 15
Accepted
time: 417ms
memory: 159796kb

input:

100 4950 351493 3 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 10...

output:

240622197023
44718374529
125207142058
172222204245
107481870153
178209992500
80482941120
24844503109...

result:

ok 100000 lines

Test #11:

score: 0
Accepted
time: 460ms
memory: 159796kb

input:

100 4950 351493 3 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 10...

output:

80620061382
20965420959
106527182948
72133787220
133520775036
52748448357
118269549201
6183378836
76...

result:

ok 100000 lines

Test #12:

score: 0
Accepted
time: 470ms
memory: 159800kb

input:

100 4950 351493 3 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 854
1 6 100000
1 7 100000
1 8 10000...

output:

10814589077
19893869783
3764796417
10122706194
3458648453
715696381
344374345
15748879910
6909452505...

result:

ok 100000 lines

Test #13:

score: 0
Accepted
time: 451ms
memory: 159796kb

input:

100 4950 351493 3 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 854
1 6 100000
1 7 100000
1 8 10000...

output:

2250281870
3982158285
2777971954
4234237112
3274778314
4845063107
1687483595
3524690383
4312422367
2...

result:

ok 100000 lines

Test #14:

score: 0
Accepted
time: 509ms
memory: 159792kb

input:

100 4950 351493 3 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 854
1 6 100000
1 7 100000
1 8 10000...

output:

1731387779
317777675
194018806
179810757
2199789457
41829240
520680858
1424750383
830762935
52747873...

result:

ok 100000 lines

Test #15:

score: 0
Accepted
time: 794ms
memory: 159796kb

input:

100 4950 351493 4 4 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 100...

output:

67765997
93865190
210084717
57107735
93832556
54909690
178192011
128631757
17296027
231916712
118966...

result:

ok 100000 lines

Test #16:

score: 0
Accepted
time: 836ms
memory: 159796kb

input:

100 4950 351493 4 4 100000
1 2 701
1 3 783
1 4 34
1 5 100000
1 6 100000
1 7 697
1 8 89
1 9 100000
1 ...

output:

40877281
75532019
52782937
114706822
73590672
12072480
87965685
79135298
43027018
57870384
18163480
...

result:

ok 100000 lines

Test #17:

score: 0
Accepted
time: 852ms
memory: 159796kb

input:

100 4950 351493 4 4 100000
1 2 701
1 3 812
1 4 34
1 5 624
1 6 100000
1 7 962
1 8 699
1 9 878
1 10 14...

output:

57645223
19919046
64559733
33009336
11549507
33416827
55801589
22099634
83197465
24962512
82416847
8...

result:

ok 100000 lines

Test #18:

score: 0
Accepted
time: 900ms
memory: 159796kb

input:

100 4950 351493 4 4 100000
1 2 632
1 3 761
1 4 546
1 5 338
1 6 992
1 7 553
1 8 757
1 9 787
1 10 97
1...

output:

7116286
13259342
21673839
10415457
25826968
15843292
51271977
4658096
51805039
38900305
3970549
4226...

result:

ok 100000 lines

Subtask #3:

score: 19
Accepted

Test #19:

score: 19
Accepted
time: 351ms
memory: 159792kb

input:

100 4950 351493 1 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 10...

output:

88025960740
97969300080
19411848100
41067912550
144164026380
84989869070
50451985120
142042946400
52...

result:

ok 49939 lines

Test #20:

score: 0
Accepted
time: 366ms
memory: 159796kb

input:

100 4950 351493 1 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 10...

output:

171418263210
175354019690
160504493090
26057191090
230805254280
10909159360
21199912560
39857912610
...

result:

ok 49938 lines

Test #21:

score: 0
Accepted
time: 334ms
memory: 159796kb

input:

100 4950 351493 1 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 10...

output:

12558966620
6095322930
25607382020
686695880
17620969210
5312452770
1798364610
34812195320
152890667...

result:

ok 49846 lines

Test #22:

score: 0
Accepted
time: 323ms
memory: 159796kb

input:

100 4950 351493 1 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 10...

output:

1842168720
985215780
1370752840
10717029840
14140257410
2189522770
12580711510
16763211350
481860867...

result:

ok 50191 lines

Test #23:

score: 0
Accepted
time: 318ms
memory: 159792kb

input:

100 4950 351493 1 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 10...

output:

653576650
770365300
368889250
1159084800
1227282150
1781396130
850902320
649173550
801784360
1172999...

result:

ok 49853 lines

Test #24:

score: 0
Accepted
time: 401ms
memory: 159792kb

input:

100 4950 351493 1 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 614
1 8 10000...

output:

1000156710
753821550
528865270
331894010
526595720
10941400
644654950
135157790
418426700
641451020
...

result:

ok 49895 lines

Test #25:

score: 0
Accepted
time: 356ms
memory: 159796kb

input:

100 4950 351493 1 10 100000
1 2 919
1 3 100000
1 4 140
1 5 181
1 6 100000
1 7 177
1 8 100000
1 9 116...

output:

51454620
152099710
41781070
7740030
102492720
116108890
56715640
45289760
60469660
134269440
628290
...

result:

ok 49918 lines

Test #26:

score: 0
Accepted
time: 307ms
memory: 159796kb

input:

100 4950 351493 1 10 100000
1 2 816
1 3 155
1 4 140
1 5 181
1 6 100000
1 7 373
1 8 252
1 9 116
1 10 ...

output:

68519960
17291250
8392620
91199050
60889430
95846510
34359490
82606740
2671030
29623590
51750260
141...

result:

ok 50024 lines

Test #27:

score: 0
Accepted
time: 371ms
memory: 159796kb

input:

100 4950 351493 1 10 100000
1 2 479
1 3 454
1 4 151
1 5 654
1 6 354
1 7 511
1 8 402
1 9 125
1 10 322...

output:

115261840
4461520
8047390
57172670
34309180
132967650
83174890
121171660
90294220
143619750
34726810...

result:

ok 49715 lines

Subtask #4:

score: 11
Accepted

Test #28:

score: 11
Accepted
time: 345ms
memory: 159796kb

input:

100 4950 351493 1 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 10...

output:

88025960740
97969300080
19411848100
41067912550
144164026380
84989869070
50451985120
142042946400
52...

result:

ok 49939 lines

Test #29:

score: 0
Accepted
time: 329ms
memory: 159792kb

input:

100 4950 351493 1 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 10...

output:

171418263210
175354019690
160504493090
26057191090
230805254280
10909159360
21199912560
39857912610
...

result:

ok 49938 lines

Test #30:

score: 0
Accepted
time: 331ms
memory: 159800kb

input:

100 4950 351493 1 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 10...

output:

12558966620
6095322930
25607382020
686695880
17620969210
5312452770
1798364610
34812195320
152890667...

result:

ok 49846 lines

Test #31:

score: 0
Accepted
time: 332ms
memory: 159792kb

input:

100 4950 351493 1 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 10...

output:

1842168720
985215780
1370752840
10717029840
14140257410
2189522770
12580711510
16763211350
481860867...

result:

ok 50191 lines

Test #32:

score: 0
Accepted
time: 336ms
memory: 159796kb

input:

100 4950 351493 1 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 10...

output:

653576650
770365300
368889250
1159084800
1227282150
1781396130
850902320
649173550
801784360
1172999...

result:

ok 49853 lines

Test #33:

score: 0
Accepted
time: 327ms
memory: 159796kb

input:

100 4950 351493 1 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 614
1 8 10000...

output:

1000156710
753821550
528865270
331894010
526595720
10941400
644654950
135157790
418426700
641451020
...

result:

ok 49895 lines

Test #34:

score: 0
Accepted
time: 322ms
memory: 159796kb

input:

100 4950 351493 1 10 100000
1 2 919
1 3 100000
1 4 140
1 5 181
1 6 100000
1 7 177
1 8 100000
1 9 116...

output:

51454620
152099710
41781070
7740030
102492720
116108890
56715640
45289760
60469660
134269440
628290
...

result:

ok 49918 lines

Test #35:

score: 0
Accepted
time: 316ms
memory: 159796kb

input:

100 4950 351493 1 10 100000
1 2 816
1 3 155
1 4 140
1 5 181
1 6 100000
1 7 373
1 8 252
1 9 116
1 10 ...

output:

68519960
17291250
8392620
91199050
60889430
95846510
34359490
82606740
2671030
29623590
51750260
141...

result:

ok 50024 lines

Test #36:

score: 0
Accepted
time: 299ms
memory: 159796kb

input:

100 4950 351493 1 10 100000
1 2 479
1 3 454
1 4 151
1 5 654
1 6 354
1 7 511
1 8 402
1 9 125
1 10 322...

output:

115261840
4461520
8047390
57172670
34309180
132967650
83174890
121171660
90294220
143619750
34726810...

result:

ok 49715 lines

Test #37:

score: 0
Accepted
time: 359ms
memory: 159792kb

input:

100 4950 351493 2 3 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 100...

output:

19136558658
75322646922
65523716975
37157423322
66319821963
34712467111
51627733001
35101560419
7201...

result:

ok 49844 lines

Test #38:

score: 0
Accepted
time: 448ms
memory: 159800kb

input:

100 4950 351493 2 3 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 100...

output:

16557318894
27340182410
63687210665
43060502930
193794712
804896586
58239589695
20567867638
55465263...

result:

ok 49852 lines

Test #39:

score: 0
Accepted
time: 420ms
memory: 159792kb

input:

100 4950 351493 2 3 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 100...

output:

2694908555
2924018204
4241213541
3634469387
8389620800
8339354787
7646835124
4064862859
1637503354
1...

result:

ok 49850 lines

Test #40:

score: 0
Accepted
time: 340ms
memory: 159796kb

input:

100 4950 351493 2 3 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 596...

output:

63711520
2766015861
2346093944
2473679516
1801965163
2316614587
758275082
494568362
709271030
266359...

result:

ok 49848 lines

Test #41:

score: 0
Accepted
time: 393ms
memory: 159800kb

input:

100 4950 351493 2 3 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 596...

output:

384641524
362550600
84910176
279232216
76456975
326949316
331211665
41165179
18762191
289969636
4479...

result:

ok 49849 lines

Test #42:

score: 0
Accepted
time: 360ms
memory: 159796kb

input:

100 4950 351493 2 3 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 596...

output:

219560624
271325317
8132581
181253620
98942375
247568754
1204002
89113248
32148953
74493823
15802671...

result:

ok 49857 lines

Test #43:

score: 0
Accepted
time: 354ms
memory: 159796kb

input:

100 4950 351493 2 1 100000
1 2 586
1 3 545
1 4 100000
1 5 100000
1 6 823
1 7 881
1 8 100000
1 9 1000...

output:

37422359
45864443
32567537
13581712
18491748
2077654
2235370
37035025
11191475
3008965
4490354
79624...

result:

ok 49759 lines

Test #44:

score: 0
Accepted
time: 396ms
memory: 159796kb

input:

100 4950 351493 2 1 100000
1 2 837
1 3 545
1 4 802
1 5 217
1 6 806
1 7 881
1 8 584
1 9 496
1 10 259
...

output:

18879429
2215511
26766927
26238385
10362326
26292734
8899576
21362097
19088613
13130838
16433927
894...

result:

ok 49774 lines

Test #45:

score: 0
Accepted
time: 365ms
memory: 159796kb

input:

100 4950 351493 2 1 100000
1 2 716
1 3 402
1 4 274
1 5 694
1 6 117
1 7 909
1 8 27
1 9 980
1 10 592
1...

output:

14331660
3121135
10454839
1274180
6566237
12423266
1830494
1981663
4322261
19734398
22130473
1218864...

result:

ok 49855 lines

Subtask #5:

score: 21
Accepted

Test #46:

score: 21
Accepted
time: 430ms
memory: 159796kb

input:

100 4950 351493 3 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 10...

output:

240622197023
44718374529
125207142058
172222204245
107481870153
178209992500
80482941120
24844503109...

result:

ok 100000 lines

Test #47:

score: 0
Accepted
time: 499ms
memory: 159796kb

input:

100 4950 351493 3 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 10...

output:

80620061382
20965420959
106527182948
72133787220
133520775036
52748448357
118269549201
6183378836
76...

result:

ok 100000 lines

Test #48:

score: 0
Accepted
time: 457ms
memory: 159792kb

input:

100 4950 351493 3 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 854
1 6 100000
1 7 100000
1 8 10000...

output:

10814589077
19893869783
3764796417
10122706194
3458648453
715696381
344374345
15748879910
6909452505...

result:

ok 100000 lines

Test #49:

score: 0
Accepted
time: 407ms
memory: 159796kb

input:

100 4950 351493 3 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 854
1 6 100000
1 7 100000
1 8 10000...

output:

2250281870
3982158285
2777971954
4234237112
3274778314
4845063107
1687483595
3524690383
4312422367
2...

result:

ok 100000 lines

Test #50:

score: 0
Accepted
time: 416ms
memory: 159796kb

input:

100 4950 351493 3 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 854
1 6 100000
1 7 100000
1 8 10000...

output:

1731387779
317777675
194018806
179810757
2199789457
41829240
520680858
1424750383
830762935
52747873...

result:

ok 100000 lines

Test #51:

score: 0
Accepted
time: 838ms
memory: 159792kb

input:

100 4950 351493 4 4 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 100...

output:

67765997
93865190
210084717
57107735
93832556
54909690
178192011
128631757
17296027
231916712
118966...

result:

ok 100000 lines

Test #52:

score: 0
Accepted
time: 764ms
memory: 159792kb

input:

100 4950 351493 4 4 100000
1 2 701
1 3 783
1 4 34
1 5 100000
1 6 100000
1 7 697
1 8 89
1 9 100000
1 ...

output:

40877281
75532019
52782937
114706822
73590672
12072480
87965685
79135298
43027018
57870384
18163480
...

result:

ok 100000 lines

Test #53:

score: 0
Accepted
time: 798ms
memory: 159792kb

input:

100 4950 351493 4 4 100000
1 2 701
1 3 812
1 4 34
1 5 624
1 6 100000
1 7 962
1 8 699
1 9 878
1 10 14...

output:

57645223
19919046
64559733
33009336
11549507
33416827
55801589
22099634
83197465
24962512
82416847
8...

result:

ok 100000 lines

Test #54:

score: 0
Accepted
time: 870ms
memory: 159792kb

input:

100 4950 351493 4 4 100000
1 2 632
1 3 761
1 4 546
1 5 338
1 6 992
1 7 553
1 8 757
1 9 787
1 10 97
1...

output:

7116286
13259342
21673839
10415457
25826968
15843292
51271977
4658096
51805039
38900305
3970549
4226...

result:

ok 100000 lines

Test #55:

score: 0
Accepted
time: 570ms
memory: 159796kb

input:

100 4950 351493 3 1 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 100...

output:

19404961614
37308696015
37175223846
9911873054
20272339619
29436655502
21159471004
28322031292
34820...

result:

ok 49992 lines

Test #56:

score: 0
Accepted
time: 581ms
memory: 159792kb

input:

100 4950 351493 3 1 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 100...

output:

25263841879
11562757507
11432860407
27252669207
12317613155
8613600119
42186822717
26846523958
44125...

result:

ok 49994 lines

Test #57:

score: 0
Accepted
time: 562ms
memory: 159796kb

input:

100 4950 351493 3 1 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 100...

output:

5202375080
1305859191
6361228100
2804618744
4762645112
1708776480
3159405551
1468694335
6271557016
6...

result:

ok 50384 lines

Test #58:

score: 0
Accepted
time: 512ms
memory: 159792kb

input:

100 4950 351493 3 1 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 100...

output:

3101988413
3076347212
2977455312
131723938
1532920879
2865699723
1831780028
466642664
810299909
1588...

result:

ok 50387 lines

Test #59:

score: 0
Accepted
time: 487ms
memory: 159792kb

input:

100 4950 351493 3 1 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 100...

output:

24220369
160147432
37138866
292004063
152187217
1380317
179526465
40983737
14243917
441218166
631260...

result:

ok 50393 lines

Test #60:

score: 0
Accepted
time: 492ms
memory: 159796kb

input:

100 4950 351493 3 1 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 100...

output:

95920606
130516615
7051091
2971975
22735958
78094145
70705761
21748551
26342452
66015108
31026980
77...

result:

ok 50398 lines

Test #61:

score: 0
Accepted
time: 488ms
memory: 159796kb

input:

100 4950 351493 3 1 100000
1 2 100000
1 3 100000
1 4 889
1 5 100000
1 6 378
1 7 185
1 8 443
1 9 453
...

output:

26837388
50936248
18903984
5722950
21397341
33371711
15136798
13914832
76814709
9858018
64272904
540...

result:

ok 50383 lines

Test #62:

score: 0
Accepted
time: 979ms
memory: 159796kb

input:

100 4950 351493 4 1 100000
1 2 21
1 3 376
1 4 560
1 5 175
1 6 100000
1 7 410
1 8 673
1 9 246
1 10 32...

output:

39759077
4082796
6705360
39398465
23870408
20907371
7039326
42798397
3435295
11152721
41516383
11329...

result:

ok 49914 lines

Test #63:

score: 0
Accepted
time: 1016ms
memory: 159800kb

input:

100 4950 351493 4 1 100000
1 2 481
1 3 112
1 4 145
1 5 441
1 6 57
1 7 821
1 8 776
1 9 13
1 10 488
1 ...

output:

8972841
32395540
36776698
25494188
50915854
6635157
18464208
13144431
28956564
29897769
18034206
250...

result:

ok 50085 lines

Subtask #6:

score: 22
Accepted

Test #64:

score: 22
Accepted
time: 3ms
memory: 1388kb

input:

100 4950 100 3 8 100
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 100000
1 ...

output:

19200000
12200000
9200000
37829960
15000000
34225944
38025944
64029960
44607896
16407896
41506760
18...

result:

ok 46 lines

Test #65:

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

input:

100 4950 100 3 8 100
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 100000
1 ...

output:

2744035
18167501
22006605
28818212
6907240
3612361
1444312
15553517
13735954
4591565
4200000
1069568...

result:

ok 51 lines

Test #66:

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

input:

100 4950 100 3 10 100
1 2 100000
1 3 100000
1 4 100000
1 5 854
1 6 100000
1 7 100000
1 8 100000
1 9 ...

output:

2163754
1581882
4584278
748775
3283128
3480438
2495086
114215
3821547
5358185
4313402
890444
3096741...

result:

ok 50 lines

Test #67:

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

input:

100 4950 100 3 10 100
1 2 100000
1 3 100000
1 4 100000
1 5 854
1 6 100000
1 7 100000
1 8 100000
1 9 ...

output:

301121
176103
221604
529067
152483
613265
330344
427487
349829
67672
494405
644591
394554
46287
2035...

result:

ok 53 lines

Test #68:

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

input:

100 4950 100 3 10 100
1 2 100000
1 3 100000
1 4 100000
1 5 854
1 6 100000
1 7 100000
1 8 100000
1 9 ...

output:

214746
312576
267986
222726
31947
265087
205965
345227
258188
69899
217721
545186
325254
44551
24503...

result:

ok 51 lines

Test #69:

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

input:

100 4950 100 3 10 100
1 2 100000
1 3 100000
1 4 100000
1 5 854
1 6 100000
1 7 100000
1 8 100000
1 9 ...

output:

33748
44248
119485
6631
51563
6631
24981
92302
60144
86235
16781
38527
18750
70525
133610
59469
1517...

result:

ok 54 lines

Test #70:

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

input:

100 4950 100 3 10 100
1 2 109
1 3 4
1 4 100000
1 5 903
1 6 244
1 7 692
1 8 314
1 9 100000
1 10 146
1...

output:

45744
33380
24997
22184
46315
32760
27868
1599
13696
24006
10331
28711
13217
28384
9406
2047
37767
1...

result:

ok 46 lines

Test #71:

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

input:

100 4950 100 3 10 100
1 2 492
1 3 703
1 4 100000
1 5 733
1 6 244
1 7 902
1 8 314
1 9 100000
1 10 157...

output:

2700
8092
28638
22475
14174
352
10133
27330
33418
12893
1535
17896
10909
14810
3088
2586
12262
10852...

result:

ok 52 lines

Test #72:

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

input:

100 4950 100 3 10 100
1 2 415
1 3 568
1 4 422
1 5 81
1 6 361
1 7 468
1 8 816
1 9 544
1 10 356
1 11 5...

output:

519
24398
18644
4240
589
547
3027
17678
14897
3641
5928
22165
1399
1941
2674
11649
8689
11315
20169
...

result:

ok 44 lines

Test #73:

score: 0
Accepted
time: 449ms
memory: 159792kb

input:

100 4950 351493 3 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 10...

output:

240622197023
44718374529
125207142058
172222204245
107481870153
178209992500
80482941120
24844503109...

result:

ok 100000 lines

Test #74:

score: 0
Accepted
time: 483ms
memory: 159796kb

input:

100 4950 351493 3 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 10...

output:

80620061382
20965420959
106527182948
72133787220
133520775036
52748448357
118269549201
6183378836
76...

result:

ok 100000 lines

Test #75:

score: 0
Accepted
time: 399ms
memory: 159796kb

input:

100 4950 351493 3 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 854
1 6 100000
1 7 100000
1 8 10000...

output:

10814589077
19893869783
3764796417
10122706194
3458648453
715696381
344374345
15748879910
6909452505...

result:

ok 100000 lines

Test #76:

score: 0
Accepted
time: 483ms
memory: 159796kb

input:

100 4950 351493 3 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 854
1 6 100000
1 7 100000
1 8 10000...

output:

2250281870
3982158285
2777971954
4234237112
3274778314
4845063107
1687483595
3524690383
4312422367
2...

result:

ok 100000 lines

Test #77:

score: 0
Accepted
time: 463ms
memory: 159796kb

input:

100 4950 351493 3 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 854
1 6 100000
1 7 100000
1 8 10000...

output:

1731387779
317777675
194018806
179810757
2199789457
41829240
520680858
1424750383
830762935
52747873...

result:

ok 100000 lines

Test #78:

score: 0
Accepted
time: 772ms
memory: 159792kb

input:

100 4950 351493 4 4 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 100...

output:

67765997
93865190
210084717
57107735
93832556
54909690
178192011
128631757
17296027
231916712
118966...

result:

ok 100000 lines

Test #79:

score: 0
Accepted
time: 921ms
memory: 159796kb

input:

100 4950 351493 4 4 100000
1 2 701
1 3 783
1 4 34
1 5 100000
1 6 100000
1 7 697
1 8 89
1 9 100000
1 ...

output:

40877281
75532019
52782937
114706822
73590672
12072480
87965685
79135298
43027018
57870384
18163480
...

result:

ok 100000 lines

Test #80:

score: 0
Accepted
time: 781ms
memory: 159796kb

input:

100 4950 351493 4 4 100000
1 2 701
1 3 812
1 4 34
1 5 624
1 6 100000
1 7 962
1 8 699
1 9 878
1 10 14...

output:

57645223
19919046
64559733
33009336
11549507
33416827
55801589
22099634
83197465
24962512
82416847
8...

result:

ok 100000 lines

Test #81:

score: 0
Accepted
time: 860ms
memory: 159800kb

input:

100 4950 351493 4 4 100000
1 2 632
1 3 761
1 4 546
1 5 338
1 6 992
1 7 553
1 8 757
1 9 787
1 10 97
1...

output:

7116286
13259342
21673839
10415457
25826968
15843292
51271977
4658096
51805039
38900305
3970549
4226...

result:

ok 100000 lines

Test #82:

score: 0
Accepted
time: 354ms
memory: 159796kb

input:

100 4950 351493 1 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 10...

output:

88025960740
97969300080
19411848100
41067912550
144164026380
84989869070
50451985120
142042946400
52...

result:

ok 49939 lines

Test #83:

score: 0
Accepted
time: 319ms
memory: 159796kb

input:

100 4950 351493 1 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 10...

output:

171418263210
175354019690
160504493090
26057191090
230805254280
10909159360
21199912560
39857912610
...

result:

ok 49938 lines

Test #84:

score: 0
Accepted
time: 317ms
memory: 159792kb

input:

100 4950 351493 1 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 10...

output:

12558966620
6095322930
25607382020
686695880
17620969210
5312452770
1798364610
34812195320
152890667...

result:

ok 49846 lines

Test #85:

score: 0
Accepted
time: 362ms
memory: 159800kb

input:

100 4950 351493 1 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 10...

output:

1842168720
985215780
1370752840
10717029840
14140257410
2189522770
12580711510
16763211350
481860867...

result:

ok 50191 lines

Test #86:

score: 0
Accepted
time: 313ms
memory: 159792kb

input:

100 4950 351493 1 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 10...

output:

653576650
770365300
368889250
1159084800
1227282150
1781396130
850902320
649173550
801784360
1172999...

result:

ok 49853 lines

Test #87:

score: 0
Accepted
time: 306ms
memory: 159792kb

input:

100 4950 351493 1 10 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 614
1 8 10000...

output:

1000156710
753821550
528865270
331894010
526595720
10941400
644654950
135157790
418426700
641451020
...

result:

ok 49895 lines

Test #88:

score: 0
Accepted
time: 309ms
memory: 159796kb

input:

100 4950 351493 1 10 100000
1 2 919
1 3 100000
1 4 140
1 5 181
1 6 100000
1 7 177
1 8 100000
1 9 116...

output:

51454620
152099710
41781070
7740030
102492720
116108890
56715640
45289760
60469660
134269440
628290
...

result:

ok 49918 lines

Test #89:

score: 0
Accepted
time: 299ms
memory: 159792kb

input:

100 4950 351493 1 10 100000
1 2 816
1 3 155
1 4 140
1 5 181
1 6 100000
1 7 373
1 8 252
1 9 116
1 10 ...

output:

68519960
17291250
8392620
91199050
60889430
95846510
34359490
82606740
2671030
29623590
51750260
141...

result:

ok 50024 lines

Test #90:

score: 0
Accepted
time: 345ms
memory: 159796kb

input:

100 4950 351493 1 10 100000
1 2 479
1 3 454
1 4 151
1 5 654
1 6 354
1 7 511
1 8 402
1 9 125
1 10 322...

output:

115261840
4461520
8047390
57172670
34309180
132967650
83174890
121171660
90294220
143619750
34726810...

result:

ok 49715 lines

Test #91:

score: 0
Accepted
time: 377ms
memory: 159800kb

input:

100 4950 351493 2 3 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 100...

output:

19136558658
75322646922
65523716975
37157423322
66319821963
34712467111
51627733001
35101560419
7201...

result:

ok 49844 lines

Test #92:

score: 0
Accepted
time: 367ms
memory: 159792kb

input:

100 4950 351493 2 3 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 100...

output:

16557318894
27340182410
63687210665
43060502930
193794712
804896586
58239589695
20567867638
55465263...

result:

ok 49852 lines

Test #93:

score: 0
Accepted
time: 403ms
memory: 159796kb

input:

100 4950 351493 2 3 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 100...

output:

2694908555
2924018204
4241213541
3634469387
8389620800
8339354787
7646835124
4064862859
1637503354
1...

result:

ok 49850 lines

Test #94:

score: 0
Accepted
time: 407ms
memory: 159796kb

input:

100 4950 351493 2 3 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 596...

output:

63711520
2766015861
2346093944
2473679516
1801965163
2316614587
758275082
494568362
709271030
266359...

result:

ok 49848 lines

Test #95:

score: 0
Accepted
time: 375ms
memory: 159796kb

input:

100 4950 351493 2 3 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 596...

output:

384641524
362550600
84910176
279232216
76456975
326949316
331211665
41165179
18762191
289969636
4479...

result:

ok 49849 lines

Test #96:

score: 0
Accepted
time: 376ms
memory: 159796kb

input:

100 4950 351493 2 3 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 596...

output:

219560624
271325317
8132581
181253620
98942375
247568754
1204002
89113248
32148953
74493823
15802671...

result:

ok 49857 lines

Test #97:

score: 0
Accepted
time: 391ms
memory: 159792kb

input:

100 4950 351493 2 1 100000
1 2 586
1 3 545
1 4 100000
1 5 100000
1 6 823
1 7 881
1 8 100000
1 9 1000...

output:

37422359
45864443
32567537
13581712
18491748
2077654
2235370
37035025
11191475
3008965
4490354
79624...

result:

ok 49759 lines

Test #98:

score: 0
Accepted
time: 350ms
memory: 159796kb

input:

100 4950 351493 2 1 100000
1 2 837
1 3 545
1 4 802
1 5 217
1 6 806
1 7 881
1 8 584
1 9 496
1 10 259
...

output:

18879429
2215511
26766927
26238385
10362326
26292734
8899576
21362097
19088613
13130838
16433927
894...

result:

ok 49774 lines

Test #99:

score: 0
Accepted
time: 383ms
memory: 159800kb

input:

100 4950 351493 2 1 100000
1 2 716
1 3 402
1 4 274
1 5 694
1 6 117
1 7 909
1 8 27
1 9 980
1 10 592
1...

output:

14331660
3121135
10454839
1274180
6566237
12423266
1830494
1981663
4322261
19734398
22130473
1218864...

result:

ok 49855 lines

Test #100:

score: 0
Accepted
time: 531ms
memory: 159796kb

input:

100 4950 351493 3 1 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 100...

output:

19404961614
37308696015
37175223846
9911873054
20272339619
29436655502
21159471004
28322031292
34820...

result:

ok 49992 lines

Test #101:

score: 0
Accepted
time: 488ms
memory: 159792kb

input:

100 4950 351493 3 1 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 100...

output:

25263841879
11562757507
11432860407
27252669207
12317613155
8613600119
42186822717
26846523958
44125...

result:

ok 49994 lines

Test #102:

score: 0
Accepted
time: 551ms
memory: 159792kb

input:

100 4950 351493 3 1 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 100...

output:

5202375080
1305859191
6361228100
2804618744
4762645112
1708776480
3159405551
1468694335
6271557016
6...

result:

ok 50384 lines

Test #103:

score: 0
Accepted
time: 566ms
memory: 159796kb

input:

100 4950 351493 3 1 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 100...

output:

3101988413
3076347212
2977455312
131723938
1532920879
2865699723
1831780028
466642664
810299909
1588...

result:

ok 50387 lines

Test #104:

score: 0
Accepted
time: 485ms
memory: 159796kb

input:

100 4950 351493 3 1 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 100...

output:

24220369
160147432
37138866
292004063
152187217
1380317
179526465
40983737
14243917
441218166
631260...

result:

ok 50393 lines

Test #105:

score: 0
Accepted
time: 472ms
memory: 159796kb

input:

100 4950 351493 3 1 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 100...

output:

95920606
130516615
7051091
2971975
22735958
78094145
70705761
21748551
26342452
66015108
31026980
77...

result:

ok 50398 lines

Test #106:

score: 0
Accepted
time: 523ms
memory: 159792kb

input:

100 4950 351493 3 1 100000
1 2 100000
1 3 100000
1 4 889
1 5 100000
1 6 378
1 7 185
1 8 443
1 9 453
...

output:

26837388
50936248
18903984
5722950
21397341
33371711
15136798
13914832
76814709
9858018
64272904
540...

result:

ok 50383 lines

Test #107:

score: 0
Accepted
time: 990ms
memory: 159792kb

input:

100 4950 351493 4 1 100000
1 2 21
1 3 376
1 4 560
1 5 175
1 6 100000
1 7 410
1 8 673
1 9 246
1 10 32...

output:

39759077
4082796
6705360
39398465
23870408
20907371
7039326
42798397
3435295
11152721
41516383
11329...

result:

ok 49914 lines

Test #108:

score: 0
Accepted
time: 995ms
memory: 159792kb

input:

100 4950 351493 4 1 100000
1 2 481
1 3 112
1 4 145
1 5 441
1 6 57
1 7 821
1 8 776
1 9 13
1 10 488
1 ...

output:

8972841
32395540
36776698
25494188
50915854
6635157
18464208
13144431
28956564
29897769
18034206
250...

result:

ok 50085 lines

Test #109:

score: 0
Accepted
time: 1167ms
memory: 159792kb

input:

100 4950 351493 4 2 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 100...

output:

31583756029
9635654303
34764000117
15509725236
28763999686
34269905204
23840403976
80307641909
34769...

result:

ok 50083 lines

Test #110:

score: 0
Accepted
time: 1003ms
memory: 159796kb

input:

100 4950 351493 4 2 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 100000
1 7 100000
1 8 100...

output:

24734016975
9085100047
19760174799
78698403673
22065055456
61027382222
40592937205
74946091663
51078...

result:

ok 50084 lines

Test #111:

score: 0
Accepted
time: 492ms
memory: 159796kb

input:

100 4950 351493 3 8 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 115
1 7 100000
1 8 100000...

output:

8313433034
2831657775
2095838731
9541863707
4886399433
2232991086
1471652739
12892495622
5402686261
...

result:

ok 49951 lines

Test #112:

score: 0
Accepted
time: 557ms
memory: 159796kb

input:

100 4950 351493 3 8 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 115
1 7 100000
1 8 100000...

output:

1177590109
1211327416
3696047266
5733107142
72558299
671851901
3223279869
3760123535
4142256799
9216...

result:

ok 49957 lines

Test #113:

score: 0
Accepted
time: 555ms
memory: 159796kb

input:

100 4950 351493 3 8 100000
1 2 100000
1 3 100000
1 4 100000
1 5 100000
1 6 115
1 7 100000
1 8 100000...

output:

103659228
491927753
680503924
2013739453
858011929
1075489691
1086666374
775175789
309930212
8084735...

result:

ok 49954 lines

Test #114:

score: 0
Accepted
time: 494ms
memory: 159800kb

input:

100 4950 351493 3 8 100000
1 2 100000
1 3 100000
1 4 654
1 5 50
1 6 291
1 7 100000
1 8 100000
1 9 10...

output:

378895937
99480465
440541229
23286005
2610364
335634347
308663034
180303405
28413240
313563591
34626...

result:

ok 49957 lines

Test #115:

score: 0
Accepted
time: 435ms
memory: 159796kb

input:

100 4950 351493 3 4 100000
1 2 100000
1 3 100000
1 4 100000
1 5 407
1 6 384
1 7 130
1 8 681
1 9 1000...

output:

14271333
16474613
19440964
7951568
14628558
13617661
40943035
62381517
53674039
46288760
26769998
80...

result:

ok 50261 lines

Test #116:

score: 0
Accepted
time: 530ms
memory: 159796kb

input:

100 4950 351493 3 4 100000
1 2 460
1 3 879
1 4 901
1 5 677
1 6 384
1 7 363
1 8 538
1 9 172
1 10 1000...

output:

27296692
35993907
4098748
1283779
18847909
3868192
17947336
6470263
58671283
8934404
3482231
1037831...

result:

ok 50226 lines

Test #117:

score: 0
Accepted
time: 490ms
memory: 159796kb

input:

100 4950 351493 3 4 100000
1 2 640
1 3 391
1 4 26
1 5 470
1 6 816
1 7 563
1 8 520
1 9 87
1 10 525
1 ...

output:

24365516
54689932
17188307
36133202
28760235
50487671
7395942
4696745
23526036
2366173
58360911
9077...

result:

ok 50148 lines

Extra Test:

score: 0
Extra Test Passed