QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#130125 | #5653. Library game | bai_hong | WA | 0ms | 3680kb | C++20 | 1.3kb | 2023-07-23 16:58:12 | 2023-07-23 17:01:10 |
Judging History
answer
#include<bits/stdc++.h>
const int QWQ=5005;
using namespace std;
inline int read(){
char ch = getchar();int x = 0, f = 1;
while(ch<'0'||ch>'9'){if(ch == '-') f = -1;ch = getchar();}
while('0'<=ch && ch <= '9'){x = x*10+ch-'0';ch = getchar();}
return x*f;
}
inline void write(int x){
if(x <0)putchar('-'),x =-x;
if(x >9)write(x /10);
putchar(x %10+'0');
}
int n,m,a[QWQ],vis[QWQ];
bool cmp(int x,int y){ return x>y; }
bool cheak(){
sort(a+1,a+n+1,cmp);
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();
int can=cheak();
if (can){
puts("Bernardo");
fflush(stdout);
int x,l,r; bool fl=0;
for (int i=n;i;i--){
x=read(),l=read();
r=l+x-1,fl=0;
for (int j=l;j<=r;j++)
if(!(j%can)){ fl=1; printf("%d\n",j); break; }
if (!fl) printf("%d\n",l);
fflush(stdout);
}
} else{
puts("Alessia");
printf("%d %d\n",a[1],1);
fflush(stdout);
vis[m+1]=1; int x;
for (int i=2;i<=n;i++){
x=read(),vis[x]=1;
int tmp=114514,tp;
for (int j=1,last=0;j<=m+1;j++)
if (vis[j]){
if (j-last-1>=a[i]&&j-last-1<tmp)
tmp=j-last-1,tp=last+1;
last=j;
}
printf("%d %d\n",a[i],tp);
fflush(stdout);
} x=read();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3680kb
input:
5 14 3 7 2 3 10 7 14 2 4 6
output:
Alessia 10 1 7 8 3 1 3 3 2 5
result:
ok Contestant won the game
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3608kb
input:
4 10 4 1 6 4 6 1 4 2 4 3 1 4
output:
Bernardo 1 2 3 4
result:
wrong answer Judge won the game