QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#455161#6462. Jewel Thiefdo_while_trueAC ✓814ms29588kbC++172.9kb2024-06-25 20:39:512024-06-25 20:39:52

Judging History

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

  • [2024-06-25 20:39:52]
  • 评测
  • 测评结果:AC
  • 用时:814ms
  • 内存:29588kb
  • [2024-06-25 20:39:51]
  • 提交

answer

#include<cstdio>
#include<vector>
#include<queue>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<ctime>
#include<bitset>
#include<random>
#include<array>
#include<assert.h>
#include<functional>
#define pb emplace_back
#define mp make_pair
#define fi first
#define se second
#define dbg(x) cerr<<"In Line "<< __LINE__<<" the "<<#x<<" = "<<x<<'\n'
#define dpi(x,y) cerr<<"In Line "<<__LINE__<<" the "<<#x<<" = "<<x<<" ; "<<"the "<<#y<<" = "<<y<<'\n'
#define DE(fmt,...) fprintf(stderr, "Line %d : " fmt "\n",__LINE__,##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef __int128 i128;
typedef pair<int,int>pii;
typedef pair<ll,int>pli;
typedef pair<ll,ll>pll;
typedef pair<int,ll>pil;
typedef vector<int>vi;
typedef vector<ll>vll;
typedef vector<pii>vpii;
typedef vector<pll>vpll;
template<typename T>T cmax(T &x, T y){return x=x>y?x:y;}
template<typename T>T cmin(T &x, T y){return x=x<y?x:y;}
template<typename T>
T &read(T &r){
	r=0;bool w=0;char ch=getchar();
	while(ch<'0'||ch>'9')w=ch=='-'?1:0,ch=getchar();
	while(ch>='0'&&ch<='9')r=r*10+(ch^48),ch=getchar();
	return r=w?-r:r;
}
template<typename T1,typename... T2>
void read(T1 &x,T2& ...y){read(x);read(y...);}
const int mod=998244353;
const int bas=20201205;
inline void cadd(int &x,int y){x=(x+y>=mod)?(x+y-mod):(x+y);}
inline void cdel(int &x,int y){x=(x-y<0)?(x-y+mod):(x-y);}
inline int add(int x,int y){return (x+y>=mod)?(x+y-mod):(x+y);}
inline int del(int x,int y){return (x-y<0)?(x-y+mod):(x-y);}
int qpow(int x,int y){
	int s=1;
	while(y){
		if(y&1)s=1ll*s*x%mod;
		x=1ll*x*x%mod;
		y>>=1;
	}
	return s;
}
const int N=1000010;
const ll inf=0x3f3f3f3f3f3f3f3f;
int n,m;
int b[N];
ll c[N];
ll f[N],g[N];
vll vec[310];
signed main(){
	#ifdef do_while_true
//		assert(freopen("data.in","r",stdin));
	#endif
	read(n,m);
	int mx=0;
	for(int i=1;i<=n;i++)read(b[i],c[i]),cmax(mx,b[i]);
	for(int i=1;i<=n;i++)vec[b[i]].pb(c[i]);
	for(int o=1;o<=min(mx,m);o++)if(!vec[o].empty()){
		sort(vec[o].begin(),vec[o].end(),greater<int>());
		int len=vec[o].size();
		for(int i=1;i<len;i++)vec[o][i]+=vec[o][i-1];
		vec[o].insert(vec[o].begin(),0ll);
		for(int p=0;p<o;p++){
			function<void(int,int,int,int)>solve=[&](int l,int r,int L,int R){
				if(l>r)return ;
				int mid=(l/o+r/o)/2*o+p;
				int pos=0;ll mx=-inf;
				for(int i=L;i<=min(mid,R);i+=o){
					ll w=f[i]+vec[o][min(len,(mid-i)/o)];
					if(w>mx){
						mx=w;
						pos=i;
					}
				}
				g[mid]=mx;
				solve(l,mid-o,L,pos);
				solve(mid+o,r,pos,R);
			};
			int t=m;
			while(t%o!=p)--t;
			if(p<=t){
//				DE("p=%d t=%d",p,t);
				solve(p,t,p,t);
			}
		}
		for(int i=1;i<=m;i++)f[i]=max(f[i-1],g[i]),g[i]=0;
	}
	for(int i=1;i<=m;i++)cout<<f[i]<<' ';
	cerr<<'\n';
    #ifdef do_while_true
//		cerr<<'\n'<<"Time:"<<1.0*clock()/CLOCKS_PER_SEC*1000<<" ms"<<'\n';
	#endif
	return 0;
}

