QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#502470#9156. 百万富翁nhuang68515 629ms80208kbC++201.2kb2024-08-03 07:00:242024-08-03 07:00:25

Judging History

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

  • [2024-08-03 07:00:25]
  • 评测
  • 测评结果:15
  • 用时:629ms
  • 内存:80208kb
  • [2024-08-03 07:00:24]
  • 提交

answer

#include "richest.h"
#include <bits/stdc++.h>

int richest(int N, int T, int S) {
  std::vector<int> block;
  if (N == 1000) {
    block = {1000};
  } else {
    block = {2, 2, 2, 2, 3, 6, 19, 183};
  }
  std::vector<int> cand(N);
  std::iota(cand.begin(), cand.end(), 0);
  for (int bl : block) {
    std::cerr << cand.size() << '\n';
    std::vector<int> ncand;
    std::vector<int> a, b;
    std::vector<int> nc(N);
    for (int i = 0; i < std::ssize(cand); i += bl) {
      int r;
      if (bl <= 6 && std::ssize(cand) - i < 2 * bl) {
        r = static_cast<int>(cand.size()) - 1;
      } else if (bl == 19 && i <= 72) {
        r = i + bl - 2;
      } else {
        r = i + bl - 1;
      }
      for (int j = i; j <= r; ++j) {
        nc[cand[j]] = r - i;
        for (int k = j + 1; k <= r; ++k) {
          a.push_back(cand[j]);
          b.push_back(cand[k]);
        }
      }
      if (bl == 19 && i <= 72) {
        i -= 1;
      }
    }
    std::vector<int> t = ask(a, b);
    std::vector<int> freq(N);
    for (int i : t) {
      ++freq[i];
    }
    for (int i : cand) {
      if (freq[i] == nc[i]) {
        ncand.push_back(i);
      }
    }
    cand = ncand;
  }
  return cand[0];
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 618ms
memory: 25248kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 0
Wrong Answer
time: 442ms
memory: 80164kb

input:

1000000 20 2000000 29091473

output:

Wrong answer
4459638610240858557
0.000000
6906350380861515327

result:

points 0.0 Wrong answer


Final Tests

Test #1:

score: 15
Accepted
time: 629ms
memory: 25288kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 0
Wrong Answer
time: 207ms
memory: 80208kb

input:

1000000 20 2000000 29091471

output:

Wrong answer
4459638610240858557
0.000000
6906350380861515327

result:

points 0.0 Wrong answer