QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#537307#9156. 百万富翁shiomusubi496#23.99997 3803ms113136kbC++171.8kb2024-08-30 09:45:172024-08-30 09:45:19

Judging History

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

  • [2024-08-30 09:45:19]
  • 评测
  • 测评结果:23.99997
  • 用时:3803ms
  • 内存:113136kb
  • [2024-08-30 09:45:17]
  • 提交

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() / 3) {
            rep (k, 3) X.push_back(A[i * 3 + k % 3]);
            rep (k, 3) Y.push_back(A[i * 3 + (k + 1) % 3]);
        }
        if (A.size() % 3 == 2) {
            X.push_back(A[A.size() - 2]);
            Y.push_back(A[A.size() - 1]);
        }
        if (A.size() % 3 == 1) A = {A.back()};
        else A.clear();
        auto B = ask(X, Y);
        rep (i, B.size() / 3) {
            if (B[i * 3] == B[i * 3 + 1]) A.push_back(B[i * 3]);
            else if (B[i * 3 + 1] == B[i * 3 + 2]) A.push_back(B[i * 3 + 1]);
            else A.push_back(B[i * 3 + 2]);
        }
        if (B.size() % 3 == 1) A.push_back(B.back());
    }
    return A[0];
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 610ms
memory: 22908kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 8.99997
Acceptable Answer
time: 3803ms
memory: 108976kb

input:

1000000 20 2000000 29091473

output:

Partially correct Case 2, 9 / 85, maxt = 13, maxs = 1499997
7616820272462450011
0.105882
16926627793318235567

result:

points 0.105882 Partially correct Case 2, 9 / 85, maxt = 13, maxs = 1499997


Final Tests

Test #1:

score: 15
Accepted
time: 620ms
memory: 22980kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 8.99997
Acceptable Answer
time: 3790ms
memory: 113136kb

input:

1000000 20 2000000 29091471

output:

Partially correct Case 2, 9 / 85, maxt = 13, maxs = 1499997
7616820272462450011
0.105882
16926627793318235567

result:

points 0.105882 Partially correct Case 2, 9 / 85, maxt = 13, maxs = 1499997