QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#537290#9156. 百万富翁Forested#26.00002 2335ms99392kbC++172.6kb2024-08-30 09:13:102024-08-30 09:13:12

Judging History

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

  • [2024-08-30 09:13:12]
  • 评测
  • 测评结果:26.00002
  • 用时:2335ms
  • 内存:99392kb
  • [2024-08-30 09:13:10]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

using i32 = int;
using i64 = long long;
template <typename T>
using V = vector<T>;
template <typename T>
using VV = V<V<T>>;
template <typename T>
using VVV = V<V<V<T>>>;

template <typename T>
bool chmin(T &x, const T &y) {
    if (x > y) {
        x = y;
        return true;
    }
    return false;
}
template <typename T>
bool chmax(T &x, const T &y) {
    if (x < y) {
        x = y;
        return true;
    }
    return false;
}

#define OVERRIDE4(a, b, c, d, ...) d
#define REP2(i, n) for (i32 i = 0; i < (i32)(n); ++i)
#define REP3(i, l, r) for (i32 i = (i32)(l); i < (i32)(r); ++i)
#define REP(...) OVERRIDE4(__VA_ARGS__, REP3, REP2)(__VA_ARGS__)
#define PER2(i, n) for (i32 i = (i32)(n)-1; i >= 0; --i)
#define PER3(i, l, r) for (i32 i = (i32)(r)-1; i >= (i32)(l); --i)
#define PER(...) OVERRIDE4(__VA_ARGS__, PER3, PER2)(__VA_ARGS__)
#define ALL(x) begin(x), end(x)
#define LEN(x) (i32) size(x)

void dbg(i32 x) { cerr << x; }
void dbg(i64 x) { cerr << x; }
template <typename T>
void dbg(V<T> arr) {
    cerr << '[';
    REP(i, LEN(arr)) {
        if (i) {
            cerr << ", ";
        }
        dbg(arr[i]);
    }
    cerr << ']';
}
void debug() { cerr << "\n"; }
template <typename Head, typename... Tail>
void debug(Head head, Tail... tail) {
    dbg(head);
    cerr << ", ";
    debug(tail...);
}

#ifdef DEBUGF
#define DBG(...)                       \
    do {                               \
        cerr << #__VA_ARGS__ << " : "; \
        debug(__VA_ARGS__);            \
    } while (false)
#else
#define DBG(...) (void)0
#endif

#include "richest.h"

i32 richest(i32 n, i32 t, i32 s) {
    if (t == 1) {
        V<i32> a, b;
        REP(i, n) REP(j, i + 1, n) {
            a.push_back(i);
            b.push_back(j);
        }
        V<i32> c = ask(a, b);
        VV<i32> gr(n, V<i32>(n, 1));
        REP(i, LEN(c)) {
            if (c[i] == a[i]) {
                gr[b[i]][a[i]] = 0;
            } else {
                gr[a[i]][b[i]] = 0;
            }
        }
        i32 ans = -1;
        REP(i, n) {
            if (count(ALL(gr[i]), 1) == n) {
                ans = i;
            }
        }
        return ans;
    }
    
    V<i32> rem(n);
    iota(ALL(rem), 0);
    while (LEN(rem) > 1) {
        V<i32> a, b;
        REP(i, LEN(rem) / 2) {
            a.push_back(rem[2 * i]);
            b.push_back(rem[2 * i + 1]);
        }
        V<i32> c = ask(a, b);
        if (LEN(rem) % 2) {
            c.push_back(rem.back());
        }
        rem.swap(c);
    }
    return rem[0];
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 638ms
memory: 23516kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 11
Acceptable Answer
time: 2335ms
memory: 99392kb

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: 628ms
memory: 24144kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 11
Acceptable Answer
time: 2330ms
memory: 99252kb

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