QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#130217#5653. Library gameqWA 0ms3472kbC++23974b2023-07-23 18:12:332023-07-23 18:12:35

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-23 18:12:35]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3472kb
  • [2023-07-23 18:12:33]
  • 提交

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