QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#469860#8008. Fortune Wheelyqh2025WA 23ms4896kbC++14754b2024-07-10 08:25:172024-07-10 08:25:17

Judging History

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

  • [2024-07-30 15:38:33]
  • hack成功,自动添加数据
  • (/hack/759)
  • [2024-07-10 08:25:17]
  • 评测
  • 测评结果:WA
  • 用时:23ms
  • 内存:4896kb
  • [2024-07-10 08:25:17]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int n,m,st,k[N];
int dis[N];
pair<int,int>pa[N];
int main(){
	scanf("%d%d%d",&n,&st,&m);
	for(int i=1;i<=m;i++){
		scanf("%d",&k[i]);
	}
	memset(dis,127,sizeof(dis));
	dis[0]=dis[n]=0;
	for(int t=1;t<=m;t++){
		for(int i=0;i<=n;i++){
			int j=(i-k[t]+n)%n;
			dis[j]=min(dis[j],dis[i]+1);
		}	
	}
	for(int i=0;i<n;i++)pa[i]={dis[i],i};
	sort(pa,pa+n);
	int xs;for(int i=0;i<n;i++)if(pa[i].second==st)xs=i;
	int ans1=1e8,ans2=1,sum=0;
	for(int i=0;i<n;i++){
		int an1,an2;sum+=pa[i].first;
		if(xs<=i){
			an1=dis[st],an2=1;
		}
		else{
			an1=n+sum;an2=i+1;
		}
		if(ans1*an2>an1*ans2){
			ans1=an1,ans2=an2;
		}
	}
	cout<<ans1<<" "<<ans2;
	return 0;
}

详细

Test #1:

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

input:

6 3 2
2 4

output:

8 3

result:

ok 2 number(s): "8 3"

Test #2:

score: 0
Accepted
time: 1ms
memory: 4220kb

input:

5 4 1
1

output:

1 1

result:

ok 2 number(s): "1 1"

Test #3:

score: 0
Accepted
time: 23ms
memory: 4896kb

input:

99999 65238 100
64714 45675 36156 13116 93455 22785 10977 60219 14981 25839 83709 80404 41400 12469 31530 65521 35436 20326 96792 50699 27522 98233 26187 12509 90992 72693 83919 74145 80892 68422 38333 33497 89154 88403 77492 4570 3908 59194 3482 89871 96330 45114 5555 73987 95832 476 949 74649 2084...

output:

3 1

result:

ok 2 number(s): "3 1"

Test #4:

score: -100
Wrong Answer
time: 1ms
memory: 4300kb

input:

10000 23 7
9594 8998 9330 6851 1662 6719 583

output:

42613 4146

result:

wrong answer 1st numbers differ - expected: '42726', found: '42613'