详细

Test #1:

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

input:

4 9
2 8
1 1
3 4
5 100

output:

1 8 9 9 100 101 108 109 109 

result:

ok single line: '1 8 9 9 100 101 108 109 109 '

Test #2:

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

input:

5 7
2 2
3 8
2 7
2 4
3 8

output:

0 7 8 11 15 16 19 

result:

ok single line: '0 7 8 11 15 16 19 '

Test #3:

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

input:

2 6
300 1
300 2

output:

0 0 0 0 0 0 

result:

ok single line: '0 0 0 0 0 0 '

Test #4:

score: 0
Accepted
time: 45ms
memory: 25224kb

input:

1000000 100000
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59...

output:

1000000 1999999 2999997 3999994 4999990 5999985 6999979 7999972 8999964 9999955 10999945 11999934 12999922 13999909 14999895 15999880 16999864 17999847 18999829 19999810 20999790 21999769 22999747 23999724 24999700 25999675 26999649 27999622 28999594 29999565 30999535 31999504 32999472 33999439 3499...

result:

ok single line: '1000000 1999999 2999997 399999...249997 94999149999 95000050000 '

Test #5:

score: 0
Accepted
time: 757ms
memory: 26736kb

input:

1000000 100000
2 1
3 2
4 3
5 4
6 5
7 6
8 7
9 8
10 9
11 10
12 11
13 12
14 13
15 14
16 15
17 16
18 17
19 18
20 19
21 20
22 21
23 22
24 23
25 24
26 25
27 26
28 27
29 28
30 29
31 30
32 31
33 32
34 33
35 34
36 35
37 36
38 37
39 38
40 39
41 40
42 41
43 42
44 43
45 44
46 45
47 46
48 47
49 48
50 49
51 50
52...

output:

999900 1999500 2998800 3997800 4996500 5994900 6993000 7990800 8988300 9985500 10982400 11979000 12975300 13971300 14967000 15962400 16957500 17952300 18946800 19941000 20934900 21928500 22921800 23914800 24907500 25899900 26892000 27883800 28875300 29866500 30857400 31848000 32838300 33828300 34818...

result:

ok single line: '999900 1999500 2998800 3997800...391158 14095465559 14095540259 '

Test #6:

score: 0
Accepted
time: 813ms
memory: 28624kb

input:

1000000 100000
215 147097103
134 678126202
99 584874219
117 706686049
115 916008673
30 162264571
258 432473996
198 594445641
220 297145909
65 930644070
244 407860992
142 29223115
88 672186982
159 425618716
135 940015882
157 487536108
231 274342869
186 476447051
218 224412395
246 190206170
40 9447381...

output:

999806703 1999387329 2998933273 3997600596 4996253636 5994813962 6993341251 7991739112 8990090915 9988030031 10985967744 11983790477 12981604791 13979203678 14976661166 15973082139 16969021626 17964792681 18960320420 19955515110 20950479371 21945397018 22939871008 23934321385 24928593459 25922728871...

result:

ok single line: '999806703 1999387329 299893327... 14030752721202 14030826574137 '

Test #7:

score: 0
Accepted
time: 810ms
memory: 29588kb

input:

1000000 100000
276 486439797
78 332192431
177 149331902
205 326469917
62 299418832
100 105216428
37 535809017
4 907429843
85 489556625
232 611694228
140 851732325
88 439535327
210 842244665
192 833765518
108 468815050
283 562360222
45 524644417
174 261303298
196 868413682
71 269288419
68 763489570
2...

