QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#492477 | #9156. 百万富翁 | tuxuanming2024# | 77.99996 | 3039ms | 102640kb | C++14 | 1.3kb | 2024-07-26 12:41:09 | 2024-07-26 12:41:10 |
Judging History
answer
#include "richest.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int mx[1005][1005];
ll get(int x,int y) {return x*1000001ll+y;}
void work(vector<int>&p,int B,int t)
{
while((t--)&&(int)p.size()>1)
{
int sz=p.size();
vector<int>a,b;
unordered_map<ll,int>mx;
for(int i=0;i<sz;i+=B)
{
for(int j=i;j<min(sz,i+B);j++)
for(int k=j+1;k<min(sz,i+B);k++) a.push_back(p[j]),b.push_back(p[k]);
}
vector<int>c=ask(a,b),q;
for(int i=0;i<(int)a.size();i++) mx[get(a[i],b[i])]=c[i];
for(int i=0;i<sz;i+=B)
{
int res=p[i];
for(int j=i+1;j<min(sz,i+B);j++)
if(mx[get(res,p[j])]==p[j]) res=p[j];
q.push_back(res);
}
p=q;
}
}
int richest(int n, int T, int S)
{
if(T==1)
{
vector<int>a,b;
for(int i=0;i<n;i++)
for(int j=i+1;j<n;j++) a.push_back(i),b.push_back(j);
vector<int>c=ask(a,b);
for(int i=0,k=0;i<n;i++)
for(int j=i+1;j<n;j++) mx[i][j]=c[k++];
int ans=0;
for(int i=1;i<n;i++) if(mx[ans][i]==i) ans=i;
return ans;
}
vector<int>p;
for(int i=0;i<n;i++) p.push_back(i);
work(p,2,4);
work(p,3,2);
work(p,10,2);
// cerr<<"awa "<<p.size()<<'\n';
work(p,70,114514);
return p[0];
}
/*
g++ grader.cpp richest.cpp -o richest -O2 -std=c++14 -static && ./richest
*/
Details
Tip: Click on the bar to expand more detailed information
Pretests
Pretest #1:
score: 15
Accepted
time: 624ms
memory: 29832kb
input:
1000 1 499500 957319859
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Pretest #2:
score: 63
Acceptable Answer
time: 3039ms
memory: 87228kb
input:
1000000 20 2000000 29091473
output:
Partially correct Case 2, 63 / 85, maxt = 9, maxs = 1057602 8133170859353959375 0.741176 16601290867448354019
result:
points 0.741176 Partially correct Case 2, 63 / 85, maxt = 9, maxs = 1057602
Final Tests
Test #1:
score: 15
Accepted
time: 612ms
memory: 29228kb
input:
1000 1 499500 957319857
output:
Correct 7127326332295218295 1.000000 1331569654267968081
result:
points 1.0 Correct
Test #2:
score: 63
Acceptable Answer
time: 2967ms
memory: 102640kb
input:
1000000 20 2000000 29091471
output:
Partially correct Case 2, 63 / 85, maxt = 9, maxs = 1057602 8133170859353959375 0.741176 16601290867448354019
result:
points 0.741176 Partially correct Case 2, 63 / 85, maxt = 9, maxs = 1057602