QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#603464 | #9156. 百万富翁 | Littlelu | 15 | 655ms | 25260kb | C++14 | 1.3kb | 2024-10-01 16:43:33 | 2024-10-01 16:43:33 |
Judging History
answer
#include <bits/stdc++.h>
#include "richest.h"
using namespace std;
int solve0(){
vector<int> aska,askb,resp;
int cnt=0;
for(int i=0;i<1000;++i) for(int j=i+1;j<1000;++j){
aska.push_back(i),askb.push_back(j),++cnt;
}
resp=ask(aska,askb);
vector<int> out(1000),ans;
for(int i=0;i<cnt;++i){
if(resp[i]==aska[i]) out[askb[i]]++;
else out[aska[i]]++;
}
for(int i=0;i<1000;++i) if(out[i]==0) return i;
return -1;
}
int solve1(){
vector<int> asks,aske;
for(int i=0;i<1e6;++i) asks.push_back(i);
int alea[]={2,2,2,2,3,6,19,183};
for(int k:alea){
int n=asks.size(),m;
vector<int> aska,askb,repd;
map<int,int> out;
for(int i=0;i<n;++i) for(int j=i+1;j<n;++j){
if(i/k!=j/k) break;
aska.push_back(asks[i]),askb.push_back(asks[j]);
}
repd=ask(aska,askb);
m=repd.size();
for(int i=0;i<m;++i){
if(repd[i]==aska[i]) out[askb[i]]++;
else out[aska[i]]++;
}
aske.clear();
for(int i=0;i<n;++i) if(out[asks[i]]==0) aske.push_back(asks[i]);
asks=aske;
out.clear();
}
return asks[0];
}
int richest(int n,int t,int s){
if(n==1000) return solve0();
else return solve1();
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 15
Accepted
time: 655ms
memory: 25260kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 0
Time Limit Exceeded
input:
1000000 20 2000000 29091473
output:
Partially correct Case 2, 67 / 85, maxt = 8, maxs = 1099960 2586970244946203279 0.788235 12006835993993373281
result:
Final Tests
Test #1:
score: 15
Accepted
time: 655ms
memory: 25228kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 0
Time Limit Exceeded
input:
1000000 20 2000000 29091471
output:
Unauthorized output