QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#537861 | #9156. 百万富翁 | aufan# | 8.99997 | 3590ms | 113096kb | C++17 | 1.3kb | 2024-08-30 19:09:57 | 2024-08-30 19:09:57 |
Judging History
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);
while ((int)pos.size() >= 3) {
vector<int> a, b;
for (int i = 2; i < (int)pos.size(); i += 3) {
a.push_back(pos[i - 2]);
b.push_back(pos[i - 1]);
a.push_back(pos[i - 1]);
b.push_back(pos[i]);
a.push_back(pos[i]);
b.push_back(pos[i - 2]);
}
vector<int> ret = ask(a, b), npos;
for (int i = 0; i < (int)ret.size(); i += 3) {
if (ret[i] == ret[i + 1]) {
npos.push_back(ret[i]);
}
if (ret[i] == ret[i + 2]) {
npos.push_back(ret[i]);
}
if (ret[i + 1] == ret[i + 2]) {
npos.push_back(ret[i + 2]);
}
}
while ((int)pos.size() % 3 != 0) {
npos.push_back(pos.back());
pos.pop_back();
}
swap(pos, npos);
}
if ((int)pos.size() == 2) {
vector<int> a, b;
a.push_back(pos[0]);
b.push_back(pos[1]);
vector<int> ret = ask(a, b);
pos = ret;
}
return pos[0];
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 0
Wrong Answer
time: 1ms
memory: 8124kb
input:
1000 1 499500 957319859
output:
Too many queries 1294109832092195181 0.000000 6906350380861515327
result:
points 0.0 Too many queries
Pretest #2:
score: 8.99997
Acceptable Answer
time: 3590ms
memory: 113096kb
input:
1000000 20 2000000 29091473
output:
Partially correct Case 2, 9 / 85, maxt = 13, maxs = 1499998 2950498068978493917 0.105882 16926627793318235567
result:
points 0.105882 Partially correct Case 2, 9 / 85, maxt = 13, maxs = 1499998
Final Tests
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 7992kb
input:
1000 1 499500 957319857
output:
Too many queries 1294109832092195181 0.000000 6906350380861515327
result:
points 0.0 Too many queries
Test #2:
score: 8.99997
Acceptable Answer
time: 3548ms
memory: 105172kb
input:
1000000 20 2000000 29091471
output:
Partially correct Case 2, 9 / 85, maxt = 13, maxs = 1499998 2950498068978493917 0.105882 16926627793318235567
result:
points 0.105882 Partially correct Case 2, 9 / 85, maxt = 13, maxs = 1499998