QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#487480#9156. 百万富翁TulipeNoire15 638ms30720kbC++14886b2024-07-22 22:29:492024-07-22 22:29:49

Judging History

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

  • [2024-07-22 22:29:49]
  • 评测
  • 测评结果:15
  • 用时:638ms
  • 内存:30720kb
  • [2024-07-22 22:29:49]
  • 提交

answer

#include<bits/stdc++.h>
#include"richest.h"
#define pb(x) push_back(x)
using namespace std;
using vi=vector<int>;
const int N=1005;
int mat[N][N];
int richest(int n, int t, int s) {
    memset(mat,0,sizeof mat);
    if (n<=1000) {
        vi a,b;
        for (int i=0;i<n;i++) {
            for (int j=i+1;j<n;j++) {
                a.pb(i),b.pb(j);
            }
        }
        auto res=ask(a,b);
        int ct=0;
        for (int i=0;i<n;i++) {
            for (int j=i+1;j<n;j++) {
                int x=res[ct++];
                if (x==i) mat[i][j]=1;
                else mat[j][i]=1;
            }
        }
        for (int i=0;i<n;i++) {
            int coef=1;
            for (int j=0;j<n;j++) {
                if (i==j) continue;
                if (!mat[i][j]) coef=0;
            }
            if (coef) return i;
        }
    }

}

詳細信息


Pretests

Pretest #1:

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

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 0
Memory Limit Exceeded

input:

1000000 20 2000000 29091473

output:


result:



Final Tests

Test #1:

score: 15
Accepted
time: 627ms
memory: 30720kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 0
Memory Limit Exceeded

input:

1000000 20 2000000 29091471

output:


result: