QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#396759#4385. Randommegz112233TL 0ms0kbC++201021b2024-04-23 10:02:392024-04-23 10:02:39

Judging History

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

  • [2024-04-23 10:02:39]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2024-04-23 10:02:39]
  • 提交

answer

#include <bits/stdc++.h>

#define sz(x)  (int)x.size()
#define bigint __int128
#define el '\n'
#define ll long long
#define ld long double
using namespace std;
const int N = 500 + 10, M = 1e5 + 10, mod = 1e9 + 7;

void acc() {
    int n;
    cin >> n;
    vector<int> freq(n + 1);
    vector<array<int, 3>> v;
    for (int i = 0; i <= n; i++) {
        cin >> freq[i];
    }
    if (freq[0]) {
        cout << "Alice" << el;
        return;
    }
    for (int i = 1; i <= n; i++) {
        int diff = i - (int) log2(freq[i]);
        v.push_back({diff, i, freq[i]});
    }
    sort(v.begin(), v.end());
    bool can = 0;

    for (int i = 0; i < sz(v); i++) {
        int diff = v[i][0];
        if (diff - i <= 0) {
            can = 1;
        } else if (diff - i != 1) {
            break;
        }
    }
    if (can) {
        cout << "Alice" << el;
    } else {
        cout << "Bob" << el;
    }
}

int main() {
    int t = 1;
    cin >> t;
    while (t--)acc();
}

详细

Test #1:

score: 0
Time Limit Exceeded

input:

100000
42 30
6335 1161
19170 15725
11479 6401
26963 24465
5706 5322
23282 16828
9962 492
2996 2955
4828 609
32392 14605
3903 154
293 77
17422 1295
19719 177
5448 5383
14772 11539
1870 1213
25668 632
17036 9895
28704 23812
31323 30334
17674 4665
15142 7712
28254 6869
25548 2097
32663 95
20038 12860
8...

output:

Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
...

result: