QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#410378#7905. Ticket to Ridechenxinyang2006#AC ✓2092ms4740kbC++202.8kb2024-05-13 22:36:392024-05-13 22:36:40

Judging History

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

  • [2024-05-13 22:36:40]
  • 评测
  • 测评结果:AC
  • 用时:2092ms
  • 内存:4740kb
  • [2024-05-13 22:36:39]
  • 提交

answer

#include <bits/stdc++.h>
#define rep(i,j,k) for(int i=(j);i<=(k);i++)
#define per(i,j,k) for(int i=(j);i>=(k);i--)
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define db double
#define ldb long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mkp make_pair
#define eb emplace_back
#define SZ(S) (int)S.size()
//#define mod 998244353
//#define mod 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3f
using namespace std;

template <class T>
void chkmax(T &x,T y){
	if(x < y) x = y;
}

template <class T>
void chkmin(T &x,T y){
	if(x > y) x = y;
}

inline int popcnt(int x){
	return __builtin_popcount(x);
}

inline int ctz(int x){
	return __builtin_ctz(x);
}


/*ll power(ll p,int k = mod - 2){
	ll ans = 1;
	while(k){
		if(k % 2 == 1) ans = ans * p % mod;
		p = p * p % mod;
		k /= 2;	
	}
	return ans;
}*/
int T,n,m;
int _l[10005],_r[10005],_v[10005];
vector <pii> S[10005];

ll dp[10005],ans[10005];

int fa[10005];
int fnd(int u){
	if(fa[u] == u) return u;
	return fa[u] = fnd(fa[u]);
}
ll delta[10005],Mx;
void upd(int cur,int p,int val){//给 <= p 的全都 + val
//	printf("add %d %d %d\n",cur,p,val);
	if(fnd(1) > p) return;
	int u = fnd(p + 1),v;
	if(u > cur){
		Mx += val;
		return;
	}
	delta[u] -= val;
	while(delta[u] <= 0){
		v = fnd(u + 1);
		if(v > cur){
			Mx -= delta[u];
			fa[u] = v;
			return;
		}
		delta[v] += delta[u];
		fa[u] = v;
		u = v;
	}
}

void psh(int cur,ll val){
//	printf("psh %d %lld\n",cur,val);
	if(val <= Mx){
		fa[cur] = cur + 1;
		return;
	}
	delta[cur] = val - Mx;
	Mx = val;
}

void dbg(){
	printf("dbg\n");
	rep(u,1,n) printf("%d ",fnd(u));
	printf("\n");
	rep(u,1,n) printf("%lld ",delta[u]);
	printf("\n");
	printf("Mx=%lld\n",Mx);
}

void solve(){
	scanf("%d%d",&n,&m);
	rep(i,1,n) S[i].clear();
	rep(i,1,m){
		scanf("%d%d%d",&_l[i],&_r[i],&_v[i]);
		_l[i]++;
		S[_r[i]].eb(mkp(_l[i],_v[i]));
//		printf("[%d,%d] %d\n",_l[i],_r[i],_v[i]);
	}
	dp[0] = 0;
	rep(i,1,n){
		dp[i] = dp[i - 1];
		for(pii I:S[i]) dp[i] += I.second;
	}
	rep(p,0,n - 1){
		ans[n - p] = dp[n];
		per(i,n,1) dp[i] = dp[i - 1];
		dp[0] = -linf;
		rep(i,1,p + 1) fa[i] = p + 2;
		rep(i,p + 2,n + 1) fa[i] = i;
		fill(delta,delta + n + 1,0);
		Mx = -inf;
//		rep(i,1,n) printf("%lld ",dp[i]);
//		printf("\n");
		//只有 >= p + 2 的才有意义
//		printf("fix\n");
		rep(i,p + 2,n){
			psh(i,dp[i - 1]);
//			if(i == 4) dbg();
			for(pii I:S[i]) if(I.first >= p + 2) upd(i,I.first,I.second);
			chkmax(dp[i],Mx);
//			if(i == 4) dbg();
		}
//		rep(i,1,n) printf("%lld ",dp[i]);
//		printf("\n");
	}
	rep(i,1,n) printf("%lld ",ans[i]);
	printf("\n");
}