output:

999952362 1999046086 2997605897 3995568380 4993245770 5990739901 6988183483 7985611765 8982786564 9979648673 10976385153 11972735383 12968964171 13965077494 14960714942 15954774493 16947942489 17941033993 18934101155 19927079998 20919698313 21912088112 22904355648 23896371831 24888301660 25880120864...

result:

ok single line: '999952362 1999046086 299760589... 14072664773620 14072739138829 '

Test #8:

score: 0
Accepted
time: 800ms
memory: 28020kb

input:

1000000 100000
53 136327709
225 766761421
116 360378262
140 440492548
248 328435669
211 366342678
127 816570730
227 590613511
62 742067716
142 435660809
178 857831655
20 418529045
116 422302
102 632588249
163 612181607
186 667148706
159 457898250
113 977020169
286 648065211
266 218937379
68 28371329...

output:

999761872 1999394231 2998842070 3997492823 4995671154 5993680245 6991581366 7989443370 8986423253 9982264154 10977930879 11973157999 12968271667 13962835018 14957396737 15951881777 16946046050 17940120886 18934102404 19927806514 20920817505 21913759795 22905962735 23897531693 24888483311 25878856449...

result:

ok single line: '999761872 1999394231 299884207... 14128891913946 14128966557075 '

Test #9:

score: 0
Accepted
time: 814ms
memory: 28260kb

input:

1000000 100000
101 793296436
137 605204154
85 363620904
134 632573190
257 27613487
90 287977105
282 914889858
54 860546284
41 847837905
257 33185728
192 980309638
104 610219578
61 643062100
11 777815592
224 747718881
38 449696420
24 263912585
256 156471676
276 92793827
71 284887813
259 887442002
94 ...

output:

999572837 1998158938 2996411421 3994154966 4991734366 5988967099 6986012373 7983017116 8979625056 9975907607 10971775012 11967245931 12962707427 13957864243 14952965902 15948000558 16942808410 17937534727 18931735671 19925778405 20919711237 21912928201 22905686887 23898301052 24890681787 25883045091...

result:

ok single line: '999572837 1998158938 299641142... 14094082480223 14094156843676 '

Test #10:

score: 0
Accepted
time: 804ms
memory: 26824kb

input:

1000000 100000
261 795269977
1 232017324
115 284432088
159 563880768
156 361981137
287 689619251
217 765677892
124 51435599
223 881243986
64 867724270
186 762994727
8 429505599
94 980980722
276 739074276
213 646934615
40 748272219
233 939640172
65 415524207
133 752367271
140 105850549
16 222419590
1...

output:

999237254 1997568979 2995779184 3993718709 4991408649 5989065948 6986701941 7983931202 8980934393 9977706287 10974249695 11970266636 12965559260 13960713809 14955223995 15949479353 16943561874 17937049404 18929777437 19921674417 20913512189 21904864311 22896152931 23887283718 24878392517 25869308722...

result:

ok single line: '999237254 1997568979 299577918... 14079887527391 14079962184253 '

Test #11:

score: 0
Accepted
time: 153ms
memory: 26424kb

input:

1000000 100000
17 628547370
20 770082938
14 535699393
12 632751596
15 220781756
17 581861985
10 269638092
15 992182059
17 42658615
5 169296359
3 71547992
1 302308476
12 727988950
16 815713556
13 370312219
9 998481076
14 269846832
5 751344112
3 293415464
7 468053512
14 958838547
8 589547756
13 725754...

output:

999941518 1999868413 2999778701 3999674827 4999539950 5999366232 6999174643 7998977716 8998768647 9998559568 10998344370 11998121362 12997888675 13997603482 14997289493 15996974739 16996651773 17996319312 18995983331 19995634009 20995264052 21994849046 22994429629 23994004441 24993578323 25993143211...

result:

ok single line: '999941518 1999868413 299977870... 46270282515968 46270567625300 '

Test #12:

score: 0
Accepted
time: 155ms
memory: 27220kb

input:

