QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#130116#5653. Library gameFffooooWA 1ms3748kbC++201.3kb2023-07-23 16:48:502023-07-23 16:48:51

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:48:51]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3748kb
  • [2023-07-23 16:48:50]
  • 提交

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=0x3f3f3f3f;
	for(int i=1;i<=m+1;i++) {
		if( vis[i] ) {
			//cout<<lent<<" "<<endl;
			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); vis[m+1]=true;
	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);
		
		int x;
		for(int i=2;i<=n;i++) {
			scanf("%d",&x); id=i;
			ans=solve1(x);
			printf("%d %d\n",ans.first,ans.second);
			fflush(stdout);
		}
		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;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3748kb

input:

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

output:

Alessia
10 2
7 8
3 2
3 4
2 2

result:

wrong answer Judge won the game