QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#235574#6564. Frequent Flierugly2333WA 44ms14032kbC++20597b2023-11-02 22:05:432023-11-02 22:05:43

Judging History

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

  • [2023-11-02 22:05:43]
  • 评测
  • 测评结果:WA
  • 用时:44ms
  • 内存:14032kb
  • [2023-11-02 22:05:43]
  • 提交

answer

//Δ_G
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef double DB;
const int N = 222222;
int n,m,k,s,a[N],b[N];
set<int> S;
int main(){
	int i,j,x;
	LL ans=0;
	scanf("%d%d%d",&n,&m,&k);
	for(i=1;i<=n;i++)
		scanf("%d",a+i);
	S.insert(0);
	for(i=1;i<=n;i++){
		if(i>=k)
			s-=b[i-k];
		S.insert(i);
		while(s<k){
			j=*S.rbegin();
			if(j&&j>=i-k+1){
				x=min(k-s,a[j]-b[j]);
				s+=x;
				b[j]+=x;
				if(a[j]==b[j])
					S.erase(j);
			}
			else
				break;
		}
	}
	for(i=1;i<=n;i++)
		ans+=b[i];
	printf("%lld\n",ans);
	return 0;
}

詳細信息

Test #1:

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

input:

8 3 2
3
1
4
1
5
9
2
6

output:

8

result:

ok single line: '8'

Test #2:

score: -100
Wrong Answer
time: 44ms
memory: 14032kb

input:

200000 2467 999931035
182548858
69876218
33328350
919486767
739850600
948199964
392292320
39077742
366752074
917496841
246661698
37219034
56677740
188278971
965701828
28059790
13200243
825730775
542597589
320715170
939054378
470563899
914247467
990100491
290827128
903662394
611104879
18631185
412134...

output:

999931035

result:

wrong answer 1st lines differ - expected: '82994275905', found: '999931035'