1000000 100000
1 203196685
17 934284059
19 300866297
14 233095054
6 54776395
10 24307480
12 313222603
4 294346018
3 115763509
12 837552635
9 413482181
18 95445751
16 272073374
12 502825585
12 271447973
2 799245859
16 143012765
20 691177896
20 791506213
15 348764962
4 106854539
15 232092520
20 131279...

output:

999889278 1999733516 2999564463 3999389004 4999117819 5998823659 6998502867 7998161440 8997819043 9997468507 10997101919 11996732258 12996341619 13995946994 14995544426 15995089909 16994624512 17994155884 18993668634 19993165543 20992647073 21992119956 22991584689 23991009535 24990397268 25989769886...

result:

ok single line: '999889278 1999733516 299956446... 46424704848152 46424990428685 '

Test #13:

score: 0
Accepted
time: 98ms
memory: 26124kb

input:

1000000 100000
298 518988015
300 227810815
298 804414582
297 598138804
300 74345488
299 931293348
299 351137588
300 2875128
297 1582843
300 87548558
298 545973219
298 82529405
300 307489106
297 662965555
300 658586957
300 770950966
298 427872002
298 826990092
297 807121824
297 382920080
300 41288716...

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 ...4033 335904783777 335905019785 '

Test #14:

score: 0
Accepted
time: 118ms
memory: 27128kb

input:

1000000 100000
297 909200742
298 596234549
300 177546157
299 838036463
300 313416578
299 613261143
298 675936750
297 605587485
297 315387989
300 356443606
297 773294581
300 356405311
298 335469796
297 419593877
297 6312363
300 42788696
298 910197313
300 125448608
297 359007793
299 967482394
298 2003...

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 ...2638 335897854498 335898203377 '

Test #15:

score: 0
Accepted
time: 56ms
memory: 24740kb

input:

1000000 100000
297 2
298 7
300 2
300 5
298 1
299 7
298 2
297 3
300 6
298 2
298 6
297 9
300 10
300 1
300 6
300 5
299 2
299 2
298 2
297 8
297 2
298 2
298 9
300 3
297 3
299 7
298 3
300 3
298 6
298 5
300 3
297 7
299 9
299 9
300 3
297 8
299 8
298 9
300 6
297 6
299 4
297 7
297 9
297 5
300 1
300 1
300 8
29...

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 ... 3360 3360 3360 3360 3360 3360 '

Test #16:

score: 0
Accepted
time: 58ms
memory: 26676kb

input:

1000000 100000
297 4
299 4
297 2
298 2
298 10
299 8
300 1
300 2
298 7
297 4
300 8
298 8
299 7
297 1
298 5
300 3
298 5
298 5
298 3
298 9
297 2
297 9
298 8
299 1
298 10
299 7
298 2
297 1
298 7
300 3
300 2
298 3
297 8
298 9
300 5
300 2
299 7
299 2
300 9
297 5
297 10
299 10
299 4
297 2
297 6
297 4
297 7...

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 ... 3360 3360 3360 3360 3360 3360 '

Test #17:

score: 0
Accepted
time: 99ms
memory: 27028kb

input:

1000000 100000
5 4
5 7
20 3
7 6
8 3
17 5
11 4
19 5
7 3
18 8
15 4
14 9
2 5
13 4
1 8
8 1
16 6
9 1
16 2
17 3
15 7
13 9
13 2
2 10
12 3
8 4
4 3
5 8
17 1
10 7
6 10
1 6
6 9
15 8
16 2
20 2
10 8
19 7
5 6
14 6
13 6
14 3
3 2
17 10
9 7
19 9
18 10
5 9
14 5
1 9
18 4
9 7
20 3
17 1
9 3
3 7
16 6
2 1
13 3
1 3
3 9
17 ...

output:

10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250 260 270 280 290 300 310 320 330 340 350 360 370 380 390 400 410 420 430 440 450 460 470 480 490 500 510 520 530 540 550 560 570 580 590 600 610 620 630 640 650 660 670 680 690 700 710 720 730 740 750 760 770 7...

result:

