QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#759920#9352. Highway Buses275307894a#AC ✓2215ms277392kbC++143.7kb2024-11-18 13:21:022024-11-18 13:21:03

Judging History

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

  • [2024-11-18 13:21:03]
  • 评测
  • 测评结果:AC
  • 用时:2215ms
  • 内存:277392kb
  • [2024-11-18 13:21:02]
  • 提交

answer

#include<bits/stdc++.h>
#define Gc() getchar()
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define eb emplace_back
#define all(x) x.begin(),x.end()
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;
const int N=2e5+5,M=N*4+5,K=1000+5,mod=1e8+7,Mod=mod-1;const db eps=1e-9;const int INF=1e9+7;mt19937 rnd(28382);
#define Tp template<typename T>
#define Ts template<typename T,typename... Ar>
namespace Debug{
	Tp void _debug(char* f,T t){cerr<<f<<'='<<t<<endl;}
	Ts void _debug(char* f,T x,Ar... y){while(*f!=',') cerr<<*f++;cerr<<'='<<x<<",";_debug(f+1,y...);}
	#ifdef LOCAL
	#define gdb(...) _debug((char*)#__VA_ARGS__,__VA_ARGS__)
	#else 
	#define gdb(...) void()
	#endif
}using namespace Debug;
int n,m,T,A[N],B[N],C[N];
int fa[N];
int GF(int x){return fa[x]^x?fa[x]=GF(fa[x]):x;}
vector<int> S[N],G[N];
int ns[N],nh,id[N];
int d[105][N],pt[105][N],ps[105];
int dis[20][N],jp[20][N],st[N],sh;
vector<int> e[N];int ed[N];
int siz[N],dp[N],vis[N],cnt,rt;
void getsiz(int x,int La){
	siz[x]=1;
	for(int i:S[x]) if(i^La&&!vis[i]) getsiz(i,x),siz[x]+=siz[i];
}
void DP(int x,int La){
	dp[x]=cnt-siz[x];
	for(int i:S[x]) if(i^La&&!vis[i]) DP(i,x),dp[x]=max(dp[x],siz[i]);
	if(dp[x]<dp[rt]) rt=x;
}
void build(int x,int deep){
	getsiz(x,0);cnt=siz[x];dp[rt=0]=INF;DP(x,0);vis[x=rt]=1;
	queue<int> q;q.push(x);dis[deep][x]=0;
	while(!q.empty()){
		int y=q.front();q.pop();
		e[x].push_back(y);jp[deep][y]=x;
		for(int i:S[y]) if(!vis[i]&&dis[deep][i]>dis[deep][y]+1) dis[deep][i]=dis[deep][y]+1,q.push(i);
	}
	reverse(all(e[x]));
	for(int i:S[x]) if(!vis[i]) build(i,deep+1);
}
priority_queue<pair<ll,int> > Q;
ll ans[N],f[N];
void add(int x,int z,ll w){
	// gdb(x,z,w);
	for(int i=18;~i;i--) if(jp[i][x]){
		int v=jp[i][x];
		while(ed[v]>=0&&dis[i][e[v][ed[v]]]+dis[i][x]<=z){
			if(f[e[v][ed[v]]]>w){
				f[e[v][ed[v]]]=w;
				Q.emplace(-(w+B[e[v][ed[v]]]),e[v][ed[v]]);
				// gdb(x,z,i,v,dis[i][e[v][ed[v]]],dis[i][x],e[v][ed[v]]);
			}
			ed[v]--;
		}
	}
}
void adds(int id,int x,int z,ll w){
	while(ps[id]<=n&&z>=d[id][pt[id][ps[id]]]){
		int v=pt[id][ps[id]];
		if(f[v]>w){
			f[v]=w;
			Q.emplace(-(w+B[v]),v);
		}
		ps[id]++;
	}
}
void work(){
	Me(f,0x3f);
	for(int i=1;i<=n;i++) ed[i]=e[i].size()-1;
	for(int i=1;i<=nh;i++) ps[i]=1;
	f[1]=0;Q.emplace(-B[1],1);
	while(!Q.empty()){
		auto [w,x]=Q.top();Q.pop();w*=-1;
		add(x,A[x],w);
		for(int i=1;i<=nh;i++) if(d[i][x]<=A[x]) adds(i,x,A[x]-d[i][x],w);
	}
	for(int i=1;i<=n;i++) ans[i]=min(ans[i],f[i]);
}
void Solve(){
	scanf("%d%d%d",&n,&m,&T);
	for(int i=1;i<=n;i++) scanf("%d%d%d",&A[i],&B[i],&C[i]);
	iota(fa+1,fa+n+1,1);
	for(int i=1;i<=m;i++){
		int x,y;scanf("%d%d",&x,&y);
		G[x].push_back(y);G[y].push_back(x);
		if(GF(x)^GF(y)) fa[GF(x)]=GF(y),S[x].push_back(y),S[y].push_back(x),gdb(x,y);
		else ns[++nh]=x,ns[++nh]=y;
	}
	sort(ns+1,ns+nh+1);nh=unique(ns+1,ns+nh+1)-ns-1;
	Me(d,0x3f);
	for(int i=1;i<=nh;i++){
		id[ns[i]]=i;
		d[i][ns[i]]=0;queue<int> q;
		q.push(ns[i]);
		for(int j=1;j<=n;j++){
			int x=q.front();q.pop();pt[i][j]=x;
			for(int j:G[x]) if(d[i][j]>d[i][x]+1) d[i][j]=d[i][x]+1,q.push(j);
		}
	}
	Me(dis,0x3f);
	build(1,0);
	Me(ans,0x3f);
	work();
	for(int i=1;i<=n;i++) B[i]+=(T-1)*C[i];
	work();
	for(int i=1;i<=n;i++) printf("%lld\n",ans[i]);
}
int main(){
	int t=1;
	// scanf("%d",&t);
	while(t--) Solve();
	cerr<<clock()*1.0/CLOCKS_PER_SEC<<'\n';
}

