QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#439339#6369. Frog JumpingmoyujiangWA 2ms5372kbC++14945b2024-06-11 19:48:092024-06-11 19:48:10

Judging History

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

  • [2024-06-11 19:48:10]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:5372kb
  • [2024-06-11 19:48:09]
  • 提交

answer

#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a),i##END=(b);i<=i##END;i++)
#define Rof(i,b,a) for(int i=(b),i##END=(a);i>=i##END;i--)
#define go(u) for(int i=head[u];i;i=nxt[i])
#define int long long
using namespace std;
inline int read(){
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
    return x*f;
}
const int N=1e5+10;
int n,m,k,d,c[N],a[N],ans,s[N];
signed main(){
	n=read(),m=read(),k=read(),d=read();
	if(d>=n-1)return puts("0"),0; 
	For(i,1,m)c[i]=read();
	For(i,1,k)a[i]=read();a[0]=1,a[k+1]=n;
	sort(a+1,a+1+k);
	int mn=m;
	For(i,1,k)s[a[i]]++;
	For(i,1,n)s[i]+=s[i-1];
	For(i,d+1,n-1)mn=min(mn,s[i]-s[i-d]);
	For(i,0,k)if(a[i+1]-a[i]>d)mn=0;
	sort(c+1,c+1+m);For(i,1,m-mn)ans+=c[i];
	if(mn==0){ans-=c[1];For(i,0,k)ans+=c[1]*(a[i+1]-a[i]>d);}
	printf("%lld\n",ans);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

10 2 3 3
4 7
4 8 7

output:

4

result:

ok 1 number(s): "4"

Test #2:

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

input:

10 2 2 3
4 7
9 5

output:

15

result:

ok 1 number(s): "15"

Test #3:

score: -100
Wrong Answer
time: 2ms
memory: 5372kb

input:

200000 1 1 3
218918215
92715

output:

437836431

result:

wrong answer 1st numbers differ - expected: '437836430', found: '437836431'