QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#86043 | #5653. Library game | zghtyarecrenj | WA | 2ms | 3456kb | C++14 | 1.5kb | 2023-03-09 09:58:48 | 2023-03-09 09:58:50 |
Judging History
answer
#include <bits/stdc++.h>
const int N = 105;
const int M = 5005;
int n, m, a[N], vis[M];
int main() {
std::ios::sync_with_stdio(false);
std::cin >> n >> m;
for (int i = 1; i <= n; ++i) std::cin >> a[i];
std::sort(a + 1, a + 1 + n, std::greater<int>());
bool flg = 0;
for (int i = 1; i <= n; ++i)
if (a[i] > m / i) { flg = 1; break; }
if (flg) { // B
std::cout << "Bernardo" << std::endl;
for (int i = 1; i <= n; ++i) {
int y, x; std::cin >> y >> x;
int fd = -1;
for (int j = x; j <= x + y - 1; ++j)
if (vis[j]) { fd = j; break; }
if (fd != -1) std::cout << fd << std::endl;
else {
int pos = ((x + y - 1) / y) * y;
if (pos <= x + y - 1) vis[pos] = 1, std::cout << pos << std::endl;
else vis[x] = 1, std::cout << x << std::endl;
}
}
} else { // A
std::cout << "Alessia" << std::endl;
std::set<int> vis;
vis.insert(m + 1);
for (int i = 1; i <= n; ++i) {
int lst = 0, res = -1;
for (int x : vis) {
if (x - lst - 1 >= a[i]) {
res = lst + 1;
break;
}
lst = x;
}
std::cout << a[i] << ' ' << res << std::endl;
int x; std::cin >> x;
vis.insert(x);
}
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 2ms
memory: 3456kb
input:
5 14 3 7 2 3 10 7 14 2 4 6
output:
Alessia 10 1 7 8 3 1 3 3 2 5
result:
ok Contestant won the game
Test #2:
score: -100
Wrong Answer
time: 2ms
memory: 3436kb
input:
4 10 4 1 6 4 6 1 4 7 4 1 1 5
output:
Bernardo 6 8 4 5
result:
wrong answer Judge won the game