这程序好像有点Bug,我给组数据试试?

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 132788kb

input:

6 6 2
1 50 -40
1 2 100
2 1 100
2 4 100
3 1 100
1 1 100
1 2
2 3
3 4
4 2
2 5
6 1

output:

0
10
52
52
52
10

result:

ok 6 lines

Test #2:

score: 0
Accepted
time: 11ms
memory: 194816kb

input:

500 540 1000000
1 831790353 70
3 624594642 -127
2 189318946 -92
1 858646508 320
4 76999645 671
4 780012318 880
2 51254764 -12
2 420182468 -333
3 314764053 -36
1 560114854 -419
2 484412868 -31
3 466851594 6
4 535326027 732
4 430602789 578
1 605236859 43
4 633715178 896
3 110060408 -9
4 878946915 -654...

output:

0
1277292628
1239671692
1255261807
1284074004
1270230633
1239671692
1284074004
1271369537
1277292628
1205507860
1270615693
1300179417
1205507860
1205507860
1239671692
1251564675
1239671692
1284004371
1239671692
1239671692
1277292628
1270230633
1284004371
1277292628
1255261807
1276194392
1247939403
1...

result:

ok 500 lines

Test #3:

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

input:

500 540 1000000
1 613142394 -268
5 920609625 740
2 755612530 -255
2 23678897 -4
5 325892468 291
5 707223319 -140
1 679600699 -138
5 625157055 690
2 141819870 995
1 250348582 -219
2 581461324 -580
4 339782234 -82
5 810851082 230
3 378119535 158
4 295102386 677
5 854435300 21
3 565535907 -465
2 820995...

output:

0
2421015760
2617367920
2694215005
2812156460
2412108889
2370843291
2786283443
2412108889
2197157944
2412108889
2633707306
2370843291
2478757415
2672183755
2478757415
2633707306
2812156460
1984181483
2464420418
2548091380
2421015760
2421015760
2412108889
2421015760
2421015760
2412108889
2412108889
2...

