QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#496053#9156. 百万富翁superguymj100 ✓2081ms102096kbC++201.8kb2024-07-28 02:11:152024-07-28 02:11:15

Judging History

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

  • [2024-07-28 02:11:15]
  • 评测
  • 测评结果:100
  • 用时:2081ms
  • 内存:102096kb
  • [2024-07-28 02:11:15]
  • 提交

answer

#include <bits/stdc++.h>
#include "richest.h"
#define rep(i,x,y) for(int i=x; i<=y; ++i)
#define repd(i,x,y) for(int i=x; i>=y; --i)

using namespace std;

int richest(int N, int T, int S) {
    vector<int> id(N);
    iota(id.begin(), id.end(), 0);

    auto query = [&](int p, int q) {
        vector<int> a, b;
        N = id.size();
        rep(i,0,q-1) {
            rep(j,0,p-1)
                rep(k,0,j-1) {
                    a.emplace_back(id[i * p + j]);
                    b.emplace_back(id[i * p + k]);
                }
        }
        int l = p * q;
        while(l + p - 1 < N) {
            rep(j,0,p-2)
                rep(k,0,j-1) {
                    a.emplace_back(id[l + j]);
                    b.emplace_back(id[l + k]);
                }
            l += p - 1;
        }
        rep(j,l,N-1)
            rep(k,l,j-1) {
                a.emplace_back(id[j]);
                b.emplace_back(id[k]);
            }
        return make_pair(a, b);
    };

    vector<bool> vis(N);
    auto kill = [&](vector<int> a, vector<int> b, vector<int> c) {
        rep(i,0,c.size()-1)
            vis[a[i]^b[i]^c[i]] = 1;
        vector<int> tmp;
        rep(i,0,N-1)
            if(!vis[id[i]])
                tmp.emplace_back(id[i]);
        id = move(tmp);
    };

    vector<pair<int, int>> ins {{2, 500000},
                            {2, 250000},
                            {2, 125000},
                            {2, 62500},
                            {4, 1},
                            {7, 1},
                            {19, 178},
                            {183, 1}};

    if (N == 1000)
        ins = {{N, 1}};

    for(auto [p, q] : ins) {
        auto [a, b] = query(p, q);
        auto c = ask(a, b);
        kill(a, b, c);
    }

    return id.back();
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

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

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 85
Accepted
time: 2081ms
memory: 102064kb

input:

1000000 20 2000000 29091473

output:

Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944
7610580723948932399
1.000000
1331569654267968081

result:

points 1.0 Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944


Final Tests

Test #1:

score: 15
Accepted
time: 613ms
memory: 27448kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 85
Accepted
time: 2081ms
memory: 102096kb

input:

1000000 20 2000000 29091471

output:

Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944
7610580723948932399
1.000000
1331569654267968081

result:

points 1.0 Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944