QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#490025 | #9156. 百万富翁 | strcmp# | 15 | 635ms | 27356kb | C++14 | 897b | 2024-07-25 10:28:24 | 2024-07-25 10:28:24 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#include "richest.h"
#define rep(i, a, b) for(int i = a; i <= b; i++)
using vec = vector<int>;
constexpr int maxn = 2e6 + 10;
#define ps push_back
vec p, np; int n, t, s, cnt[maxn];
int qry(int l, int r) {
vec a, b;
for (int i = l; i < r; i++) {
for (int j = i + 1; j <= r; j++) a.ps(p[i]), b.ps(p[j]);
}
vec c = ask(a, b); int ans = 0;
for (int i = 0; i < c.size(); i++) {
++cnt[c[i]];
if (cnt[c[i]] == r - l) ans = c[i];
}
for (int i = 0; i < c.size(); i++) --cnt[c[i]];
return ans;
}
void divide(int k) {
for (int i = 0; i < n - 1; i += k) {
int j = min(i + k - 1, n - 1);
np.ps(qry(i, j));
}
p = np; n = p.size(); np.clear();
}
int richest(int N, int T, int S) {
n = N, t = T, s = S;
for (int i = 0; i < n; i++) p.ps(i);
//for (int i = 1; i < t; i++) divide(2);
return qry(0, n - 1);
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 15
Accepted
time: 619ms
memory: 27304kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 0
Memory Limit Exceeded
input:
1000000 20 2000000 29091473
output:
Unauthorized output
result:
Final Tests
Test #1:
score: 15
Accepted
time: 635ms
memory: 27356kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 0
Memory Limit Exceeded
input:
1000000 20 2000000 29091471
output:
Unauthorized output