QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#130109 | #5653. Library game | xinhaowen | WA | 1ms | 3808kb | C++14 | 1.1kb | 2023-07-23 16:39:42 | 2023-07-23 16:39:44 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
inline int read(){
char ch=getchar();int sum=0,f=1;
while(!isdigit(ch))f=(ch=='-')?-1:1,ch=getchar();
while(isdigit(ch))sum=(sum<<1)+(sum<<3)+(ch^48),ch=getchar();
return sum*f;
}
int n,m,a[104],vis[5004];
//fflush(stdout);
int check(){
for(int i=1;i<=n;++i)
if(a[i]>m/i)return a[i];
return 0;
}
signed main(){
n=read();m=read();
for(int i=1;i<=n;++i)a[i]=read();
sort(a+1,a+n+1);int hutao=check();
if(!hutao){
puts("Alessia");
printf("%d %d\n",a[1],1);
fflush(stdout);
int x=0;vis[m+1]=1;
for(int i=2;i<=n;i++){
x=read();vis[x]=1;
int minn=m+5,p=0;
for(int j=1,last=0;j<=m+1;j++)
if(vis[j]){
if(j-last-1>=a[i]&&j-last-1<minn)minn=j-last-1,p=last+1;
last=j;
}
printf("%d %d\n",a[i],p);
fflush(stdout);
}
x=read();
}
else{
puts("Bernardo");
fflush(stdout);
for(int i=n,l,x,r;i>=1;i--){
cin>>x>>l;r=l+x-1;
bool tg=0;
for(int j=l;j<=r;j++)if(j%hutao==0){tg=1;printf("%d\n",j);break;}
if(!tg)printf("%d\n",l);
fflush(stdout);
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3808kb
input:
5 14 3 7 2 3 10 10 1 7 8 3 1 3 2 2 3
output:
Bernardo 7 14 1 2 3
result:
wrong answer Judge won the game