QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#518188 | #9156. 百万富翁 | Chendaqian | 100 ✓ | 2218ms | 86564kb | C++14 | 1.1kb | 2024-08-13 17:30:15 | 2024-08-13 17:30:15 |
Judging History
answer
#include "richest.h"
#include<bits/stdc++.h>
using namespace std;
const int k[9]={1000000,500000,250000,125000,62500,20833,3472,183,1};
int richest(int N, int T, int S) {
if(N==1000&&T==1&&S==499500) {
vector<int> a,b;
for(int i=0;i<N;i++) for(int j=i+1;j<N;j++) {
a.emplace_back(i);
b.emplace_back(j);
}
vector<int> c(ask(a,b)),cnt(N,0);
for(auto p:c) cnt[p]++;
for(int i=0;i<N;i++) if(cnt[i]==N-1) return i;
return 0;
}
vector<int> cur(N),a,b,c,cnt(N,0);
for(int i=0;i<N;i++) cur[i]=i;
vector<int> nw;
for(int i=1;i<=8;i++) {
int len=k[i-1]/k[i],lm=k[i-1]%k[i];
a.clear(),b.clear(),c.clear();
for(int j=0,st=0,ed;j<k[i];j++,st=ed) {
ed=st+len+(j<lm);
for(int x=st;x<ed;x++) for(int y=x+1;y<ed;y++)
a.push_back(cur[x]),b.push_back(cur[y]);
}
c=ask(a,b);
for(int j=0,st=0,ed,tot=0;j<k[i];j++,st=ed) {
ed=st+len+(j<lm);
for(int x=st;x<ed;x++) for(int y=x+1;y<ed;y++)
cnt[c[tot++]]++;
for(int x=st;x<ed;x++) {
if(cnt[cur[x]]==ed-st-1) nw.push_back(cur[x]);
cnt[cur[x]]=0;
}
}
cur=nw;nw.clear();
}
return cur[0];
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 15
Accepted
time: 607ms
memory: 25332kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 85
Accepted
time: 2218ms
memory: 86376kb
input:
1000000 20 2000000 29091473
output:
Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944 7610580723948932399 1.000000 1331569654267968081
result:
points 1.0 Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944
Final Tests
Test #1:
score: 15
Accepted
time: 622ms
memory: 25412kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 85
Accepted
time: 2216ms
memory: 86564kb
input:
1000000 20 2000000 29091471
output:
Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944 7610580723948932399 1.000000 1331569654267968081
result:
points 1.0 Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944