QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#130217 | #5653. Library game | q | WA | 0ms | 3472kb | C++23 | 974b | 2023-07-23 18:12:33 | 2023-07-23 18:12:35 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=105,M=5005;
int n,m,c[N],ccc;
bool cmp1(int x,int y){
return x>y;
}
int check(){
sort(c+1,c+n+1,cmp1);
for(int i=1;i<=n;i++){
if(c[i]>m/i){
return c[i];
}
}
return 0;
}
bool vis[M];
void A(){
cout<<"Alessia\n"<<flush;
vis[m+1]=1;
for(int i=1;i<=n;i++){
int lst=1,a=0,y=m+1;
for(int j=1;j<=m+1;j++){
if(vis[j]){
if(j-lst-1>=c[i]&&j-lst-1<y){
y=j-lst-1,a=lst+1;
}
lst=j;
}
}
cout<<c[i]<<" "<<a<<"\n"<<flush;
int b;
cin>>b;
vis[b]=1;
}
}
void B(){
cout<<"Bernardo\n"<<flush;
for(int i=1;i<=n;i++){
int y,a;
cin>>y>>a;
int l=a,r=a+y-1,ans=0;
for(int j=l;j<=r;j++){
if(j%ccc==0){
ans=i;
break;
}
}
cout<<ans<<"\n"<<flush;
}
}
int main(){
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
cin>>n>>m;
for(int i=1;i<=n;i++){
cin>>c[i];
}
ccc=check();
!ccc?A():B();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3384kb
input:
5 14 3 7 2 3 10 7 14 3 5 9
output:
Alessia 10 2 7 8 3 2 3 4 2 8
result:
ok Contestant won the game
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3472kb
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