QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#470225#6376. LaLa and Lamplichenyu_acWA 1ms4832kbC++14737b2024-07-10 11:26:302024-07-10 11:26:31

Judging History

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

  • [2024-07-10 11:26:31]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:4832kb
  • [2024-07-10 11:26:30]
  • 提交

answer

#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
const int N=1e5+10;

int S,T;
int n,m,a[N];

bool v[N];
ll d[N];

int main(){
	scanf("%d%d%d",&n,&S,&m);
	for(int i=1;i<=m;i++)scanf("%d",&a[i]),a[i]%=n;
	
	memset(d,0x3f,sizeof(d));
	d[0]=0,d[n]=0;
	queue<int>q;
	q.push(0);
	while(q.size()){
		int x=q.front();q.pop();
		for(int i=1;i<=m;i++){
			int y=(x-a[i]+n)%n;
			if(d[y]>=1e9){
				d[y]=d[x]+1;
				q.push(y);
			}
		}
	}
	
	ll up=min(d[S],(ll)n),down=1;
	sort(d+1,d+n+1);
	ll sum=0;
	for(int i=1;i<n;i++){
		if(d[i]>=1e9)break;
		sum+=d[i];
		if(up*i>(sum+n)*down){
			up=sum+n;
			down=i;
		}
	}
	ll D=__gcd(up,down);
	printf("%lld %lld\n",up/D,down/D);
	return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 4832kb

input:

6
0
00
000
0110
00100
000000

output:

0 1

result:

wrong output format YES or NO expected, but 0 found