QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#496741 | #9156. 百万富翁 | wsc2008 | 81.999975 | 2561ms | 82200kb | C++14 | 1.4kb | 2024-07-28 15:30:28 | 2024-07-28 15:30:29 |
Judging History
answer
#include "richest.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
vector<int>v;
void work(int k){
int n=v.size();
vector<vector<bool>>o;
vector<int>qa,qb;
for(int s=0;s<n;s+=k){
int len=min(k,n-s);
rep(i,s,s+len-1){
rep(j,i+1,s+len-1)qa.push_back(v[i]),qb.push_back(v[j]);
}
}
vector<int>qans=ask(qa,qb);
int cur=0;
vector<int>nv;
for(int s=0;s<n;s+=k){
int len=min(k,n-s);
vector<vector<bool>>o;
o.resize(len);
rep(i,0,len-1)o[i].resize(len);
rep(i,s,s+len-1){
rep(j,i+1,s+len-1){
if(qans[cur]==v[i])o[i-s][j-s]=1,o[j-s][i-s]=0;
else o[i-s][j-s]=0,o[j-s][i-s]=1;
cur++;
}
}
rep(i,s,s+len-1){
bool fl=1;
rep(j,s,s+len-1){
if(i==j)continue;
fl&=o[i-s][j-s];
}
if(fl){
nv.push_back(v[i]);
break;
}
}
}
v=nv;
}
int richest(int N, int T, int S) {
v.clear();
rep(i,0,N-1)v.push_back(i);
if(N==1000){
work(N);
return v[0];
}
work(2),work(2),work(2),work(2),work(3),work(6),work(19),work(v.size());
return v[0];
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 15
Accepted
time: 610ms
memory: 25184kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 67
Acceptable Answer
time: 2561ms
memory: 81980kb
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: 619ms
memory: 23680kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 67
Acceptable Answer
time: 2535ms
memory: 82200kb
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