QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#130175 | #5653. Library game | q | WA | 0ms | 3440kb | C++23 | 1.2kb | 2023-07-23 17:27:12 | 2023-07-23 17:27:12 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
struct BIT{
int n,c[5005];
void init(int x){
n=x;
}
int lowbit(int x){
return x&(-x);
}
void update(int x,int val){
for(;x<=n;x+=lowbit(x)){
c[x]+=val;
}
}
int ask(int x){
int res=0;
for(;x;x-=lowbit(x)){
res+=c[x];
}
return res;
}
int query(int x,int y){
return ask(y)-ask(x-1);
}
};
const int N=105,M=5005;
int n,m,a[N],ccc;
bool cmp1(int x,int y){
return x>y;
}
int check(){
sort(a+1,a+n+1,cmp1);
for(int i=1;i<=n;i++){
if(a[i]>m/i){
return a[i];
}
}
return 0;
}
bool vis[M];
void A(){
cout<<"Alessia\n"<<flush;
BIT t;
t.init(n);
for(int i=1;i<=n;i++){
for(int j=1;j<=m-a[i]+1;j++){
if(!t.query(j,j+a[i]-1)){
cout<<a[i]<<" "<<j<<"\n"<<flush;
break;
}
}
int b;
cin>>b;
t.update(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>>a[i];
}
ccc=check();
!ccc?A():B();
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3440kb
input:
5 14 3 7 2 3 10 7 7 2 4 6
output:
Alessia 10 1 7 1 3 1 3 3 2 5
result:
wrong answer Judge won the game