QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#537896 | #9156. 百万富翁 | aufan# | 0 | 1ms | 8248kb | C++17 | 817b | 2024-08-30 19:31:13 | 2024-08-30 19:31:13 |
answer
#include "richest.h"
#include <bits/stdc++.h>
using namespace std;
int richest(int n, int t, int s) {
vector<int> pos;
for (int i = 0; i < n; i++) pos.push_back(i);
vector<int> cnt(n);
while ((int)pos.size() > 1) {
vector<int> a, b;
for (int i = 0; i < (int)pos.size(); i++) {
a.push_back(pos[i]);
b.push_back(pos[(i + 1) % (int)pos.size()]);
}
vector<int> ret = ask(a, b), npos;
for (int i = 0; i < (int)ret.size(); i++) {
cnt[ret[i]] += 1;
if (cnt[ret[i]] == 2) {
npos.push_back(ret[i]);
}
}
for (int i = 0; i < (int)ret.size(); i++) {
cnt[ret[i]] -= 1;
}
swap(pos, npos);
}
return pos[0];
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 0
Wrong Answer
time: 1ms
memory: 8248kb
input:
1000 1 499500 957319859
output:
Too many queries 1294109832092195181 0.000000 6906350380861515327
result:
points 0.0 Too many queries
Pretest #2:
score: 0
Time Limit Exceeded
input:
1000000 20 2000000 29091473
output:
Unauthorized output
result:
Final Tests
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 8216kb
input:
1000 1 499500 957319857
output:
Too many queries 1294109832092195181 0.000000 6906350380861515327
result:
points 0.0 Too many queries
Test #2:
score: 0
Time Limit Exceeded
input:
1000000 20 2000000 29091471
output:
Unauthorized output