QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#537319#9156. 百万富翁shiomusubi496#51.99999 2005ms84200kbC++171.7kb2024-08-30 09:58:592024-08-30 09:58:59

Judging History

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

  • [2024-08-30 09:58:59]
  • 评测
  • 测评结果:51.99999
  • 用时:2005ms
  • 内存:84200kb
  • [2024-08-30 09:58:59]
  • 提交

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() > 400) {
        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;
    }
    if (A.size() == 1) return A[0];
    vector<int> X, Y;
    rep (i, A.size()) rep (j, i) {
        X.push_back(A[i]);
        Y.push_back(A[j]);
    }
    auto B = ask(X, Y);
    map<int, int> mp;
    for (int i : B) ++mp[i];
    for (auto [x, v] : mp) {
        if (v == A.size() - 1) return x;
    }
    return -1;
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 592ms
memory: 22996kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 37
Acceptable Answer
time: 1988ms
memory: 84156kb

input:

1000000 20 2000000 29091473

output:

Partially correct Case 2, 37 / 85, maxt = 13, maxs = 1029645
14233204743512706019
0.435294
13281437197936769557

result:

points 0.435294 Partially correct Case 2, 37 / 85, maxt = 13, maxs = 1029645


Final Tests

Test #1:

score: 15
Accepted
time: 599ms
memory: 22936kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 37
Acceptable Answer
time: 2005ms
memory: 84200kb

input:

1000000 20 2000000 29091471

output:

Partially correct Case 2, 37 / 85, maxt = 13, maxs = 1029645
14233204743512706019
0.435294
13281437197936769557

result:

points 0.435294 Partially correct Case 2, 37 / 85, maxt = 13, maxs = 1029645