result:

ok 500 lines

Test #4:

score: 0
Accepted
time: 11ms
memory: 205716kb

input:

500 544 1000000
2 587500219 -573
3 800375803 -606
2 332196789 -11
2 782258272 270
2 690828422 -145
2 642751384 -107
4 78645508 -68
3 692764955 364
5 739361677 -104
4 139030619 -125
5 698401632 -121
3 654935300 401
4 70734757 -57
2 763502749 911
1 71485824 836
1 292976518 -290
1 743618801 659
2 64895...

output:

0
425794735
442014967
675968705
311908134
675968705
336563578
425794735
523701048
479984544
425794735
425794735
425794735
708001283
311908134
1653971237
425794735
580659172
425794735
487630114
311908134
450399440
1653971237
425957613
425794735
425957613
336604992
336604992
425794735
436034689
425794...

result:

ok 500 lines

Test #5:

score: 0
Accepted
time: 11ms
memory: 201312kb

input:

500 543 1000000
4 753661240 -312
2 281450837 -151
9 28464686 987
7 685967710 490
8 592650944 542
10 141100249 83
10 646501804 -94
3 337312645 294
2 904175548 -870
8 281667853 -136
3 36477141 -26
5 476645115 -195
1 21897824 -7
10 517151723 150
1 291410319 941
7 993616997 143
10 628559241 -428
8 10757...

output:

0
445387723
445387723
450719457
455897864
445387723
449974501
449974501
449974501
444157947
449974501
449974501
449974501
449974501
449974501
445387723
441661552
449974501
449974501
449974501
444157947
444157947
444157947
449974501
444157947
444157947
449974501
445387723
441661552
449974501
45156161...

result:

ok 500 lines

Test #6:

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

input:

500 547 1000000
7 579418 0
1 769742 0
1 133755 0
2 996071 0
2 96075 893
7 484503 0
7 645976 141
6 80570 0
2 33751 124
4 218617 701
5 686104 0
1 675119 586
3 294461 0
5 319865 0
9 178301 179
1 547068 0
1 96921 802
3 725739 58
8 646648 0
4 667865 0
6 816462 0
4 901406 37
4 834211 0
1 364051 263
2 1014...

output:

0
653962
626600
579418
626600
603269
603269
626600
626600
634782
626600
672297
579418
626600
626600
579418
626600
579418
626600
672297
626600
661975
672297
746441
626600
661975
626600
626600
626600
626600
579418
626600
653962
661975
626600
626600
579418
579418
626600
579418
579418
626600
634782
6266...

result:

ok 500 lines

Test #7:

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

input:

500 549 1000000
8 275979 799
2 323404 0
8 286448 610
2 877230 292
5 111405 972
2 686865 757
6 542128 0
9 823472 705
8 551203 0
9 900802 0
8 497319 554
2 60284 473
1 128784 147
1 390099 282
1 376548 407
7 444338 502
10 496911 293
7 133528 0
1 949531 669
8 569605 459
1 310534 504
2 705803 0
5 954861 0...

output:

0
308634
296602
275979
275979
275979
308634
296754
296602
275979
296602
308634
275979
275979
275979
296602
275979
296602
275979
296602
308634
296602
275979
300889
275979
275979
275979
275979
296754
296602
324141
275979
296754
296754
308634
296602
308634
308634
275979
296754
275979
275979
324141
2759...

result:

ok 500 lines

Test #8:

score: 0
Accepted
time: 130ms
memory: 220508kb

input:

30000 30047 786577
2 418118 886
1 923620 -1
1 396304 59
1 357673 0
1 12272 51
2 797480 0
2 41479 797
1 970539 -1
1 608143 0
2 415150 0
1 459616 0
1 739232 742
1 917012 -1
1 165211 0
1 637917 550
1 238131 0
2 232835 258
2 610877 0
1 17235 0
2 112947 446
2 828314 0
2 179873 782
2 333590 0
1 961918 194...

output:

