QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#529185#9156. 百万富翁Physics212303100 ✓3743ms104564kbC++171.4kb2024-08-24 10:20:432024-08-24 10:20:44

Judging History

你现在查看的是最新测评结果

  • [2024-08-24 10:20:44]
  • 评测
  • 测评结果:100
  • 用时:3743ms
  • 内存:104564kb
  • [2024-08-24 10:20:43]
  • 提交

answer

#include "richest.h"
#include<bits/stdc++.h>
using namespace std;
const vector<int> l={1000000,500000,250000,125000,62499,20832,3472,183,1};
int richest(int n,int t,int s){
  if(n==1000){
    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);
    auto c=ask(a,b);
    vector v(n,vector<bool>(n));
    for(int i=0,p=0;i<n;i++)
      for(int j=i+1;j<n;j++)
        v[i][j]=(c[p++]==i),v[j][i]=!v[i][j];
    vector<int> p(n);
    iota(p.begin(),p.end(),0);
    sort(p.begin(),p.end(),[&](int x,int y){return v[x][y];});
    return p[0];
  }
  vector<int> r(n);
  iota(r.begin(),r.end(),0);
  for(int i=1;i<l.size();i++){
    vector<vector<int> > w(l[i]);
    for(int j=0;j<r.size();j++)
      w[j%l[i]].emplace_back(r[j]);
    vector<int> a,b;
    for(int j=0;j<l[i];j++)
      for(int x=0;x<w[j].size();x++)
        for(int y=x+1;y<w[j].size();y++)
          a.emplace_back(w[j][x]),b.emplace_back(w[j][y]);
    auto c=ask(a,b); int p=0;
    vector<int>().swap(r);
    for(int j=0;j<l[i];j++){
      vector v(w[j].size(),vector<bool>(w[j].size()));
      for(int x=0;x<w[j].size();x++)
        for(int y=x+1;y<w[j].size();y++)
          v[x][y]=(c[p++]==w[j][x]),v[y][x]=!v[x][y];
      vector<int> p(w[j].size());
      iota(p.begin(),p.end(),0);
      sort(p.begin(),p.end(),[&](int x,int y){return v[x][y];});
      r.emplace_back(w[j][p[0]]);
    }
  }
  return r[0];
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 619ms
memory: 23888kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 85
Accepted
time: 3714ms
memory: 104564kb

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: 626ms
memory: 23148kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 85
Accepted
time: 3743ms
memory: 102160kb

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