QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#510253 | #9156. 百万富翁 | Franuch | 11.00002 | 4522ms | 99272kb | C++17 | 1.6kb | 2024-08-09 00:38:20 | 2024-08-09 00:38:21 |
Judging History
answer
#include "richest.h"
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
//vector<ll> W;
//ll ct = 0, cs = 0;
//vector<ll> ask(vector<ll> a, vector<ll> b) {
// assert(a.size() == b.size());
// ct++;
// cs += (ll)a.size();
//
// vector<ll> c(a.size());
// for (ll i = 0; i < a.size(); i++) {
// assert(a[i] != b[i]);
// if (W[a[i]] > W[b[i]])
// c[i] = a[i];
// else
// c[i] = b[i];
// }
// return c;
//}
ll on(ll n) {
mt19937 rng(23);
vector<ll> p(n);
std::iota(p.begin(), p.end(), 0);
while (n > 1) {
std::shuffle(p.begin(), p.end(), rng);
vector<ll> a(n / 2), b(n / 2);
for (ll i = 0; i + 1 < n; i += 2)
a[i / 2] = p[i], b[i / 2] = p[i + 1];
a = ask(a, b);
if (n % 2 == 1)
a.push_back(p.back());
p = a;
n = (ll)p.size();
}
return p[0];
}
ll richest(ll N, ll T, ll S) {
return on(N);
}
//ll main() {
// random_device rd;
// mt19937 rng(rd());
//
// ll mt = 0, ms = 0;
// ll t = 100;
// while (t--) {
// ll N = 1'000'000, T = 20, S = 2'000'000;
// W.resize(N);
// std::iota(W.begin(), W.end(), 0);
// shuffle(W.begin(), W.end(), rng);
//
// ct = 0, cs = 0;
// richest(N, T, S);
// cout << ct << " " << cs << "\n";
// ms = max(ms, cs);
// mt = max(mt, ct);
// }
//
// cout << "\n\n" << mt << " " << ms << "\n";
//
// return 0;
//
//}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 0
Wrong Answer
time: 0ms
memory: 8104kb
input:
1000 1 499500 957319859
output:
Too many queries 1294109832092195181 0.000000 6906350380861515327
result:
points 0.0 Too many queries
Pretest #2:
score: 11
Acceptable Answer
time: 4433ms
memory: 99272kb
input:
1000000 20 2000000 29091473
output:
Partially correct Case 2, 11 / 85, maxt = 20, maxs = 999999 1811468636458994965 0.129412 3823502568050958645
result:
points 0.129412 Partially correct Case 2, 11 / 85, maxt = 20, maxs = 999999
Final Tests
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 7988kb
input:
1000 1 499500 957319857
output:
Too many queries 1294109832092195181 0.000000 6906350380861515327
result:
points 0.0 Too many queries
Test #2:
score: 11
Acceptable Answer
time: 4522ms
memory: 95344kb
input:
1000000 20 2000000 29091471
output:
Partially correct Case 2, 11 / 85, maxt = 20, maxs = 999999 1811468636458994965 0.129412 3823502568050958645
result:
points 0.129412 Partially correct Case 2, 11 / 85, maxt = 20, maxs = 999999