QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#130219#5653. Library gameqWA 1ms3608kbC++23974b2023-07-23 18:15:152023-07-23 18:15:19

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:15:19]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3608kb
  • [2023-07-23 18:15:15]
  • 提交

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]