QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#470225 | #6376. LaLa and Lamp | lichenyu_ac | WA | 1ms | 4832kb | C++14 | 737b | 2024-07-10 11:26:30 | 2024-07-10 11:26:31 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
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