QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#130132 | #5653. Library game | Fffoooo | WA | 1ms | 3708kb | C++20 | 1.3kb | 2023-07-23 17:03:40 | 2023-07-23 17:05:27 |
Judging History
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