QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#130109#5653. Library gamexinhaowenWA 1ms3808kbC++141.1kb2023-07-23 16:39:422023-07-23 16:39:44

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 16:39:44]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3808kb
  • [2023-07-23 16:39:42]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
inline int read(){
    char ch=getchar();int sum=0,f=1;
    while(!isdigit(ch))f=(ch=='-')?-1:1,ch=getchar();
    while(isdigit(ch))sum=(sum<<1)+(sum<<3)+(ch^48),ch=getchar();
    return sum*f;
}
int n,m,a[104],vis[5004];
//fflush(stdout);
int check(){
	for(int i=1;i<=n;++i)
		if(a[i]>m/i)return a[i];
	return 0;
}
signed main(){
	n=read();m=read();
	for(int i=1;i<=n;++i)a[i]=read();
	sort(a+1,a+n+1);int hutao=check();
	if(!hutao){
		puts("Alessia");
		printf("%d %d\n",a[1],1);
		fflush(stdout);
		int x=0;vis[m+1]=1;
		for(int i=2;i<=n;i++){
			x=read();vis[x]=1;
			int minn=m+5,p=0;
			for(int j=1,last=0;j<=m+1;j++)
				if(vis[j]){
					if(j-last-1>=a[i]&&j-last-1<minn)minn=j-last-1,p=last+1;
					last=j;
				}
			printf("%d %d\n",a[i],p);
			fflush(stdout);
		}
		x=read();
	}
	else{
		puts("Bernardo");
		fflush(stdout);
		for(int i=n,l,x,r;i>=1;i--){
			cin>>x>>l;r=l+x-1;
			bool tg=0;
			for(int j=l;j<=r;j++)if(j%hutao==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: 1ms
memory: 3808kb

input:

5 14
3 7 2 3 10
10 1
7 8
3 1
3 2
2 3

output:

Bernardo
7
14
1
2
3

result:

wrong answer Judge won the game