QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#537300#9156. 百万富翁shiomusubi496#26.00002 2289ms97836kbC++171.4kb2024-08-30 09:34:292024-08-30 09:34:30

Judging History

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

  • [2024-08-30 09:34:30]
  • 评测
  • 测评结果:26.00002
  • 用时:2289ms
  • 内存:97836kb
  • [2024-08-30 09:34:29]
  • 提交

answer

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

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); --i)

#define all(v) begin(v), end(v)
#define rall(v) rbegin(v), rend(v)

using namespace std;

using ll = long long;
using ull = unsigned long long;

template<class T, class U> bool chmin(T& a, const U& b) { return a > b ? a = b, true : false; }
template<class T, class U> bool chmax(T& a, const U& b) { return a < b ? a = b, true : false; }

constexpr ll inf = 1001001001001001001;

int richest(int N, int T, int S) {
    if (T == 1) {
        vector<int> a, b;
        rep (i, N) rep (j, i) a.push_back(i), b.push_back(j);
        auto c = ask(a, b);
        vector<bool> used(N);
        rep (i, a.size()) used[a[i] ^ b[i] ^ c[i]] = true;
        rep (i, N) {
            if (!used[i]) return i;
        }
        return -1;
    }
    vector<int> A(N); iota(all(A), 0);
    while (A.size() > 1) {
        vector<int> X, Y;
        rep (i, A.size() / 2) {
            X.push_back(A[i * 2]);
            Y.push_back(A[i * 2 + 1]);
        }
        vector<int> B = ask(X, Y);
        if (A.size() % 2 == 1) B.push_back(A.back());
        A = B;
    }
    return A[0];
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 623ms
memory: 23068kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 11
Acceptable Answer
time: 2264ms
memory: 94056kb

input:

1000000 20 2000000 29091473

output:

Partially correct Case 2, 11 / 85, maxt = 20, maxs = 999999
1811468636458994965
0.129412
3823502568050958645

result:

points 0.129412 Partially correct Case 2, 11 / 85, maxt = 20, maxs = 999999


Final Tests

Test #1:

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

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 11
Acceptable Answer
time: 2289ms
memory: 97836kb

input:

1000000 20 2000000 29091471

output:

Partially correct Case 2, 11 / 85, maxt = 20, maxs = 999999
1811468636458994965
0.129412
3823502568050958645

result:

points 0.129412 Partially correct Case 2, 11 / 85, maxt = 20, maxs = 999999