int main(){
//	freopen("test.in","r",stdin);
//	freopen("test.out","w",stdout);
	scanf("%d",&T);
	while(T--) solve();
	return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3728kb

input:

2
4 3
0 2 3
3 4 2
0 3 1
3 1
1 3 100

output:

2 3 5 6 
0 100 100 

result:

ok 2 lines

Test #2:

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

input:

1000
2 9
0 2 396628655
1 2 268792718
0 2 16843338
1 2 717268783
0 1 693319712
0 1 856168102
1 2 407246545
1 2 527268921
0 1 536134606
6 2
2 5 451394766
0 5 695984050
9 7
0 6 73936815
2 9 505041862
4 5 223718927
5 7 179262261
3 5 449258178
0 5 493128
0 3 994723920
6 6
3 5 433389755
2 4 773727734
4 5 ...

output:

2085622420 4419671380 
0 0 451394766 451394766 1147378816 1147378816 
223718927 672977105 994723920 1218442847 1668194153 1742130968 1921393229 1921393229 2426435091 
127680943 773727734 1334798432 2227456393 2675644351 2675644351 
976357580 1594205360 2103791342 2721639122 3241574409 3936588085 418...

result:

ok 1000 lines

Test #3:

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

input:

100
99 83
33 47 476927808
66 71 627937890
14 84 645468307
89 96 588586447
24 43 710156469
5 85 11308832
46 56 208427221
8 62 726478310
34 74 135993561
10 74 851555000
49 52 946936715
34 39 771067386
76 96 16233727
29 34 612324591
71 86 591062856
24 94 670656770
21 59 629389147
48 67 860046161
34 86 ...

output:

131347174 276869285 946936715 1078283889 1223806000 1355153174 1699007616 1969489139 1975876901 2246358424 2246358424 2721560040 2721560040 2998429325 3096939475 3110534651 3349497930 3724362755 4882915593 5014262767 5871777743 6003124917 6778566352 7530637253 7661984427 7661984427 7661984427 815857...

result:

ok 100 lines

Test #4:

score: 0
Accepted
time: 9ms
memory: 3856kb

input:

100
95 96
5 89 124321145
33 77 773363571
1 94 468188689
35 84 284660056
0 92 245485733
8 57 596788519
10 93 59267682
49 90 450355885
76 84 190264757
84 87 797853944
4 41 437909067
73 74 532217941
5 8 999048465
0 95 143672912
12 55 290639413
6 86 899138487
35 36 508500258
21 68 843227286
0 94 9058576...

output:

1272369836 1903674815 2748981113 2925702770 2951858051 3748029578 3924751235 3950906516 4545883522 4735350922 4912072579 5329793703 5734399387 5911121044 5946764048 6532253331 6708974988 6735130269 7316163512 7492885169 7519040450 7674437726 8074553640 8251275297 8277430578 8432827854 8609549511 871...

result:

ok 100 lines

Test #5:

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

input:

100
86 92
68 73 730593611
9 11 314305867
63 64 699021890
6 11 787982418
69 72 421876106
31 37 449645826
76 82 238642240
28 31 467098727
22 23 333165290
34 42 645351348
34 38 618797828
10 14 164751728
30 34 88922825
80 83 936426204
72 77 383499583
46 51 128937895
49 57 437892230
50 56 692509142
14 19...

output:

987528833 1943214328 2850671579 3750797988 4594973746 5293995636 5939438559 6537351768 7295198258 8185806974 9093264225 9993390634 10837566392 11598929402 12443105160 13088548083 13686461292 14053565377 14974356349 15874482758 16718658516 17480021526 18324197284 18999222924 19760585934 20604761692 2...

result:

ok 100 lines

Test #6:

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

input:

100
81 84
34 73 564718673
8 50 657489855
21 65 373282330
11 54 667584659
18 58 850348020
7 47 593942770
18 63 903492853
10 55 897217447
14 59 211655411
19 55 409828915
13 55 29599937
8 50 288981803
36 72 845363118
29 71 245960658
5 51 704846394
4 46 990499066
4 39 857206811
13 45 623803672
3 35 7771...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1579851645 1688016338 1688016338 2828615820 2936780513 2936780513 3154788497 3947417123 4844055621 5416102236 6085851635 7381675290 8016930442 8871843928 10210533499 11498381971 12614109011 13901957483 13901957483 14749882994 16086529293 ...

result:

ok 100 lines

Test #7:

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

input:

100
90 84
8 90 544067926
15 90 295641139
1 85 902318577
9 90 987378388
7 88 133595743
0 90 33207011
0 90 418600362
9 85 767527655
2 89 235369723
1 90 439147697
1 83 145434750
2 88 708179173
8 86 751546514
0 81 405752009
2 88 26193206
5 77 587219021
0 86 541362608
7 84 965163611
7 89 890265728
4 83 6...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 587219021 1031406396 1523585030 1523585030 1523585030 2678374149 3141571642 4854384801 6126474244 8978806560 11608076036 14734165356 16508213836 20090070737 2...

result:

ok 100 lines

Test #8:

score: 0
Accepted
time: 142ms
memory: 3788kb

input:

10
851 868
679 693 378192988
267 399 343857831
131 748 576579017
575 787 12204822
499 576 826908873
155 724 737312468
623 795 638740575
172 407 637837864
11 283 259084035
186 273 908657968
85 417 701461051
184 807 832409248
152 281 213019511
109 435 715286463
524 814 347540017
60 664 594004384
504 7...

output:

891385001 1219204255 1219204255 1516678750 1887587817 2215407071 2215407071 2512881566 2740735819 2753391924 3038210314 3050866419 3313797806 3541652059 3612342669 3839126554 3909817164 4280726231 4608545485 4608545485 4906019980 5133874233 5146530338 5465480444 5465480444 5762954939 5990809192 6003...

result:

ok 10 lines

Test #9:

score: 0
Accepted
time: 119ms
memory: 3996kb

input:

10
913 863
98 634 432130709
48 800 479851779
69 906 186774359
416 789 756411639
274 327 906033133
459 906 362923880
790 809 670510137
91 866 875171159
21 903 956639323
107 165 590430725
55 510 156036789
98 828 45500146
439 482 655902695
138 617 28938721
833 856 624732370
77 892 535654097
3 868 23177...

output:

418488187 966063397 1384551584 1826025664 2244513851 2542625088 2801740920 3099852157 3375801952 3634917784 3933029021 4197648871 4456764703 4754875940 4754875940 4822625709 5120736946 5227862880 5525974117 5525974117 5713687947 5891835123 6106424028 6156877401 6186674887 6484786124 6579410968 68775...

result:

ok 10 lines

Test #10:

score: 0
Accepted
time: 127ms
memory: 3904kb

input:

10
874 958
483 551 631858791
601 659 30225807
759 777 630132600
772 835 916633496
246 314 538628510
208 251 615840950
700 785 523731402
413 436 643299496
201 228 161288468
401 472 997421612
704 762 228097972
447 466 375836694
350 365 580675905
294 306 39388076
221 290 285200936
440 454 347252805
548...

output:

957614597 1612685590 2250760006 2881495320 3420983646 3734724339 4242003786 4555744479 5035470860 5349211553 5772752393 6086493086 6482898460 6796639153 7170903160 7484643853 7881049227 8194789920 8563367427 8877108120 9211409411 9525150104 9808380749 9998025568 10311766261 10594996906 10721590662 1...

result:

ok 10 lines

Test #11:

score: 0
Accepted
time: 83ms
memory: 3820kb

input:

10
961 924
90 532 71550121
310 699 446173607
415 936 223219513
6 531 905549873
322 876 879397647
339 789 150918417
199 612 126195703
180 667 404334728
258 714 879226371
314 875 62611196
162 658 204244054
142 689 614679390
363 887 544546349
302 846 546951131
433 951 529946158
347 882 343766215
11 542...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 10 lines

Test #12:

score: 0
Accepted
time: 32ms
memory: 3900kb

input:

10
898 919
8 797 50899375
29 891 494390299
7 893 602512657
56 882 930376306
53 827 162645369
45 886 590182657
61 824 346335916
116 895 129420744
0 898 462749196
4 887 532121466
12 743 760270355
22 854 738909464
3 876 300986641
1 843 561518289
105 852 851292970
27 889 940486169
20 884 120755595
88 89...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 10 lines

Test #13:

score: 0
Accepted
time: 1896ms
memory: 4628kb

input:

1
10000 10000
4243 4355 678092074
417 1119 480129711
1423 4497 648552857
3970 7187 341033928
3562 9406 262707175
2221 7546 593247929
8687 9420 19219689
1203 8523 264021888
1234 2415 374691722
2826 7687 139199900
7658 8431 780718641
7761 8218 852678681
3240 7544 193841776
1110 9353 662982105
5712 938...

output:

588915533 672758678 1261674211 1261674211 1544748874 1867906031 1867906031 2150980694 2296343133 2369281050 2579417796 2652355713 2860989061 2866405141 3144063724 3289426163 3362364080 3572500826 3645438743 3790801182 3859488171 4073875845 4142562834 4283508095 4360863190 4566582758 4643937853 47213...

result:

ok single line: '588915533 672758678 1261674211...29 4979636530079 4980177042778 '

Test #14:

score: 0
Accepted
time: 1719ms
memory: 4628kb

input:

1
10000 10000
6563 6718 205472596
4591 9659 475725571
1507 9704 807626376
3641 7881 799005138
183 9439 28519651
6822 7271 926087759
5222 6087 884632001
2210 2277 325917815
260 1122 945273281
2746 7330 120115078
4623 4842 325811390
3853 8463 973977593
2504 7276 135612374
1406 9852 295818637
1578 2542...

output:

996020286 1897811392 2545421008 2545421008 3034660540 3056353513 3056353513 3545593045 3545593045 3545593045 3891170292 3954343297 3976036270 4402102797 4465275802 4465275802 4530985758 4810853049 4832546022 5038611976 5321785554 5321785554 5387495510 5450668515 5469055201 5600314594 5958294733 5958...

result:

ok single line: '996020286 1897811392 254542100...79 4997402004439 5005758110695 '

Test #15:

score: 0
Accepted
time: 1930ms
memory: 4576kb

input:

1
10000 10000
5404 6322 715910077
2196 2974 714311457
9670 9954 795453872
5071 5850 864153416
654 1514 851872013
8786 9137 46967238
7843 8400 18379890
1437 1664 147962143
4304 4688 800880165
3156 3210 73542745
1502 2177 469337815
4219 5217 892643689
3726 4497 350048955
4735 5731 209961438
2221 2935 ...

output:

762317317 1185941641 1628033444 2051657768 2425094776 2787474698 3101235022 3463614944 3751448241 4065208565 4427588487 4657746870 5007695118 5333887116 5565286722 5913993747 6188958060 6471585351 6769064691 6994040286 7326656295 7492155656 7849111230 8014610591 8332861073 8498360434 8637855686 8909...

result:

ok single line: '762317317 1185941641 162803344...33 4997095078733 4997095078733 '

Test #16:

score: 0
Accepted
time: 1197ms
memory: 4620kb

input:

1
10000 10000
1043 6513 454914823
4722 9140 258790234
3216 7547 16388028
2974 7640 625713159
3960 9362 73842336
2152 6644 906247500
452 6396 165443639
505 6095 664803822
1721 7203 513974386
256 5069 965842615
2093 7599 873455915
4075 9833 985238289
4441 9704 370603489
2375 7053 908579552
4351 9653 4...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...44 4996448690044 4997394556683 '

Test #17:

score: 0
Accepted
time: 395ms
memory: 4496kb

input:

1
10000 10000
401 8933 48695377
553 9674 243460498
679 9487 237322183
58 9959 682240199
24 9788 736004147
47 9370 910751954
48 9619 457731579
262 8991 886678205
147 9901 227068607
15 8933 153109781
1165 9392 717765502
291 9462 227575993
11 9977 655999238
65 9985 902164963
1229 9562 221290145
132 989...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...80 4960801477462 4976018323167 '

Test #18:

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

input:

1000
4 1
0 4 347508634
7 5
0 3 298575751
3 4 436592642
4 5 233596921
5 6 957974470
6 7 254020999
8 8
0 1 275008072
1 2 736467180
2 3 403519884
3 4 952045659
4 5 321155914
5 6 235130124
6 7 201812533
7 8 759297086
2 2
0 1 913510512
1 2 972140497
9 5
0 1 403955822
1 2 455558885
2 4 236809569
4 8 97401...

output:

0 0 0 347508634 
957974470 1394567112 1648588111 1882185032 1882185032 1947163862 2180760783 
952045659 1711342745 2447809925 2851329809 3172485723 3447493795 3682623919 3884436452 
972140497 1885651009 
455558885 859514707 968963041 1096324276 1429573501 1833529323 1942977657 2070338892 2179787226 ...

result:

ok 1000 lines

Test #19:

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

input:

1000
2 1
0 2 2
8 6
0 1 1
1 2 1
2 3 4
3 4 14
4 5 10
5 8 20
3 1
0 3 23
7 7
0 1 1
1 2 5
2 3 3
3 4 1
4 5 12
5 6 1
6 7 1
8 3
0 4 1
4 6 18
6 8 1
1 1
0 1 1
1 1
0 1 1
5 5
0 1 1
1 2 1
2 3 1
3 4 1
4 5 15
5 5
0 1 1
1 2 1
2 3 1
3 4 3
4 5 14
3 3
0 1 20
1 2 1
2 3 1
4 4
0 1 1
1 2 1
2 3 11
3 4 14
7 1
0 7 1
9 4
0 2 ...

output:

0 2 
14 24 28 34 44 48 49 50 
0 0 23 
12 17 20 21 22 23 24 
0 18 18 19 19 19 19 20 
1 
1 
15 16 17 18 19 
14 17 18 19 20 
20 21 22 
14 25 26 27 
0 0 0 0 0 0 1 
1 12 18 19 30 33 34 45 46 
19 30 30 30 31 
13 13 14 
1 21 22 23 
0 0 0 0 0 1 
14 17 31 32 38 39 39 40 
9 17 26 27 28 28 29 29 29 30 
6 6 6 7...

result:

ok 1000 lines

Test #20:

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

input:

100
90 60
0 1 276843270
1 2 83016433
2 7 381327356
7 8 68577967
8 9 671496203
9 10 14407773
10 12 384894005
12 13 181788626
13 14 159595153
14 15 673590555
15 16 151800418
16 17 115209394
17 19 612100965
19 21 610034928
21 23 818725993
23 25 367528127
25 27 638338341
27 28 519367571
28 29 133454149
...

output:

965696474 1928467364 2805364265 3674778819 4488280371 5286065264 6044380976 6756289984 7429880539 8101376742 8703558497 9294510226 9821192406 10340559977 10824016882 11292867563 11776324468 12188913223 12595050461 13007639216 13363789642 13752771445 14108921871 14450960484 14794890722 15136929335 15...

result:

ok 100 lines

Test #21:

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

input:

100
85 29
0 10 2
10 11 17
11 14 9
14 15 4
15 17 1
17 18 21
18 23 1
23 24 12
24 26 1
26 27 1
27 29 12
29 30 18
30 32 4
32 35 1
35 40 6
40 42 1
42 45 1
45 49 12
49 54 19
54 57 1
57 60 1
60 64 14
64 65 5
65 68 7
68 74 1
74 76 6
76 78 1
78 82 1
82 85 1
94 77
0 1 1
1 2 4
2 4 11
4 5 1
5 6 13
6 7 1
7 9 1
9...

output:

21 39 56 68 73 80 85 89 91 95 99 104 108 110 114 118 122 124 128 131 134 137 140 143 145 149 150 153 156 157 160 161 161 162 163 166 167 167 168 168 169 169 170 170 171 171 171 172 172 172 173 173 173 174 174 174 175 175 175 176 176 176 176 177 177 177 177 177 178 178 178 178 178 179 179 179 179 179...

result:

ok 100 lines

Test #22:

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

input:

10
855 263
0 2 827653205
2 5 362179181
5 11 646797814
11 12 257563009
12 20 952173016
20 21 60742740
21 22 714321767
22 24 593680523
24 29 135956220
29 30 372362457
30 34 912821929
34 41 158708572
41 43 86320437
43 54 780318278
54 61 948211557
61 64 164129984
64 67 841656701
67 68 807869450
68 69 29...

output:

987007039 1973661507 2919931763 3861967244 4788604002 5694901343 6587993134 7479109018 8363827345 9216229510 10057180287 10897029205 11725332236 12552731799 13367566821 14182114493 14990992992 15798862442 16595262938 17386937533 18158490372 18912733821 19656574962 20390300834 21104622601 21814939212...

result:

ok 10 lines

Test #23:

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

input:

10
849 30
0 3 1
3 24 41
24 45 40
45 55 1
55 58 11
58 72 14
72 132 75
132 149 34
149 228 62
228 237 16
237 274 51
274 285 2
285 301 36
301 451 148
451 464 7
464 468 1
468 512 57
512 565 48
565 566 4
566 607 59
607 621 8
621 640 4
640 647 1
647 650 1
650 684 25
684 754 74
754 769 12
769 808 42
808 832...

output:

4 4 11 15 15 15 16 16 16 20 20 27 31 31 31 36 40 40 47 51 51 51 52 52 56 56 56 63 67 67 67 68 70 74 74 81 85 85 85 88 92 92 92 93 97 101 101 101 104 108 108 108 109 111 115 115 122 126 126 126 128 132 132 132 133 138 142 142 142 144 148 148 148 149 151 155 155 162 166 166 166 167 167 167 171 171 178...

result:

ok 10 lines

Test #24:

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

input:

1
10000 8417
0 1 702340095
1 2 813932564
2 3 525013435
3 5 79728030
5 6 507573826
6 8 732207547
8 9 273482814
9 10 474145716
10 12 202077873
12 13 847606148
13 14 373512249
14 15 894485182
15 16 173382805
16 18 471477166
18 20 280888423
20 21 451244735
21 22 57975611
22 23 12840476
23 24 831941575
2...

output:

999985876 1999870515 2999462547 3998740682 4997940994 5997117329 6995838325 7994406293 8992881036 9991286671 10989674019 11987336455 12984887119 13982423106 14979871298 15976795403 16973544957 17969816454 18966014758 19962205928 20958235215 21954253529 22950221289 23946089838 24941832124 25937473079...

result:

ok single line: '999985876 1999870515 299946254...79 4184152215183 4184152533935 '

Test #25:

score: 0
Accepted
time: 305ms
memory: 4384kb

input:

1
10000 1841
0 1 1
1 4 16
4 8 11
8 9 1
9 10 14
10 13 10
13 14 14
14 16 1
16 18 1
18 21 11
21 24 1
24 25 1
25 30 1
30 32 1
32 40 6
40 42 1
42 45 9
45 49 13
49 51 1
51 60 17
60 62 8
62 68 1
68 69 1
69 70 1
70 71 15
71 75 12
75 77 1
77 89 9
89 91 1
91 92 17
92 100 6
100 106 20
106 115 14
115 116 1
116 ...

output:

21 42 63 84 105 126 147 168 189 210 230 250 270 290 310 329 348 367 386 405 424 443 462 480 498 516 534 552 570 588 606 623 640 657 674 691 708 725 742 759 776 793 810 826 842 858 874 890 906 922 938 954 970 985 1000 1015 1030 1045 1060 1075 1090 1104 1118 1132 1146 1160 1174 1188 1202 1216 1230 124...

result:

ok single line: '21 42 63 84 105 126 147 168 18... 16293 16293 16293 16293 16294 '

Test #26:

score: 0
Accepted
time: 382ms
memory: 4632kb

input:

1
10000 10000
0 1 752887969
1 2 604076030
2 3 178478041
3 4 676100616
4 5 622413694
5 6 606211522
6 7 711084038
7 8 344225090
8 9 192516869
9 10 635914975
10 11 139161226
11 12 359096124
12 13 908320457
13 14 770162052
14 15 933070329
15 16 69776374
16 17 758642303
17 18 552711844
18 19 820115276
19...

output:

999772355 1999497915 2999210456 3998795408 4998278367 5997692961 6997097019 7996043075 8994956605 9993819158 10992613887 11991328081 12990018348 13988661176 14986868220 15985029547 16983023733 17980892570 18978693500 19976413095 20973942286 21971449625 22968875950 23966254470 24963605071 25960891264...

result:

ok single line: '999772355 1999497915 299921045...08 5001932263017 5001932339729 '

Test #27:

score: 0
Accepted
time: 282ms
memory: 4740kb

input:

1
10000 9999
0 2 114514
1 3 114514
2 4 114514
3 5 114514
4 6 114514
5 7 114514
6 8 114514
7 9 114514
8 10 114514
9 11 114514
10 12 114514
11 13 114514
12 14 114514
13 15 114514
14 16 114514
15 17 114514
16 18 114514
17 19 114514
18 20 114514
19 21 114514
20 22 114514
21 23 114514
22 24 114514
23 25 ...

output:

0 114514 229028 343542 458056 572570 687084 801598 916112 1030626 1145140 1259654 1374168 1488682 1603196 1717710 1832224 1946738 2061252 2175766 2290280 2404794 2519308 2633822 2748336 2862850 2977364 3091878 3206392 3320906 3435420 3549934 3664448 3778962 3893476 4007990 4122504 4237018 4351532 44...

result:

ok single line: '0 114514 229028 343542 458056 ...44796458 1144910972 1145025486 '

Test #28:

score: 0
Accepted
time: 1236ms
memory: 4600kb

input:

1
10000 10000
0 29 70000
1 16 50000
2 16 30000
3 33 40000
4 30 80000
5 22 150000
6 29 130000
7 15 130000
8 14 120000
9 33 110000
10 12 180000
11 17 210000
12 32 220000
13 34 200000
14 18 160000
15 29 240000
16 24 200000
17 39 220000
18 43 200000
19 27 210000
20 22 270000
21 25 220000
22 32 310000
23...

output:

100070000 200140000 300200000 400240000 500250000 600230000 700210000 800190000 900160000 1000110000 1100060000 1200010000 1299920000 1399810000 1499720000 1599630000 1699540000 1799390000 1899250000 1999100000 2098930000 2198770000 2298620000 2398440000 2498210000 2598020000 2697830000 2797650000 2...

result:

ok single line: '100070000 200140000 300200000 ...0000 500496290000 500496360000 '

Test #29:

score: 0
Accepted
time: 1651ms
memory: 4676kb

input:

1
10000 10000
0 263 50000
1 54 90000
2 143 100000
3 257 50000
4 226 130000
5 264 140000
6 70 120000
7 132 80000
8 26 150000
9 174 130000
10 220 120000
11 106 200000
12 48 190000
13 125 170000
14 159 190000
15 223 160000
16 220 170000
17 265 200000
18 122 240000
19 225 250000
20 212 280000
21 81 3100...

output:

100070000 200140000 300120000 400100000 500140000 600110000 700080000 800040000 899980000 999940000 1099880000 1199840000 1299770000 1399670000 1499590000 1599450000 1699320000 1799170000 1899070000 1998890000 2098740000 2198620000 2298430000 2398260000 2498110000 2597880000 2697640000 2797370000 28...

result:

ok single line: '100070000 200140000 300120000 ...0000 500499040000 500499090000 '

Test #30:

score: 0
Accepted
time: 1783ms
memory: 4600kb

input:

1
10000 10000
0 511 90000
1 935 90000
2 16 40000
3 941 90000
4 708 90000
5 207 80000
6 703 120000
7 753 110000
8 876 130000
9 426 110000
10 710 110000
11 389 160000
12 656 200000
13 177 180000
14 429 190000
15 890 240000
16 953 180000
17 974 250000
18 197 220000
19 632 260000
20 727 210000
21 936 22...

output:

100040000 200100000 300080000 400070000 500030000 600000000 699940000 799960000 899940000 999940000 1099900000 1199830000 1299760000 1399670000 1499560000 1599490000 1699380000 1799220000 1899090000 1998980000 2098860000 2198680000 2298530000 2398310000 2498160000 2597930000 2697730000 2797470000 28...

result:

ok single line: '100040000 200100000 300080000 ...0000 500498270000 500498360000 '

Test #31:

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

input:

1
10000 10000
0 1594 50000
1 3797 40000
2 849 50000
3 888 50000
4 482 90000
5 1975 120000
6 1489 130000
7 3109 170000
8 420 130000
9 1693 130000
10 3847 110000
11 2396 120000
12 3752 190000
13 867 160000
14 219 160000
15 2454 170000
16 2614 170000
17 2591 270000
18 1174 240000
19 1995 210000
20 2681...

output:

100020000 200030000 300070000 400060000 500080000 600120000 700120000 800120000 900040000 1000040000 1100000000 1199910000 1299830000 1399700000 1499630000 1599550000 1699480000 1799380000 1899250000 1999080000 2098920000 2198760000 2298620000 2398480000 2498270000 2598070000 2697840000 2797610000 2...

result:

ok single line: '100020000 200030000 300070000 ...0000 500501840000 500501890000 '

Test #32:

score: 0
Accepted
time: 1953ms
memory: 4612kb

input:

1
10000 10000
0 1734 30000
1 5979 80000
2 6922 80000
3 4876 130000
4 665 90000
5 1014 120000
6 3922 130000
7 3026 160000
8 874 180000
9 7150 160000
10 3624 160000
11 4075 210000
12 1960 160000
13 1727 170000
14 89 220000
15 4724 170000
16 2751 220000
17 1191 200000
18 3441 230000
19 3914 280000
20 7...

output:

100080000 200130000 300180000 400230000 500250000 600230000 700210000 800180000 900140000 1000120000 1100040000 1200020000 1299930000 1399810000 1499700000 1599580000 1699420000 1799340000 1899240000 1999060000 2098900000 2198720000 2298520000 2398370000 2498160000 2597920000 2697660000 2797440000 2...

result:

ok single line: '100080000 200130000 300180000 ...0000 500503570000 500503600000 '

Test #33:

score: 0
Accepted
time: 547ms
memory: 4528kb

input:

1
10000 10000
0 28 100030000
1 6 100050000
2 19 100080000
3 4 100020000
4 7 100060000
5 8 99960000
6 29 100010000
7 13 100010000
8 18 99940000
9 11 99960000
10 30 99940000
11 39 99980000
12 26 99930000
13 40 99920000
14 17 99910000
15 29 99930000
16 33 99850000
17 19 99870000
18 32 99870000
19 20 99...

output:

100020000 199900000 299320000 398100000 496730000 595170000 693310000 791160000 888940000 986660000 1083780000 1180600000 1277400000 1373880000 1470020000 1565910000 1661750000 1757380000 1852470000 1947010000 2041140000 2135210000 2229110000 2322900000 2416590000 2509990000 2603130000 2696060000 27...

result:

ok single line: '100020000 199900000 299320000 ...0000 500600020000 500600620000 '

Test #34:

score: 0
Accepted
time: 762ms
memory: 4648kb

input:

1
10000 10000
0 23 100010000
1 230 100090000
2 167 99990000
3 152 100050000
4 129 100050000
5 198 100050000
6 93 99950000
7 161 100000000
8 83 100010000
9 136 99980000
10 88 99930000
11 30 99980000
12 288 99940000
13 145 99900000
14 37 99910000
15 269 99870000
16 19 99920000
17 199 99860000
18 187 9...

output:

98940000 195300000 288170000 380320000 472010000 556650000 637720000 717490000 797000000 875310000 949430000 1023030000 1095050000 1166000000 1231480000 1294300000 1353240000 1411540000 1468940000 1519300000 1569240000 1613990000 1663850000 1708600000 1756590000 1801340000 1844100000 1887650000 1930...

result:

ok single line: '98940000 195300000 288170000 3...0000 500598840000 500603590000 '

Test #35:

score: 0
Accepted
time: 1014ms
memory: 4648kb

input:

1
10000 10000
0 371 100050000
1 604 100050000
2 740 99990000
3 544 99990000
4 211 100010000
5 349 100050000
6 430 100040000
7 778 99950000
8 445 99950000
9 385 99960000
10 469 99980000
11 713 99950000
12 801 99910000
13 502 99910000
14 508 99900000
15 343 99930000
16 752 99870000
17 904 99880000
18 ...

output:

90400000 173140000 253890000 328150000 401830000 465450000 506680000 560330000 601560000 639690000 671150000 709280000 737320000 774190000 806910000 838810000 871820000 898310000 936440000 956540000 987730000 1021160000 1040740000 1072450000 1104800000 1124380000 1156090000 1187500000 1207080000 123...

result:

ok single line: '90400000 173140000 253890000 3...0000 500596290000 500601180000 '

Test #36:

score: 0
Accepted
time: 1651ms
memory: 4500kb

input:

1
10000 10000
0 920 100090000
1 785 100080000
2 2221 100020000
3 828 99980000
4 1394 100060000
5 3093 99980000
6 3159 100040000
7 2887 99980000
8 195 100020000
9 625 99940000
10 2351 99960000
11 1096 99980000
12 3817 99980000
13 1555 99960000
14 2674 99900000
15 718 99890000
16 1888 99890000
17 3208...

output:

52670000 98180000 144020000 189530000 213740000 254850000 285460000 309670000 350780000 374990000 393540000 434650000 458860000 474190000 510820000 535030000 550360000 577860000 602070000 617400000 641610000 654550000 665310000 680640000 704850000 717790000 724980000 737920000 760490000 773430000 78...

result:

ok single line: '52670000 98180000 144020000 18...0000 500579890000 500603850000 '

Test #37:

score: 0
Accepted
time: 2092ms
memory: 4624kb

input:

1
10000 10000
0 1060 100030000
1 2263 100080000
2 486 100040000
3 5520 100070000
4 2280 100060000
5 6133 100040000
6 6104 99980000
7 3508 99990000
8 457 99960000
9 1378 100000000
10 6129 99990000
11 6775 99940000
12 2025 99950000
13 7120 99930000
14 2544 99920000
15 2988 99870000
16 1320 99860000
17...

output:

81810000 89980000 128570000 136740000 169810000 177980000 201220000 220070000 230950000 261310000 269480000 292720000 300890000 322450000 330620000 338130000 360340000 368510000 391750000 399920000 421480000 429650000 437160000 449710000 457880000 479440000 487610000 495120000 507220000 515390000 52...

result:

ok single line: '81810000 89980000 128570000 13...0000 500499290000 500599320000 '

Extra Test:

score: 0
Extra Test Passed