QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#469458 | #8008. Fortune Wheel | 11d10xy | WA | 52ms | 4936kb | C++14 | 652b | 2024-07-09 19:24:54 | 2024-07-09 19:24:54 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
using i64=long long;
int n,m,X,dis[100010];
i64 ds[100010],ans1,ans2;
auto upd=[](i64 p,i64 q){
i64 d=__gcd(p,q);p/=d,q/=d;
if((long double)p/q<(long double)ans1/ans2)ans1=p,ans2=q;
};
int main(){
memset(dis,0x3f,sizeof(dis));
cin>>n>>X>>m;
dis[0]=0;
for(int k;m--;){
scanf("%d",&k);
for(int l=n/__gcd(n,k),p=(n-k)%n;l--;p=(p-k)%n)dis[p]=min(dis[p],dis[(p+k)%n]+1);
}
ans1=dis[X],ans2=1;
sort(dis,dis+n);
ds[0]=dis[0];for(int i=1;i<n;i++)ds[i]=ds[i-1]+dis[i];
for(int i=0;i<n;i++)upd(ds[i]+n,i+1);
cout<<ans1<<' '<<ans2;
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
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: 4116kb
input:
5 4 1 1
output:
1 1
result:
ok 2 number(s): "1 1"
Test #3:
score: -100
Wrong Answer
time: 52ms
memory: 4936kb
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:
134375 852
result:
wrong answer 1st numbers differ - expected: '3', found: '134375'