QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#506756 | #9156. 百万富翁 | jijidawang | 0 | 193ms | 166928kb | C++20 | 1.9kb | 2024-08-05 21:19:36 | 2024-08-05 21:19:36 |
Judging History
answer
#include "richest.h"
#include <bits/stdc++.h>
namespace // my guiding star
{
#define filein(x) freopen(x".in", "r", stdin);
#define fileout(x) freopen(x, "w", stdout);
#define fileerr(x) freopen(x, "w", stderr);
#define file(x) freopen(x".in", "r", stdin), freopen(x".out", "w", stdout);
#define files(x) freopen(x".in", "r", stdin), freopen(x".ans", "w", stdout);
using namespace std;
#define cT const T&
template<typename T>
inline T chkmin(T& x, cT y){if (x > y) x = y; return x;}
template<typename T>
inline T chkmax(T& x, cT y){if (x < y) x = y; return x;}
template <typename T>
inline bool inrange(cT x, cT l, cT r){return (l <= x) && (x <= r);}
template <typename T>
inline bool inrange(cT l, cT r, cT L, cT R){return (L <= l) && (r <= R);}
#undef cT
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef unsigned u32;
template <typename T>
using pr = pair<T, T>;
typedef pr<int> pii;
typedef pr<ll> pll;
typedef pr<db> pdd;
typedef complex<double> cp;
typedef vector<int> vi;
inline void YN(bool x){puts(x ? "Yes" : "No");}
}
const int N = 1e6 + 233;
int p[10] = {500000, 250000, 125000, 62500, 20833, 3472, 183, 1};
bool ban[N];
int solve(vector<int> A, int d)
{
int n = A.size();
if (n == 1) return A[0];
vector<int> P, Q;
int d1 = n / p[d], d2 = n % p[d];
for (int i=0, c=1; i<n; i++, c++)
{
int r = i + d1 - (c > d2);
for (int j=i; j<r; j++)
for (int k=j+1; k<=r; k++) P.emplace_back(A[j]), Q.emplace_back(A[k]);
i = r;
}
vector<int> R = ask(P, Q);
for (auto x : A) ban[x] = false;
for (int i=0; i<P.size(); i++) ban[P[i] + Q[i] - R[i]] = false;
vector<int> v;
for (auto x : A)
if (!ban[x]) v.emplace_back(x);
return solve(v, d + 1);
}
int richest(int n, int T, int S)
{
if (n <= 1000) p[0] = 1;
vector<int> A(n); iota(A.begin(), A.end(), 0);
return solve(A, 0);
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 0
Wrong Answer
time: 49ms
memory: 22180kb
input:
1000 1 499500 957319859
output:
Too many queries 1294109832092195181 0.000000 6906350380861515327
result:
points 0.0 Too many queries
Pretest #2:
score: 0
Wrong Answer
time: 193ms
memory: 166928kb
input:
1000000 20 2000000 29091473
output:
Too many total elements in queries 1469670942222006797 0.000000 6906350380861515327
result:
points 0.0 Too many total elements in queries
Final Tests
Test #1:
score: 0
Wrong Answer
time: 61ms
memory: 20024kb
input:
1000 1 499500 957319857
output:
Too many queries 1294109832092195181 0.000000 6906350380861515327
result:
points 0.0 Too many queries
Test #2:
score: 0
Wrong Answer
time: 183ms
memory: 164260kb
input:
1000000 20 2000000 29091471
output:
Too many total elements in queries 1469670942222006797 0.000000 6906350380861515327
result:
points 0.0 Too many total elements in queries