0
80494179
83741087
62038907
76473105
104910654
116145079
108446496
88716481
94285072
115284209
99860695
77584533
119165550
81758989
77570762
142596283
79902868
77267149
95599129
114945135
73806480
108069554
77051483
76742645
57016312
152581721
89223155
76282889
122548472
23429774
107080496
76205230...

result:

ok 30000 lines

Test #9:

score: 0
Accepted
time: 128ms
memory: 224520kb

input:

30000 30050 605850
9 564340 974
2 843284 -1
1 398311 922
9 478997 556
7 671058 -1
3 671222 872
2 943222 -1
3 357119 393
8 108556 258
2 579805 0
5 452884 0
7 578644 871
4 863186 157
8 47757 0
10 635134 678
4 73374 1000
4 614076 0
3 549192 0
8 945587 0
5 67239 48
5 943401 992
9 345170 459
6 164234 0
5...

output:

0
9452611
15305660
6254895
8166386
10065348
6017741
6884440
17917177
6017741
7241812
5274395
6017741
6017741
10160098
6017741
8872246
7061933
10080339
8597089
5885039
6017741
6017741
12747501
7589567
13233135
6017741
12499965
6017741
8353713
11425708
6017741
6017741
6017741
7468089
8335888
9588729
6...

result:

ok 30000 lines

Test #10:

score: 0
Accepted
time: 1280ms
memory: 251744kb

input:

200000 200047 812175
1 850300 0
1 913813 609
1 148997 755
1 5275 0
1 989899 -1
1 843074 -1
1 131757 0
1 713341 0
1 530046 919
1 243794 0
1 127575 558
1 385431 694
1 94653 0
1 556880 189
1 718137 564
1 968120 -1
1 358633 973
1 2321 0
1 331378 0
1 164889 583
1 70541 710
1 338259 54
1 866090 73
1 31800...

output:

0
17181559
15957501
15779114
115636303
15629732
17014614
15580821
149467817
73641596
15232651
15683692
16610143
17648378
143959447
15957501
340606826
16610143
16319403
138998203
18932628
16190551
272473588
15859079
16686342
17035952
16942975
279664809
246248740
230789370
299273468
16224182
17081451
...

result:

ok 200000 lines

Test #11:

score: 0
Accepted
time: 1552ms
memory: 258468kb

input:

200000 200050 2
1 528713629 1
1 213369548 -37822878
1 699166189 -474414180
1 77696830 1
1 113587245 1
1 416076134 1
1 439856442 -64939236
1 345132571 0
1 319809000 -58380052
1 118538123 -35192216
1 296406928 -50538228
1 937906349 0
1 812697276 -198448717
1 812963226 1
1 585375084 -485637384
1 891358...

output:

0
429570147481
371676672855
318706830834
478331382972
263557664319
370349057202
354356177314
257103023734
419025668238
253664150673
414860000299
265184541896
454101388044
368491773178
465943230853
341143189070
437236406813
338095814498
564203870191
254129964768
255221699111
419763751724
545110934986...

result:

ok 200000 lines

Test #12:

score: 0
Accepted
time: 1688ms
memory: 256144kb

input:

200000 200049 777072
3 194540 779
4 448274 534
5 256933 0
3 796598 747
2 185663 221
3 303965 348
3 256210 0
5 841527 0
1 707797 263
5 627499 884
5 963924 0
5 85220 0
3 928652 899
1 62085 0
5 512144 0
2 727133 0
2 79884 0
5 400039 0
3 368172 0
4 521014 0
4 302255 57
1 138104 0
4 372879 47
2 562648 0
...

output:

0
20609231
194564
194663
194564
66834766
12475993
51218045
194564
112611815
194611
163554452
59812602
27049581
194564
194564
194611
194611
194611
211191723
194564
194611
43725196
194564
194611
48429938
194654
194611
37286113
194654
194564
28244990
194611
134326947
14069300
18531514
194540
194654
183...

result:

ok 200000 lines

Test #13:

score: 0
Accepted
time: 1963ms
memory: 253424kb

input:

