QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#472818#2785. Boxes with souvenirsRafi220 0ms3848kbC++141.2kb2024-07-11 19:33:152024-07-11 19:33:15

Judging History

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

  • [2024-07-11 19:33:15]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:3848kb
  • [2024-07-11 19:33:15]
  • 提交

answer

#include <bits/stdc++.h>
#include "boxes.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=2000000007;
ll infl=1000000000000000007;
ll mod=1000000007;

ll delivery(int n, int k, int l,int p[])
{
	ll sum=0;
	int L=0,R=n-1;
	while(L+k-1<=R&&2*p[L+k-1]<=l)
	{
		sum+=(ll)2*p[L+k-1];
		L+=k;
	}
	while(R-k+1>=L&&2*p[R-k+1]>l)
	{
		sum+=(ll)2*(l-p[R-k+1]);
		R-=k;
	}
	ll ans=sum;
	if(R-L+1<=k) ans+=(ll)l;
	else ans+=(ll)2*l;
	for(int i=L;i<R;i++)
	{
		ans=min(ans,sum+2*(ll)p[i]+2*(ll)(l-p[i+1]));
	}
	ans=min(ans,sum+2*(ll)p[R]);
	ans=min(ans,sum+2*(ll)(l-p[L]));
	debug(L,R,ans);
    return ans;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3816kb

input:

1 1 1000000000
210758687

output:

843034748

result:

wrong answer 1st lines differ - expected: '421517374', found: '843034748'

Subtask #2:

score: 0
Wrong Answer

Test #8:

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

input:

1000 1000 1000
0 0 1 2 3 3 4 5 5 6 6 7 8 8 8 9 10 11 11 11 12 13 13 13 14 14 15 16 17 17 17 18 20 20 21 21 24 25 25 26 30 31 34 34 35 38 40 43 44 46 46 46 47 47 51 52 52 52 55 56 58 62 64 65 67 68 69 72 73 75 76 77 78 79 79 80 83 84 85 85 86 86 87 88 88 88 92 92 92 95 95 96 98 98 99 99 100 100 101 1...

output:

1000

result:

ok single line: '1000'

Test #9:

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

input:

1000 1000 5
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

5

result:

ok single line: '5'

Test #10:

score: -10
Wrong Answer
time: 0ms
memory: 3764kb

input:

1000 1000 1000000000
154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846 154376846...

output:

617507384

result:

wrong answer 1st lines differ - expected: '308753692', found: '617507384'

Subtask #3:

score: 0
Wrong Answer

Test #15:

score: 15
Accepted
time: 0ms
memory: 3840kb

input:

10 5 5
0 0 0 0 0 1 3 3 3 4

output:

5

result:

ok single line: '5'

Test #16:

score: -15
Wrong Answer
time: 0ms
memory: 3808kb

input:

10 5 1000000000
334882664 334882664 334882664 334882664 334882664 334882664 334882664 334882664 334882664 334882664

output:

2009295984

result:

wrong answer 1st lines differ - expected: '1339530656', found: '2009295984'

Subtask #4:

score: 0
Skipped

Dependency #1:

0%

Subtask #5:

score: 0
Skipped

Dependency #1:

0%

Subtask #6:

score: 0
Skipped

Dependency #1:

0%