QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#130114#5653. Library gameFffooooRE 0ms0kbC++201.3kb2023-07-23 16:43:042023-07-23 16:43:07

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:43:07]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2023-07-23 16:43:04]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=100,M=5000;
int n,m,a[N];
bool vis[N];
bool cmp(int x,int y) { return x>y; }
int solve() {
	sort(a+1,a+1+n,cmp);
	for(int i=1;i<=n;i++) if( a[i]>( m/i ) ) { return a[i]; }
	return 0;
}
int id=1;
pair<int,int> solve1( int p ) {
	vis[p]=true;
	int lent=0,x=1,y=0;
	for(int i=1;i<=m;i++) {
		if( vis[i] ) {
			if( lent>=a[id] && lent<y ) y=lent,x=i-lent+1;
			lent=0;
		}
		lent++;
	}
	return make_pair( a[id],x );
}
int di;
int solve2(  pair<int,int> z ) {
	int x=z.first,y=z.second;
	for(int i=x;i<=y;i++) if( i%di==0 ) return i;
	return x;
}
int main() {
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	di=solve();// cout<<di<<" ";
	if( di==0 ) {
		puts("Alessia");
		fflush(stdout);
		
		pair<int,int> ans=solve1(0);
		printf("%d %d\n",ans.first,ans.second);
		fflush(stdout);
		
		for(int i=2;i<=n;i++) {
			int x; scanf("%d",&x); id=i;
			ans=solve1(x);
			printf("%d %d\n",ans.first,ans.second);
			fflush(stdout);
		}
		int x; scanf("%d",x);
	} else {
		puts("Bernardo");
		fflush(stdout);
		for(int i=1;i<=n;i++) {
			int x,y; scanf("%d%d",&x,&y); di++;
			int ans=solve2( make_pair( x-y+1,y ) );
			printf("%d\n",ans);
			fflush(stdout);
		}
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Runtime Error

input:

5 14
3 7 2 3 10
7
7
2
2
2

output:

Alessia
10 1
7 1
3 1
3 1
2 1

result: