QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#508878 | #9156. 百万富翁 | Ecrade_ | 81.999975 | 4226ms | 102272kb | C++14 | 1.2kb | 2024-08-07 21:06:14 | 2024-08-07 21:06:15 |
Judging History
answer
#include "richest.h"
#include <bits/stdc++.h>
using namespace std;
void work(int &n,int x,vector <int> &now){
vector <int> a,b,c,d,tmp;
for (int i = 0;i < n - x + 1;i += x){
for (int j = 0;j < x;j += 1) for (int k = j + 1;k < x;k += 1){
a.emplace_back(now[i + j]);
b.emplace_back(now[i + k]);
}
}
for (int i = n / x * x;i < n;i += 1) d.emplace_back(now[i]);
int rem = d.size();
for (int i = 0;i < rem;i += 1) for (int j = i + 1;j < rem;j += 1){
a.emplace_back(d[i]);
b.emplace_back(d[j]);
}
c = ask(a,b);
map <int,int> cnt;
int qwq = 0;
for (int i = 0;i < n - x + 1;i += x,qwq += x * (x - 1) / 2){
for (int j = 0;j < x * (x - 1) / 2;j += 1) cnt[c[qwq + j]] += 1;
for (int j = 0;j < x;j += 1) if (cnt[now[i + j]] == x - 1){tmp.emplace_back(now[i + j]); break;}
}
cnt.clear();
for (int i = 0;i < rem * (rem - 1) / 2;i += 1) cnt[c[qwq + i]] += 1;
for (int i = 0;i < rem;i += 1) if (cnt[d[i]] == rem - 1){tmp.emplace_back(d[i]); break;}
swap(tmp,now),n = now.size();
}
int richest(int n,int t,int s){
vector <int> a;
for (int i = 0;i < n;i += 1) a.emplace_back(i);
if (n == 1000) work(n,n,a);
else work(n,2,a),work(n,2,a),work(n,2,a),work(n,2,a),work(n,3,a),work(n,6,a),work(n,19,a),work(n,n,a);
return a[0];
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 15
Accepted
time: 718ms
memory: 23180kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 67
Acceptable Answer
time: 4215ms
memory: 102272kb
input:
1000000 20 2000000 29091473
output:
Partially correct Case 2, 67 / 85, maxt = 8, maxs = 1099960 2586970244946203279 0.788235 12006835993993373281
result:
points 0.788235 Partially correct Case 2, 67 / 85, maxt = 8, maxs = 1099960
Final Tests
Test #1:
score: 15
Accepted
time: 732ms
memory: 25444kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 67
Acceptable Answer
time: 4226ms
memory: 102260kb
input:
1000000 20 2000000 29091471
output:
Partially correct Case 2, 67 / 85, maxt = 8, maxs = 1099960 2586970244946203279 0.788235 12006835993993373281
result:
points 0.788235 Partially correct Case 2, 67 / 85, maxt = 8, maxs = 1099960