200000 200048 925035
2 525947 32
11 183013 0
15 614707 0
8 76859 701
14 947804 192
2 467927 133
4 231061 224
9 737711 566
9 640793 0
1 845076 0
16 846825 0
1 21656 0
12 103091 797
12 135329 456
11 57259 0
14 203281 200
3 981455 0
2 972914 365
13 8562 546
8 634206 0
10 518153 0
3 636651 333
15 68339 ...

output:

0
766342
766342
766342
766342
3640272
766342
9816761
766342
4946763
766342
766342
5592035
766342
766342
766342
766342
5583544
6501478
766342
766342
11793421
766342
766342
766342
5143499
766342
766342
6850162
4813389
766342
766342
766342
10716690
1024184
766342
6503363
766342
4634956
13886721
766342
...

result:

ok 200000 lines

Test #14:

score: 0
Accepted
time: 1962ms
memory: 256648kb

input:

200000 200048 973201
33 847601 281
75 828865 0
79 697163 641
50 373713 140
24 630160 789
48 939829 370
47 588788 155
84 159402 293
47 617786 0
86 307415 347
71 943317 152
58 785204 0
84 152741 927
61 145251 780
56 441083 0
9 934387 351
98 589957 711
7 421074 0
99 334089 0
42 164529 0
97 13306 0
67 4...

output:

0
898102
898063
959085
898063
898063
898183
898063
898063
1030883
898063
1048507
898102
898063
898063
898063
898063
898063
1190439
898063
898063
899518
905305
898063
898063
974615
902855
1033513
935106
1582957
898063
898063
898063
898063
907926
898112
992408
898063
1012275
900484
898063
933881
89806...

result:

ok 200000 lines

Test #15:

score: 0
Accepted
time: 2190ms
memory: 256952kb

input:

200000 200049 802175
434 897839 609
1637 128515 336
617 353368 0
1309 482860 0
658 923059 -1
266 917631 134
1425 651651 744
210 580125 0
1700 160241 0
60 699775 146
1005 273869 508
1182 814396 0
1159 668637 762
581 329891 0
386 782389 882
411 460313 0
208 466285 781
1408 917465 -1
227 911111 -1
1013...

output:

0
897839
897839
897839
897839
897856
897856
897839
897839
897884
897839
897839
897839
897839
897884
897839
897839
897839
897839
897839
897839
897839
897839
897839
897856
897856
897839
897839
897878
897839
897856
897839
897839
897839
897839
897839
897839
897839
897878
897839
897839
897839
897839
8978...

result:

ok 200000 lines

Test #16:

score: 0
Accepted
time: 2215ms
memory: 259324kb

input:

200000 200050 977549
10901 273019 0
9812 386041 398
13202 43036 0
5088 518584 0
14670 555158 100
2061 426017 65
7146 883802 0
14225 907048 499
14963 858280 970
11057 91149 773
12596 579413 0
3740 446698 0
6214 969036 0
6622 782946 120
12146 167675 0
12214 8548 704
13346 270542 0
13400 558929 717
115...

output:

0
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
273019
2730...

result:

ok 200000 lines

Test #17:

score: 0
Accepted
time: 1934ms
memory: 251408kb

input:

200000 200045 887103
45272 602794 0
23906 754234 0
71717 826568 993
13760 177572 894
61202 288685 0
42738 367202 576
6978 72118 0
44091 26992 417
19750 697652 397
42867 749112 0
67630 368510 378
75078 58177 804
73333 237957 0
19403 173798 965
34628 313199 0
2561 253794 310
42624 705608 0
26560 92002...

output:

0
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
602794
6027...

result:

ok 200000 lines

Test #18:

score: 0
Accepted
time: 1796ms
memory: 254212kb

input:

200000 200045 769397
34349 835075317 -817
18861 683359562 899
23817 773068309 248
39580 294922106 625
1721 855326030 -242
15647 207800547 423
16928 394764987 -455
16397 176071725 -43
36412 759000609 -116
3286 196813589 -202
51196 472981946 -227
35415 580977561 -690
46274 837262206 478
52598 12553799...

