QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#487480 | #9156. 百万富翁 | TulipeNoire | 15 | 638ms | 30720kb | C++14 | 886b | 2024-07-22 22:29:49 | 2024-07-22 22:29:49 |
Judging History
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