QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#527901#7122. OvertakingRafi2210 1ms6164kbC++172.0kb2024-08-22 22:20:562024-08-22 22:20:57

Judging History

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

  • [2024-08-22 22:20:57]
  • 评测
  • 测评结果:10
  • 用时:1ms
  • 内存:6164kb
  • [2024-08-22 22:20:56]
  • 提交

answer

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

#ifdef DEBUG
auto&operator<<(auto&o,pair<auto,auto>p){return o<<"("<<p.first<<", "<<p.second<<")";}
auto operator<<(auto&o,auto x)->decltype(x.end(),o){o<<"{";int i=0;for(auto e:x)o<<","+!i++<<e;return o<<"}";}
#define debug(X...)cerr<<"["#X"]: ",[](auto...$){((cerr<<$<<"; "),...)<<endl;}(X)
#else
#define debug(...){}
#endif

#define ll long long
#define ld long double
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define FOR(i,l,r) for(int i=(l);i<=(r);i++)
#define ROF(i,r,l) for(int i=(r);i>=(l);i--)
int inf=1000000007;
ll infl=2000000000000000007;
ll mod=1000000007;
ll mod1=998244353;

const int N=1007;

vector<pair<ll,ll>>V[N];
ll DP[N][N];
ll S[N];
ll X;
int n,m;

void init(int L,int nn,vector<ll>T,vector<int>W,int XX,int mm,vector<int>SS)
{
	X=XX,m=mm;
	FOR(i,0,m-1) S[i]=SS[i];
	FOR(i,0,nn-1) 
	{
		if(W[i]>X)
		{
			V[0].pb({T[i],W[i]});
			n++;
		}
	}
	sort(all(V[0]));
	FOR(i,1,m-1)
	{
		ll mn=infl;
		ROF(j,n-1,0) 
		{
			mn=min(mn,V[i-1][j].st+(S[i]-S[i-1])*V[i-1][j].nd);
			V[i].pb({mn,V[i-1][j].nd});
		}
		sort(all(V[i]));
	}
	ROF(i,m-1,0)
	{
		FOR(j,0,n-1)
		{
			bool is=0;
			FOR(l,i+1,m-1)
			{
				if(j>0&&V[l][j-1].st>=V[i][j].st+(S[l]-S[i])*X)
				{
					DP[i][j]=DP[l][j-1];
					is=1;
					break;
				}
			}
			if(!is) DP[i][j]=V[i][j].st+(S[m-1]-S[i])*X;
			debug(i,j,V[i][j].st,V[i][j].nd,DP[i][j]);
		}
	}
    return;
}

