QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#130308#5653. Library gamecqzhmWA 1ms3716kbC++141.1kb2023-07-23 20:17:492023-07-23 20:17:52

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 20:17:52]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3716kb
  • [2023-07-23 20:17:49]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int MAXN=5e3+10; 
int n,m,imp;
int a[MAXN];
inline bool cmp(int x,int y){return x>y;}
inline int solve(){
	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=n;i++)
		if(a[i]>m/i) return a[i];
	return -1;
}
bool vis[MAXN];
int id;
inline int solve1(int k){
	vis[k]=true;
	int x=0,las=0,minn=1e9;
	for(int i=1;i<=m+1;i++){
		if(vis[i]){
			if(i-las-1>=a[id] && i-las-1<minn) 
				x=las+1,minn=i-las-1;
			las=i;
		}
	}
	return x;
}
inline int solve2(int l,int r){
	for(int i=l;i<=r;i++) if(i%imp==0) return i;
	return l;
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	imp=solve();
	if(imp==-1){
		printf("Alessia\n"); fflush(stdout);
		printf("%d %d\n",a[1],m-a[1]+1); fflush(stdout);
		int x;
		for(int i=2;i<=n;i++){
			scanf("%d",&x); id=i;
			printf("%d %d\n",a[i],solve1(x)); 
			fflush(stdout);
		}
		scanf("%d",&x);
	}
	else{
		printf("Bernardo\n"); fflush(stdout);
		for(int i=1;i<=n;i++){
			int x,y; scanf("%d%d",&x,&y);
			int ans=solve2(y,y+x-1);
			printf("%d\n",ans); fflush(stdout);
		}
	}
	return 0;
}

详细

Test #1:

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

input:

5 14
3 7 2 3 10
7

output:

Alessia
10 5
7 0

result:

wrong answer Integer 0 violates the range [1, 8]