QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#396759 | #4385. Random | megz112233 | TL | 0ms | 0kb | C++20 | 1021b | 2024-04-23 10:02:39 | 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 ...