output:

0
206478785
206478785
206478785
206478785
206478785
206478785
206478785
206478785
206478785
206478785
206478785
206478785
206478785
206478785
206478785
206478785
206478785
206478785
206478785
206478785
206478785
206478785
206478785
206478785
206478785
206478785
206478785
206478785
206478785
20647878...

result:

ok 200000 lines

Test #19:

score: 0
Accepted
time: 2106ms
memory: 256316kb

input:

200000 200049 797442
346 978868811 -50
3343 526033133 -169
4137 441896320 -370
3016 326119843 -278
183 824996876 451
4007 769588338 -523
2350 928354577 -63
3572 464630994 706
4496 822044577 -29
650 53139867 147
215 398374890 -183
3903 109051350 -133
1407 846321729 -121
3679 8164764 -10
4494 83144321...

output:

0
938998176
938996761
938998176
938996761
938996761
938996761
938996761
938996761
938996761
938996761
938998176
938996761
938998176
938998176
938996761
938996761
938996761
938996761
938998176
938996761
938996761
938998176
938996761
938996761
938996761
938996761
938996761
938998176
938998176
93899676...

result:

ok 200000 lines

Test #20:

score: 0
Accepted
time: 1937ms
memory: 254152kb

input:

200000 200046 779758
22749 861392584 -1064
13906 390240403 -130
11734 252197076 -282
5567 661056685 -777
19224 973196549 -741
875 687619587 902
7749 375203720 -139
11294 31265876 -28
18688 575668357 -95
9934 481488771 537
9747 163369674 -72
9631 715413452 835
12475 493114623 360
17249 241502607 994
...

output:

0
31731136
31731136
31731136
31731136
31731136
31731136
31731136
31731136
31731136
31731136
31731136
31731136
31731136
31731136
31731136
31731136
31731136
31731136
31731136
31731136
31731136
31731136
31731136
31731136
31731136
31731136
31731136
31731136
31731136
31731136
31731136
31731136
31731136
3...

result:

ok 200000 lines

Test #21:

score: 0
Accepted
time: 1932ms
memory: 259476kb

input:

200000 200049 821141
62 2861969 370
170 629414361 952
189 960644258 -565
9 645445172 982
7 63321511 -69
151 846815934 612
225 556867019 -438
6 272994988 -176
60 485495936 -575
108 32558262 915
48 922630827 -106
75 191249817 618
171 941795573 -805
67 265957493 283
193 273591879 113
117 560722940 845
...

output:

0
31649281
2861969
2866331
2861969
7689197
2861969
2861969
2866331
2861969
20208248
2861969
2861969
2861969
2861969
23994629
2861969
2861969
2861969
2861969
2861969
2861969
2861969
2861969
2861969
16109017
2861969
2861969
2861969
2861969
2866331
44266610
2861969
2866331
2861969
2861969
23658429
2861...

result:

ok 200000 lines

Test #22:

score: 0
Accepted
time: 1610ms
memory: 252008kb

input:

200000 200048 822072
2 879965662 -637
13 670761154 170
9 411869990 -436
1 165926034 -89
6 732333349 -678
4 570547060 12
5 601883593 342
2 196721422 -106
12 82451248 -84
3 139767338 -113
15 617552921 759
1 593424757 -662
14 765909634 556
4 206579611 -12
2 325059126 686
7 176030419 -145
4 113506749 73...

output:

0
5685499672
12612030968
5685499672
15147666822
11311155008
5685499672
5685499672
18694716939
15627515178
5685499672
16250428982
5685499672
5685499672
7740018110
5685499672
5685499672
5685499672
5685499672
5685499672
10298383823
5685499672
5685499672
6174441189
16007349402
5685499672
5685499672
5685...

result:

ok 200000 lines

Test #23:

score: 0
Accepted
time: 1325ms
memory: 251256kb

input:

