QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#86043#5653. Library gamezghtyarecrenjWA 2ms3456kbC++141.5kb2023-03-09 09:58:482023-03-09 09:58:50

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-09 09:58:50]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3456kb
  • [2023-03-09 09:58:48]
  • 提交

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