ok single line: '10 20 30 40 50 60 70 80 90 100...96 493899 493902 493905 493908 '

Test #18:

score: 0
Accepted
time: 104ms
memory: 27204kb

input:

1000000 100000
14 1
1 1
6 7
13 10
20 5
10 10
17 2
12 10
15 9
15 4
13 4
20 4
2 5
6 9
9 2
20 7
18 2
11 5
5 5
8 10
17 8
10 10
9 3
5 2
9 8
20 2
12 4
17 4
2 5
13 1
16 3
16 1
19 4
20 10
12 1
18 9
15 8
4 1
17 8
1 6
11 4
8 7
10 7
10 3
9 10
5 8
12 1
11 3
18 4
13 5
13 2
19 6
10 10
12 4
2 9
19 1
6 6
5 4
2 7
19...

output:

10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250 260 270 280 290 300 310 320 330 340 350 360 370 380 390 400 410 420 430 440 450 460 470 480 490 500 510 520 530 540 550 560 570 580 590 600 610 620 630 640 650 660 670 680 690 700 710 720 730 740 750 760 770 7...

result:

ok single line: '10 20 30 40 50 60 70 80 90 100...85 494888 494891 494894 494897 '

Test #19:

score: 0
Accepted
time: 758ms
memory: 28484kb

input:

1000000 100000
1 19
1 9
1 27
1 12
1 27
1 8
1 1
1 26
1 12
1 25
1 2
1 24
1 20
1 15
1 25
1 1
1 6
1 17
1 2
1 10
1 6
1 14
1 7
1 25
1 12
1 11
1 1
1 16
1 5
1 27
1 27
1 2
1 15
1 15
1 24
1 21
1 11
1 8
1 25
1 5
1 20
1 7
1 5
1 7
1 20
1 27
1 26
1 24
1 8
1 4
1 18
1 15
1 22
1 19
1 11
1 9
1 23
1 26
1 30
1 7
1 14
1...

output:

30 60 90 120 150 180 210 240 270 300 330 360 390 420 450 480 510 540 570 600 630 660 690 720 750 780 810 840 870 900 930 960 990 1020 1050 1080 1110 1140 1170 1200 1230 1260 1290 1320 1350 1380 1410 1440 1470 1500 1530 1560 1590 1620 1650 1680 1710 1740 1770 1800 1830 1860 1890 1920 1950 1980 2010 2...

result:

ok single line: '30 60 90 120 150 180 210 240 2...787540 1787550 1787560 1787570 '

Test #20:

score: 0
Accepted
time: 757ms
memory: 27012kb

input:

1000000 100000
1 23
1 16
1 28
1 16
1 10
1 29
1 2
1 19
1 17
1 10
1 25
1 30
1 12
1 14
1 4
1 30
1 3
1 16
1 19
1 26
1 27
1 10
1 13
1 6
1 13
1 12
1 25
1 18
1 29
1 24
1 3
1 28
1 26
1 19
1 22
1 25
1 30
1 12
1 2
1 7
1 28
1 19
1 4
1 27
1 25
1 28
1 28
1 29
1 15
1 6
1 3
1 24
1 28
1 7
1 10
1 13
1 29
1 25
1 16
1...

output:

30 60 90 120 150 180 210 240 270 300 330 360 390 420 450 480 510 540 570 600 630 660 690 720 750 780 810 840 870 900 930 960 990 1020 1050 1080 1110 1140 1170 1200 1230 1260 1290 1320 1350 1380 1410 1440 1470 1500 1530 1560 1590 1620 1650 1680 1710 1740 1770 1800 1830 1860 1890 1920 1950 1980 2010 2...

result:

ok single line: '30 60 90 120 150 180 210 240 2...791223 1791233 1791243 1791253 '

Test #21:

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

input:

300 299
300 1
300 3
300 1
300 2
300 2
300 1
300 1
300 1
300 1
300 1
300 1
300 3
300 1
300 3
300 3
300 1
300 2
300 1
300 2
300 3
300 1
300 3
300 2
300 2
300 1
300 2
300 3
300 1
300 3
300 1
300 1
300 1
300 2
300 1
300 2
300 3
300 2
300 1
300 3
300 2
300 3
300 3
300 3
300 2
300 2
300 2
300 2
300 3
300 ...

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 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #22:

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