200000 200047 962912
2 225382344 700
3 325888189 579
3 161170181 778
2 107131645 116
1 749732817 299
1 997715042 407
3 529582071 793
3 64777330 -60
2 896405089 -429
3 494959233 194
3 25138054 691
3 287848717 327
1 453946562 -150
3 68026818 -66
1 600987534 -524
3 750327866 -645
2 570302679 -517
4 772...

output:

0
225795849
226063353
36411770887
35729953885
225795849
26469433803
193759037545
225382344
225795849
57152343260
35729953885
39767375474
226063353
226073677
42239356599
138854167832
10596304341
226073677
9706141682
171051513192
325433117
40962586781
225382344
4146568387
225802984
225802984
226063353...

result:

ok 200000 lines

Test #24:

score: 0
Accepted
time: 1481ms
memory: 268532kb

input:

200000 200050 747330
2 537560205 -350
4 755433497 -996
4 918986635 -72
3 767588400 620
3 61647215 -44
3 662858666 67
4 269711686 -353
2 963147665 648
3 963728238 298
2 864952305 191
2 704256245 345
2 150813251 -182
4 454475634 999
1 538018669 -278
2 166104057 853
4 789440154 895
3 134808002 392
3 63...

output:

0
1111346001325
242563552301
525794746781
478557760991
463076900530
719286259942
473155849393
701942697869
790361875695
526110114401
347748396352
736085425297
611358510656
580660567310
151432346972
431246584688
707628540644
720994297059
410329040610
82490611252
434159059329
361018895673
583800424986...

result:

ok 200000 lines

Test #25:

score: 0
Accepted
time: 1436ms
memory: 266464kb

input:

200000 200050 707961
15 873522997 -182
88 179022235 419
89 577862895 451
38 805155666 730
88 864335095 -171
70 925646453 -130
60 698241128 965
77 495381305 296
75 871264196 -438
8 751162074 352
70 589410176 -408
96 595290474 -41
85 713084769 -577
76 836052235 -430
78 337840602 183
77 192100655 175
3...

output:

0
1876478062
2227936644
1915399164
1873587846
1449626595
2023650047
1247404978
1507682103
1793798681
1735488479
1871660555
2150906521
1690859825
2124090234
1425822792
1100079174
2221922366
1131629095
1534246653
2499427367
2097221524
2360647514
2273897691
1654063371
1922872353
1137409999
1800435043
1...

result:

ok 200000 lines

Test #26:

score: 0
Accepted
time: 1550ms
memory: 277392kb

input:

200000 200050 956103
934 780440708 36
1376 838373714 58
2691 200197146 -108
781 302928793 -188
2447 221400054 -177
2750 776983725 637
2375 991654244 704
974 925547384 871
908 522713943 369
1224 36239597 -30
1837 432059281 -73
959 564090504 845
2283 77582259 802
2543 734490722 972
1876 124284253 -116...

output:

0
783439699
781752488
782482879
781648747
782074693
780887172
782101315
782074693
780887172
781765961
781752488
781785211
781648747
781334058
782682731
781752488
780570688
781785211
781334058
781752488
781765961
781752488
781858919
781858919
781955873
781785211
781785211
782660911
781174625
78178521...

result:

ok 200000 lines

Test #27:

score: 0
Accepted
time: 1910ms
memory: 276992kb

input:

200000 200050 848611
13477 471516038 -387
809 874049314 -771
9692 299613201 -119
2047 790178014 -564
2453 644397567 -511
6575 680786376 384
7700 540491389 489
4990 684608170 426
10371 6443058 406
6514 253602799 121
8726 913659974 950
15240 614762801 840
14379 817571354 -492
456 92737350 -24
11832 15...

output:

0
143103968
143103968
143103968
143103968
143103968
143103968
143103968
143103968
143103968
143103968
143103968
143103968
143103968
143103968
143103968
143103968
143103968
143103968
143103968
143103968
143103968
143103968
143103968
143103968
143103968
143103968
143103968
143103968
143103968
14310396...

result:

ok 200000 lines

Extra Test:

score: 0
Extra Test Passed