QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#529179#9156. 百万富翁Physics21230385 4519ms104476kbC++171.4kb2024-08-24 10:19:432024-08-24 10:19:43

Judging History

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

  • [2024-08-24 10:19:43]
  • 评测
  • 测评结果:85
  • 用时:4519ms
  • 内存:104476kb
  • [2024-08-24 10:19: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};
vector<int> a,b;
int richest(int n,int t,int s){
  if(n==1000){
    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: 0
Wrong Answer
time: 61ms
memory: 26192kb

input:

1000 1 499500 957319859

output:

Too many total elements in queries
1469670942222006797
0.000000
6906350380861515327

result:

points 0.0 Too many total elements in queries

Pretest #2:

score: 85
Accepted
time: 4470ms
memory: 104476kb

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: 0
Wrong Answer
time: 62ms
memory: 26268kb

input:

1000 1 499500 957319857

output:

Too many total elements in queries
1469670942222006797
0.000000
6906350380861515327

result:

points 0.0 Too many total elements in queries

Test #2:

score: 85
Accepted
time: 4519ms
memory: 102132kb

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