input:

300 300
300 1
300 3
300 1
300 2
300 2
300 1
300 1
300 1
300 1
300 1
300 1
300 3
300 1
300 3
300 3
300 1
300 2
300 1
300 2
300 3
300 1
300 3
300 2
300 2
300 1
300 2
300 3
300 1
300 3
300 1
300 1
300 1
300 2
300 1
300 2
300 3
300 2
300 1
300 3
300 2
300 3
300 3
300 3
300 2
300 2
300 2
300 2
300 3
300 ...

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 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 '

Test #23:

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

input:

300 301
300 1
300 3
300 1
300 2
300 2
300 1
300 1
300 1
300 1
300 1
300 1
300 3
300 1
300 3
300 3
300 1
300 2
300 1
300 2
300 3
300 1
300 3
300 2
300 2
300 1
300 2
300 3
300 1
300 3
300 1
300 1
300 1
300 2
300 1
300 2
300 3
300 2
300 1
300 3
300 2
300 3
300 3
300 3
300 2
300 2
300 2
300 2
300 3
300 ...

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 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 3 3 '

Test #24:

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

input:

1 1
1 1

output:

1 

result:

ok single line: '1 '

Test #25:

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

input:

1 1
2 1

output:

0 

result:

ok single line: '0 '

Test #26:

score: 0
Accepted
time: 51ms
memory: 25832kb

input:

1000000 100000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000...

output:

1000000000 2000000000 3000000000 4000000000 5000000000 6000000000 7000000000 8000000000 9000000000 10000000000 11000000000 12000000000 13000000000 14000000000 15000000000 16000000000 17000000000 18000000000 19000000000 20000000000 21000000000 22000000000 23000000000 24000000000 25000000000 260000000...

result:

ok single line: '1000000000 2000000000 30000000...99999000000000 100000000000000 '

Test #27:

score: 0
Accepted
time: 54ms
memory: 26772kb

input:

1000000 100000
2 1000000000
2 1000000000
2 1000000000
2 1000000000
2 1000000000
2 1000000000
2 1000000000
2 1000000000
2 1000000000
2 1000000000
2 1000000000
2 1000000000
2 1000000000
2 1000000000
2 1000000000
2 1000000000
2 1000000000
2 1000000000
2 1000000000
2 1000000000
2 1000000000
2 1000000000...

output:

0 1000000000 1000000000 2000000000 2000000000 3000000000 3000000000 4000000000 4000000000 5000000000 5000000000 6000000000 6000000000 7000000000 7000000000 8000000000 8000000000 9000000000 9000000000 10000000000 10000000000 11000000000 11000000000 12000000000 12000000000 13000000000 13000000000 1400...

result:

ok single line: '0 1000000000 1000000000 200000... 49999000000000 50000000000000 '

Test #28:

score: 0
Accepted
time: 47ms
memory: 24496kb

input:

1000000 100000
3 1000000000
3 1000000000
3 1000000000
3 1000000000
3 1000000000
3 1000000000
3 1000000000
3 1000000000
3 1000000000
3 1000000000
3 1000000000
3 1000000000
3 1000000000
3 1000000000
3 1000000000
3 1000000000
3 1000000000
3 1000000000
3 1000000000
3 1000000000
3 1000000000
3 1000000000...

output:

0 0 1000000000 1000000000 1000000000 2000000000 2000000000 2000000000 3000000000 3000000000 3000000000 4000000000 4000000000 4000000000 5000000000 5000000000 5000000000 6000000000 6000000000 6000000000 7000000000 7000000000 7000000000 8000000000 8000000000 8000000000 9000000000 9000000000 9000000000...

result:

ok single line: '0 0 1000000000 1000000000 1000... 33333000000000 33333000000000 '

Test #29:

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

input:

1 100000
1 1

output:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok single line: '1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 '