QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#130132#5653. Library gameFffooooWA 1ms3708kbC++201.3kb2023-07-23 17:03:402023-07-23 17:05:27

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 17:05:27]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3708kb
  • [2023-07-23 17:03:40]
  • 提交

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;
	//cout<<x<<" "<<y<<" "<<di<<endl;
	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);
		
		printf("%d 1\n",a[1]);
		fflush(stdout);
		
		int x;
		for(int i=2;i<=n;i++) {
			scanf("%d",&x); id=i;
			pair<int,int> 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);
			int ans=solve2( make_pair( y,y+x-1 ) );
			printf("%d\n",ans);
			fflush(stdout);
		}
	}
	return 0;
}

详细

Test #1:

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

input:

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

output:

Alessia
10 1
7 8
3 2
3 4
2 2

result:

wrong answer Judge won the game