QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#123421#5653. Library gamezswzswzswWA 2ms3712kbC++14961b2023-07-12 16:09:512023-07-12 16:09:53

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-12 16:09:53]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3712kb
  • [2023-07-12 16:09:51]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=501000;
int n,m;
int A[N];
bool cmp(int x,int y){
	return x>y;
}
int chk(void){
	for(int i=1;i<=n;i++){
		if(A[i]>m/i)return A[i];
	}return 0;
}
int vis[N];
int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++)cin>>A[i];
	sort(A+1,A+n+1,cmp);
	int B=chk();
	if(!B){
		puts("Alessia");
		printf("%d %d\n",1,A[1]);
		fflush(stdout);
		int x=0;vis[m+1]=1;
		for(int i=2;i<=n-1;i++){
			cin>>x;vis[x]=1;
			int minn=m+5,p=0;
			for(int j=1,lst=0;j<=m+1;j++)
				if(vis[j]){
					if(j-lst-1>=A[i]&&j-lst-1<minn)minn=j-lst-1,p=lst+1;
					lst=j;
				}
			printf("%d %d\n",A[i],p);
			fflush(stdout);
		}cin>>x;
		return 0;
	}
	else{
		puts("Bernardo");
		fflush(stdout);
		for(int i=n,l,x,r;i>=1;i--){
			cin>>l>>x;r=l+x-1;
			bool tg=0;
			for(int j=l;j<=r;j++)if(j%B==0){tg=1;printf("%d\n",j);break;}
			if(!tg)printf("%d\n",l);
			fflush(stdout);
		}
	}return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3712kb

input:

5 14
3 7 2 3 10

output:

Alessia
1 10

result:

wrong answer Chosen an invalid y