QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#130219 | #5653. Library game | q | WA | 1ms | 3608kb | C++23 | 974b | 2023-07-23 18:15:15 | 2023-07-23 18:15:19 |
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=0,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=j;
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: 1ms
memory: 3608kb
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: 1ms
memory: 3592kb
input:
4 10 4 1 6 4 6 1 4 5 4 6 1 9
output:
Bernardo 4 8 8 0
result:
wrong answer Integer 0 violates the range [9, 9]