QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#535570 | #9156. 百万富翁 | lyx123886a123886# | 15 | 645ms | 30988kb | C++14 | 1.3kb | 2024-08-28 10:26:23 | 2024-08-28 10:26:24 |
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;}
}
int solve() {
V.resize(N);rep(i,0,N-1) V[i]=i;
if(sub1::check()) return sub1::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: 641ms
memory: 29316kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 0
Wrong Answer
time: 18ms
memory: 26712kb
input:
1000000 20 2000000 29091473
output:
Wrong answer 4459638610240858557 0.000000 6906350380861515327
result:
points 0.0 Wrong answer
Final Tests
Test #1:
score: 15
Accepted
time: 645ms
memory: 30988kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 0
Wrong Answer
time: 7ms
memory: 26712kb
input:
1000000 20 2000000 29091471
output:
Wrong answer 4459638610240858557 0.000000 6906350380861515327
result:
points 0.0 Wrong answer