QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#535618 | #9156. 百万富翁 | lyx123886a123886# | 91.00003 | 2087ms | 103276kb | C++14 | 2.4kb | 2024-08-28 11:12:11 | 2024-08-28 11:12:11 |
Judging History
answer
#include "richest.h"
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define pi pair<int,int>
#define vp vector<pi>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define pb push_back
namespace solution {
int N,T,S;
const int MAXN=1e6+50;
vi V;//node_set
namespace Query {
bool ban[MAXN];
vi qry(vp e) {
vi result;
for(int u:V) ban[u]=false;
vi a,b;
for(auto i:e) a.pb(i.first),b.pb(i.second);
vi c=ask(a,b);
for(int i=0;i<e.size();++i) {
ban[a[i]^b[i]^c[i]]=true;
}
for(int u:V) if(!ban[u]) result.pb(u);
return result;
}
};using Query::qry;
namespace sub1 {
int sol() {
vp e;rep(i,0,N-1) rep(j,0,i-1) e.pb({i,j});
vi ans=qry(e);
assert(ans.size()==1);
return ans.back();
}
bool check() {return N==1000;}
};
namespace tuan {//cool!!
const int per[9]={-1,181,19,6,3,2,2,2,2};
const int A[9]={-1,1,14,1,1,0,0,0,0};
const int B[9]={-1,0,168,3471,20832,62500,125000,250000,500000};
int sol() {
for(int k=8;k&&V.size()>1;k--) {
vp e;
int y=V.size();
int siz=per[k];
int n=per[k]*B[k]+(per[k]+1)*A[k];
assert(n>=y);
int last=0;//begin from 0
for(int i=1;i<=A[k];++i) {//big
int l=last,r=last+siz+1;//[l,r)
last=r;
rep(j,l,r-1) rep(k,l,j-1) if(j<y&&k<y) e.pb({V[j],V[k]});
}
for(int i=1;i<=B[k];++i) {//small
int l=last,r=last+siz;
last=r;
rep(j,l,r-1) rep(k,l,j-1) if(j<y&&k<y) e.pb({V[j],V[k]});
}
V=qry(e);
}
assert(V.size()==1);
return V[0];
}
};
int solve() {
V.resize(N);rep(i,0,N-1) V[i]=i;
if(sub1::check()) return sub1::sol();
return tuan::sol();
return -1;//failed
}
};
#undef rep
#undef vi
#undef pi
#undef vp
#undef pb
int richest(int N, int T, int S) {
solution::N=N,solution::T=T,solution::S=S;
return solution::solve() ;
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 15
Accepted
time: 650ms
memory: 29352kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 76
Acceptable Answer
time: 2087ms
memory: 103276kb
input:
1000000 20 2000000 29091473
output:
Partially correct Case 2, 76 / 85, maxt = 8, maxs = 1099947 708834003727782761 0.894118 11625001216319896173
result:
points 0.894118 Partially correct Case 2, 76 / 85, maxt = 8, maxs = 1099947
Final Tests
Test #1:
score: 15
Accepted
time: 652ms
memory: 31120kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 76
Acceptable Answer
time: 2082ms
memory: 103104kb
input:
1000000 20 2000000 29091471
output:
Partially correct Case 2, 76 / 85, maxt = 8, maxs = 1099947 708834003727782761 0.894118 11625001216319896173
result:
points 0.894118 Partially correct Case 2, 76 / 85, maxt = 8, maxs = 1099947