QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#688680#9156. 百万富翁KiharaTouma100 ✓3327ms132664kbC++142.1kb2024-10-30 12:28:142024-10-30 12:28:15

Judging History

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

  • [2024-10-30 12:28:15]
  • 评测
  • 测评结果:100
  • 用时:3327ms
  • 内存:132664kb
  • [2024-10-30 12:28:14]
  • 提交

answer

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

int richest(int n, int T, int s){
    if(n == 1000){
        vector<int> x, y;
        x.clear();
        y.clear();
        static int cnt[1010];
        memset(cnt, 0, sizeof(cnt));
        for(int i = 0; i < n; ++ i){
            for(int j = i+1; j < n; ++ j){
                x.push_back(i);
                y.push_back(j);
            }
        }
        vector<int> res = ask(x, y);
        for(int i : res){
            ++ cnt[i];
        }
        for(int i = 0; i < n; ++ i){
            if(cnt[i] == n - 1){
                return i;
            }
        }
    } else {
        vector<int> now, x, y, t[1000010];
        static int cnt[1000010], inb[1000010];
        for(int i = 0; i < n; ++ i){
            now.push_back(i);
        }
        static int opt[9] = {
            1, 
            183, 
            3472, 
            20832, 
            62496, 
            125000,
            250000,
            500000,
            1000000
        };
        for(int i = 8; i >= 1; -- i){
            x.clear();
            y.clear();
            for(int j = 0; j < opt[i-1]; ++ j){
                vector<int> ().swap(t[j]);
            }
            for(int j = 0; j < opt[i]; ++ j){
                t[j%opt[i-1]].push_back(now[j]);
                inb[now[j]] = j % opt[i-1];
            }
            for(int j = 0; j < opt[i-1]; ++ j){
                int k = t[j].size();
                for(int p = 0; p < k; ++ p){
                    for(int q = p+1; q < k; ++ q){
                        x.push_back(t[j][p]);
                        y.push_back(t[j][q]);
                    }
                }
            }
            memset(cnt, 0, sizeof(cnt));
            vector<int> z = ask(x, y);
            for(int i : z){
                ++ cnt[i];
            }
            vector<int> ().swap(now);
            for(int j = 0; j < 1000000; ++ j){
                if(cnt[j] == t[inb[j]].size() - 1){
                    now.push_back(j);
                }
            }
        }
        return now[0];
    }
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 621ms
memory: 48736kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 85
Accepted
time: 3327ms
memory: 126680kb

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: 617ms
memory: 48752kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 85
Accepted
time: 3256ms
memory: 132664kb

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