QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#439199#6369. Frog JumpingmoyujiangWA 0ms3816kbC++14883b2024-06-11 18:01:042024-06-11 18:01:05

Judging History

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

  • [2024-06-11 18:01:05]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3816kb
  • [2024-06-11 18:01:04]
  • 提交

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;
signed main(){
	n=read(),m=read(),k=read(),d=read();
	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,l=1;For(r,1,k){
		while(a[r]-a[l]>d)l++;
		mn=min(mn,r-l+1);
	}For(i,1,k-1)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;
}

详细

Test #1:

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

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: 3764kb

input:

10 2 2 3
4 7
9 5

output:

15

result:

ok 1 number(s): "15"

Test #3:

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

input:

200000 1 1 3
218918215
92715

output:

0

result:

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