QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#497151 | #9156. 百万富翁 | Juefan | 0 | 92ms | 59132kb | C++14 | 1.6kb | 2024-07-28 20:17:21 | 2024-07-28 20:17:22 |
Judging History
answer
#include "richest.h"
#include<bits/stdc++.h>
#define F(i,a,b) for(int i(a),i##E(b);i<=i##E;i++)
#define UF(i,a,b) for(int i(a),i##E(b);i>=i##E;i--)
#define gc getchar
#define sz(x) int((x).size())
#define vec vector
#define File(x) (freopen(x".in","r",stdin),freopen(x".out","w",stdout))
using namespace std;using ll=long long;using ull=unsigned long long;
template<class T>
void operator+=(vec<T> &a,const T&b) {a.push_back(b);}
std::vector <int> ask(std::vector <int> a, std::vector <int> b);
//std::vector <int> ask(std::vector <int> a, std::vector <int> b) {
// return {};
//}
const int A[]{0,2,2,2,2,3,6,19,10000000};
int nid[int(1e6+5)];
void addval(vec<int> &a,vec<int> &b,int st,int val) {
F(i,0,val-1) F(j,i+1,val-1) a+=i+st,b+=j+st;
}
int rich(int dep,int n,vec<int> id) {
assert(dep<=8);
int x=A[dep];
vec<int> a,b;
vec<bool> NOT(n);
F(i,0,n-1) nid[id[i]]=i;
if(n<x) {
addval(a,b,0,n);
} else if(n%x==0) {
F(i,0,n/x-1) addval(a,b,i*x,x);
} else {
int now=0;
F(i,1,n/x-(x-1-n%x)) addval(a,b,now,x),now+=x;
F(i,1,(x-n%x)) addval(a,b,now,x-1),now+=x-1;
assert(now==n);
}
for(int &x:a) x=id[x];
for(int &x:b) x=id[x];
vec<int> c=ask(a,b);
F(i,0,n-1) NOT[nid[a[i]^b[i]^c[i]]]=1;
vec<int> newid;
F(i,0,n-1) if(!NOT[i]) newid+=id[i];
if(sz(newid)==1) return newid[0];
return rich(dep+1,(n+x-1)/x,newid);
}
int richest(int n,int T,int S) {
if(n==1000) {
vec<int> a,b;
vec<bool> NOT(n);
F(i,0,n-1) F(j,i+1,n-1) a+=i,b+=j;
vec<int> c=ask(a,b);
F(i,0,n-1) NOT[a[i]^b[i]^c[i]]=1;
F(i,0,n-1) if(!NOT[i]) return i;
return 114514;
}
}
//main() {}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 0
Wrong Answer
time: 54ms
memory: 19984kb
input:
1000 1 499500 957319859
output:
Wrong answer 4459638610240858557 0.000000 6906350380861515327
result:
points 0.0 Wrong answer
Pretest #2:
score: 0
Wrong Answer
time: 80ms
memory: 59132kb
input:
1000000 20 2000000 29091473
output:
Wrong answer 4459638610240858557 0.000000 6906350380861515327
result:
points 0.0 Wrong answer
Final Tests
Test #1:
score: 0
Wrong Answer
time: 54ms
memory: 19988kb
input:
1000 1 499500 957319857
output:
Wrong answer 4459638610240858557 0.000000 6906350380861515327
result:
points 0.0 Wrong answer
Test #2:
score: 0
Wrong Answer
time: 92ms
memory: 58852kb
input:
1000000 20 2000000 29091471
output:
Wrong answer 4459638610240858557 0.000000 6906350380861515327
result:
points 0.0 Wrong answer