QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#537340#9156. 百万富翁hirayuu_qoj#100 ✓2890ms102076kbC++171.3kb2024-08-30 10:13:392024-08-30 10:13:39

Judging History

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

  • [2024-08-30 10:13:39]
  • 评测
  • 测评结果:100
  • 用时:2890ms
  • 内存:102076kb
  • [2024-08-30 10:13:39]
  • 提交

answer

#include "richest.h"
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rng(i,l,r) for(int i=(l); i<(r); i++)
#define all(x) x.begin(),x.end()
using ll=long long;

int richest(int N, int T, int S) {
    vector<int> arr={500000,250000,125000,62496,20832,3472,183,1};
    if(N==1000)arr={1};
    vector<int> now(N);
    iota(all(now),0);
    rep(i,arr.size()) {
        vector<vector<int>> ques(arr[i]);
        rep(j,now.size()) {
            ques[j%arr[i]].emplace_back(now[j]);
        }
        vector<int> a,b;
        rep(j,arr[i]) {
            rep(k,ques[j].size()) {
                rep(l,k) {
                    a.emplace_back(ques[j][k]);
                    b.emplace_back(ques[j][l]);
                }
            }
        }
        vector<int> c=ask(a,b);
        vector<int> nxt(arr[i]);
        int cnt=0;
        rep(j,arr[i]) {
            int mx=0;
            rep(k,ques[j].size()) {
                rep(l,k) {
                    if(l==mx) {
                        if(c[cnt]==a[cnt]) {
                            mx=k;
                        }
                    }
                    cnt++;
                }
            }
            nxt[j]=ques[j][mx];
        }
        swap(now,nxt);
    }
    return now[0];
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 616ms
memory: 22136kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 85
Accepted
time: 2811ms
memory: 102036kb

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: 610ms
memory: 22220kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 85
Accepted
time: 2890ms
memory: 102076kb

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