QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#469628#8008. Fortune WheelmaojunWA 0ms4188kbC++23601b2024-07-09 21:17:562024-07-09 21:17:57

Judging History

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

  • [2024-07-30 15:38:33]
  • hack成功,自动添加数据
  • (/hack/759)
  • [2024-07-10 08:02:33]
  • hack成功,自动添加数据
  • (/hack/730)
  • [2024-07-09 21:17:57]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4188kb
  • [2024-07-09 21:17:56]
  • 提交

answer

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

typedef long long ll;
const int N=1e5+5;
int n,x,m,k[505],dis[N];

int main(){
	scanf("%d%d%d",&n,&x,&m);
	for(int i=1;i<=m;i++)scanf("%d",&k[i]);
	queue<int>q;memset(dis,0xff,sizeof dis);dis[0]=0;q.push(0);
	while(!q.empty()){
		int u=q.front();q.pop();
		for(int i=1;i<=m;i++){
			int v=(u+n-k[i])%n;
			if(!~dis[v]){dis[v]=dis[u]+1;q.push(v);}
		}
	}
	ll ax=~dis[x]?dis[x]:1e12,ay=1,sum=n;
	sort(dis,dis+n);
	for(int i=1;i<=n;i++){
		sum+=dis[i-1];
		if(ax*i>sum*ay){ax=sum;ay=i;}
	}
	printf("%lld %lld\n",ax,ay);
	return 0;
}

詳細信息

Test #1:

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

input:

6 3 2
2 4

output:

3 4

result:

wrong answer 1st numbers differ - expected: '8', found: '3'