QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#123422 | #5653. Library game | zswzswzsw | WA | 2ms | 5512kb | C++14 | 961b | 2023-07-12 16:10:37 | 2023-07-12 16:10:39 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=501000;
int n,m;
int A[N];
bool cmp(int x,int y){
return x>y;
}
int chk(void){
for(int i=1;i<=n;i++){
if(A[i]>m/i)return A[i];
}return 0;
}
int vis[N];
int main()
{
cin>>n>>m;
for(int i=1;i<=n;i++)cin>>A[i];
sort(A+1,A+n+1,cmp);
int B=chk();
if(!B){
puts("Alessia");
printf("%d %d\n",A[1],1);
fflush(stdout);
int x=0;vis[m+1]=1;
for(int i=2;i<=n-1;i++){
cin>>x;vis[x]=1;
int minn=m+5,p=0;
for(int j=1,lst=0;j<=m+1;j++)
if(vis[j]){
if(j-lst-1>=A[i]&&j-lst-1<minn)minn=j-lst-1,p=lst+1;
lst=j;
}
printf("%d %d\n",A[i],p);
fflush(stdout);
}cin>>x;
return 0;
}
else{
puts("Bernardo");
fflush(stdout);
for(int i=n,l,x,r;i>=1;i--){
cin>>l>>x;r=l+x-1;
bool tg=0;
for(int j=l;j<=r;j++)if(j%B==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: 2ms
memory: 5512kb
input:
5 14 3 7 2 3 10 7 14 2 4
output:
Alessia 10 1 7 8 3 1 3 3
result:
wrong answer format Unexpected end of file - int32 expected