QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#130307 | #5653. Library game | cqzhm | WA | 2ms | 3656kb | C++14 | 1.1kb | 2023-07-23 20:15:42 | 2023-07-23 20:15:44 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int MAXN=5e3+10;
int n,m,imp;
int a[MAXN];
inline bool cmp(int x,int y){return x>y;}
inline int solve(){
sort(a+1,a+n+1,cmp);
for(int i=1;i<=n;i++)
if(a[i]>m/i) return a[i];
return -1;
}
bool vis[MAXN];
int id;
inline int solve1(int k){
vis[k]=true;
int x=0,las=0,minn=1e9;
for(int i=1;i<=m+1;i++){
if(vis[i]){
if(i-las-1>=a[id] && i-las-1<minn)
x=las+1,minn=i-las-1;
las=i;
}
}
return x;
}
inline int solve2(int l,int r){
for(int i=l;i<=r;i++) if(i%imp==0) return i;
return l;
}
int main(){
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++) scanf("%d",&a[i]);
imp=solve();
if(imp==-1){
printf("Alessia\n"); fflush(stdout);
printf("%d 1\n",a[1]); fflush(stdout);
int x;
for(int i=2;i<=n;i++){
scanf("%d",&x); id=i;
printf("%d %d\n",a[i],solve1(x));
fflush(stdout);
}
scanf("%d",&x);
}
else{
printf("Bernardo\n"); fflush(stdout);
for(int i=1;i<=n;i++){
int x,y; scanf("%d%d",&x,&y);
int ans=solve2(y,y+x-1);
printf("%d\n",ans); fflush(stdout);
}
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3656kb
input:
5 14 3 7 2 3 10 7
output:
Alessia 10 1 7 0
result:
wrong answer Integer 0 violates the range [1, 8]