ll arrival_time(ll Y)
{
	ll ans=Y+(S[m-1]-S[0])*X;
	FOR(j,0,n-1) if(Y>V[0][j].st) ans=max(ans,V[0][j].st+V[0][j].nd*(S[m-1]-S[0]));
	return ans;
	ROF(j,n-1,0)
	{
		if(Y>V[0][j].st) 
		{
			debug(j,V[0][j].st,V[0][j].nd);
			FOR(i,1,m-1)
			{
				if(V[i][j].st>=Y+(S[i]-S[0])*X) 
				{
					debug(i);
					return DP[i][j];
				}
			}
			break;
		}
	}
	return Y+(S[m-1]-S[0])*X;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 6164kb

input:

XwWPuInrOjpekAwGKojzwKw3yVDtdkGS
2500 1 78 100 1000
100000
80
0 38 51 89 92 105 117 119 122 126 142 179 259 355 385 410 419 443 483 496 551 671 691 698 709 762 778 818 860 888 897 909 930 938 946 951 955 995 1045 1091 1164 1187 1215 1243 1264 1301 1363 1409 1416 1448 1504 1518 1535 1555 1562 1597 16...

output:

mGlgT4yvr1qPbquFwkxRVh9hMn0Mrxoz
OK
300000
300000
300000
300000
300000
300000
300000
300000
300000
300000
300000
300000
300000
300000
300000
300000
300000
300000
300000
300000
300000
300000
300000
300000
300000
300000
300000
300000
300000
300000
300000
300000
300000
300000
300000
300000
300000
30000...

result:

wrong answer 3rd lines differ - on the 1st token, expected: '299664', found: '300000'

Subtask #2:

score: 10
Accepted

Test #12:

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

input:

XwWPuInrOjpekAwGKojzwKw3yVDtdkGS
2000000 100 100 2 1000
566035866 424023571 564031634 266012245 266012901 566037245 106005324 106003684 266012594 424028440 424019007 106005224 564034079 424024371 424024546 566039191 424016814 424029581 82000890 754044052 566036512 424018510 424017279 424019925 42401...

output:

mGlgT4yvr1qPbquFwkxRVh9hMn0Mrxoz
OK
768035150
768029581
1144044184
308008207
768029581
768029581
956039191
768029581
956041170
768029581
768029581
308008207
956039191
308008207
768029581
768029891
1144044184
418008550
768029581
468009953
308008207
1144044184
768035150
768029581
468010817
768029581
6...

result:

ok 

Test #13:

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

input:

XwWPuInrOjpekAwGKojzwKw3yVDtdkGS
10000000 400 1011 2 1000
173387969125 200337983261 77920310897 77652037350 182097978669 118267907350 174157972712 57062023028 118267909308 107247901578 174157973485 146027951049 53742020545 118267912197 174167974422 207927989121 137207921414 143227933063 77992040344 ...

output:

mGlgT4yvr1qPbquFwkxRVh9hMn0Mrxoz
OK
128387906425
192867977136
218447987834
162297954325
192867978986
34992000977
147437922857
192867979350
67182020640
56912011273
63862013824
162297954325
43302006404
92682052132
120767905711
218447987834
98882054684
138667917161
63862014242
117367898279
210667984418...

result:

ok 

Test #14:

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

input:

XwWPuInrOjpekAwGKojzwKw3yVDtdkGS
10000 800 1522451 2 1000
102691961165 356949771920 280550316262 154390571762 439415828789 473733275923 465056851706 434971147676 473185083883 407141567243 446269133331 245826204010 132720147100 266857422544 300276587668 200566213815 304647607947 8994460481 3661139508...

output:

mGlgT4yvr1qPbquFwkxRVh9hMn0Mrxoz
OK
480548847785
422389308676
261050720686
480548847785
24218980889
488958822294
290598660610
61394536039
454767827473
117916481772
160323101016
454767828952
109098515326
222192213960
467092876761
319997647668
369154287532
146931915291
501350951422
319997648312
242189...

result:

ok 

Test #15:

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

input:

XwWPuInrOjpekAwGKojzwKw3yVDtdkGS
500000 1000 10000 2 1000
148512009450 164605927216 127484617319 27096740437 161301908126 227401559568 220855479544 152976736303 161069395645 159703894172 122292102200 189557102648 122405102528 39895753566 164605425801 106641054484 84900003806 152618881097 73504974935...

output:

mGlgT4yvr1qPbquFwkxRVh9hMn0Mrxoz
OK
237134063601
77319966760
172553429697
60674183017
13155506385
85565990030
188380679354
132653620072
213967471779
69226440539
137641624766
166302397011
221523969131
80847981443
46376261447
37662245837
106741029379
130318611384
221523968061
93106503930
230318554599
...

result:

ok 

Test #16:

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

input:

XwWPuInrOjpekAwGKojzwKw3yVDtdkGS
500000 1000 10000 2 1000
36612285378 23369050451 152360966961 15872520226 182265836399 188728204731 213864007043 57066096669 80835239061 207526883647 43857790862 65146624890 89690753835 154413657390 20424038673 49803808788 126917115886 52711828720 118899204834 158725...

output:

mGlgT4yvr1qPbquFwkxRVh9hMn0Mrxoz
OK
66580596995
198079362901
188002837585
194288360880
167111986766
73714107129
222229390881
108513769364
159439969371
25424526704
108513769364
25424526704
186703323340
108513769364
10576002438
140488624579
62066832985
36920571209
157371466325
100548265663
15330145069...

result:

ok 

Test #17:

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

input:

XwWPuInrOjpekAwGKojzwKw3yVDtdkGS
500000 1000 10000 2 1000
4337004497 176521204259 51880125384 34694128785 180975708661 218870562416 97250810605 114586115166 24846112541 64565181841 125706138427 91643555516 73078310445 109339605796 117687618529 131699541732 8692016529 131699546538 62862679197 2229305...

output:

mGlgT4yvr1qPbquFwkxRVh9hMn0Mrxoz
OK
57488656585
119672114103
159363389223
80550700997
193898735338
201967251391
209771544023
186206211435
61144668391
178885696551
195291238682
205565526206
108392081703
148442568746
201967251391
122724619987
186206206389
39694619414
108392081703
61144668391
396946227...

result:

ok 

Test #18:

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

input:

XwWPuInrOjpekAwGKojzwKw3yVDtdkGS
1 1000 1 2 1000
655 476 606 503 746 669 142 668 383 118 398 946 53 282 396 67 739 265 86 976 405 472 467 350 740 326 426 516 763 329 894 645 782 34 390 44 614 387 539 527 88 437 978 873 155 46 190 725 613 957 111 342 605 483 295 333 766 981 177 716 371 424 572 338 70...

output:

mGlgT4yvr1qPbquFwkxRVh9hMn0Mrxoz
OK
759
863
796
178
489
864
882
160
829
938
525
707
820
894
910
783
458
24
945
913
265
774
764
775
890
885
844
807
803
872
869
992
784
922
792
867
888
764
682
844
962
209
363
325
726
197
793
914
821
984
772
302
689
219
840
844
774
898
776
526
945
835
976
756
812
923
9...

result:

ok 

Test #19:

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

input:

XwWPuInrOjpekAwGKojzwKw3yVDtdkGS
100 1000 99 2 1000
64001 97600 61200 79400 29101 55800 93800 44301 22300 74300 22201 41601 76700 29901 20101 12000 71600 27101 82100 97101 27300 41000 95901 81701 78200 55100 69800 63901 20901 72301 19700 4600 39201 1401 83900 96601 82201 59401 86101 47101 36000 5260...

output:

mGlgT4yvr1qPbquFwkxRVh9hMn0Mrxoz
OK
99300
91701
51901
31500
15200
102101
97700
98400
35101
66300
65200
36101
63200
97600
94900
26301
47900
30800
29700
59701
108501
104601
85901
23401
85701
24401
84801
93900
102900
100201
86100
99000
52900
91701
56601
66101
92100
19001
92800
85500
95200
92501
104300
...

result:

ok 

Test #20:

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

input:

XwWPuInrOjpekAwGKojzwKw3yVDtdkGS
100023 1000 99969 2 1000
71100012 35700009 8700018 61050026 83400030 54450025 54750038 120450017 64800013 10500023 76800032 16050036 78600027 63600045 66150037 145800039 60150037 121800000 106050014 87750006 99900036 17250014 133500018 147300004 1200020 89250004 1995...

output:

mGlgT4yvr1qPbquFwkxRVh9hMn0Mrxoz
OK
10146301067
10132551175
10106701119
10124101130
10152451038
10013351130
10151051088
10109651134
10135451092
10065251142
10146301067
10030801116
10140450968
10147551038
10118151062
10133651147
10017001154
10124101130
10072951004
10131001083
10151400931
10048301151
...

result:

ok 

Test #21:

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

input:

XwWPuInrOjpekAwGKojzwKw3yVDtdkGS
10000 1000 100 2 1000
518750000 156250000 616250000 28750000 330000000 76250000 546250000 478750000 177500000 190000000 426250000 356250000 471250000 58750000 387500000 408750000 558750000 428750000 597500000 112500000 555000000 215000000 617500000 168750000 46000000...

output:

mGlgT4yvr1qPbquFwkxRVh9hMn0Mrxoz
OK
287250000
546163278
472230595
332250000
589965320
564195418
90709123
469750000
593482524
15456025
469750000
364750000
147250000
602250000
256721924
190332096
206670991
139750000
626233926
218500000
373941180
478939882
99939212
387250000
155407640
467136517
8165238...

result:

ok 

Test #22:

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

input:

XwWPuInrOjpekAwGKojzwKw3yVDtdkGS
10000 1000 100 2 1000
15750000 13500000 181500000 367500000 188250000 183000000 294750000 45750000 233250000 1500000 48750000 186750000 308250000 362250000 324000000 249000000 50250000 193500000 207000000 215250000 68250000 111000000 189750000 60000000 204750000 3112...

output:

mGlgT4yvr1qPbquFwkxRVh9hMn0Mrxoz
OK
4537693
25000000
150676482
172359551
298208750
295442591
370000000
326661512
121535016
58028889
275245071
240466612
286282573
49750000
264250000
271637019
304490046
245500000
34750000
292750000
93250000
325687081
341500000
166750000
374500000
115816035
189986704
1...

result:

ok 

Test #23:

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

input:

XwWPuInrOjpekAwGKojzwKw3yVDtdkGS
500000 100 10000 2 100
16997989753 22378679076 22455180036 21827670855 22450246771 29885191088 199 29885189691 4002502386 30773676142 7463505926 23130680797 30617693792 17085668681 22363171334 22377675195 12210508866 16991511620 12127457814 17211006625 3121501383 305...

output:

mGlgT4yvr1qPbquFwkxRVh9hMn0Mrxoz
OK
17210507896
17210507896
33946682372
35163191163
27379170855
27379171334
39375196452
27379171334
9046501383
17210507837
35823194285
35823194285
27457179645
9046501317
35823193927
12492004312
27379170848
27457179076
26266669449
27457179076
17210507896
9046501485
351...

result:

ok 

Test #24:

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

input:

XwWPuInrOjpekAwGKojzwKw3yVDtdkGS
500000 100 10000 2 100
23563110896 19551607847 15326098079 5792588892 16565101743 17307606838 1301500802 12063597866 4397002030 5691005559 6597589725 19674609121 12062594807 12058594487 23710612088 16571604124 28077618265 4876503793 5792548773 30488623266 28077619241...

output:

mGlgT4yvr1qPbquFwkxRVh9hMn0Mrxoz
OK
33077612560
21572601743
10802503793
33077618195
33077614213
39485126271
33077612560
37565623512
13521088892
33077614213
10284502030
17064094487
33077613967
25017606327
33077614923
39485126271
35517622912
9750000802
17064094487
37565624969
10802503793
17064091963
3...

result:

ok 

Test #25:

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

input:

XwWPuInrOjpekAwGKojzwKw3yVDtdkGS
500000 100 10000 2 100
6908543005 2238503286 13208053985 15680057439 24239066648 12970379595 17323563662 17323063417 6909043248 2243042488 6918047069 13205053732 26565068716 31814348865 6918048027 2210002506 29963344170 22615565814 17323063417 13211556372 31855352038...

output:

mGlgT4yvr1qPbquFwkxRVh9hMn0Mrxoz
OK
31805568018
14836548027
11918542952
11918542488
22323561103
14836548027
11918542488
18212052351
36855846284
18212052351
22323563474
22323558682
31805568018
22323557326
22323557326
7250000019
36631345373
22323563417
35019343547
27616565238
7250001633
35019343547
22...

result:

ok 

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%

Subtask #5:

score: 0
Skipped

Dependency #1:

0%