QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#490685#9156. 百万富翁xvzhiming#15 605ms31172kbC++20817b2024-07-25 16:06:092024-07-25 16:06:10

Judging History

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

  • [2024-07-25 16:06:10]
  • 评测
  • 测评结果:15
  • 用时:605ms
  • 内存:31172kb
  • [2024-07-25 16:06:09]
  • 提交

answer

#pragma GCC optimize(2)
#pragma GCC optimize(3, "Ofast", "inline")

#include <bits/stdc++.h>
#include "richest.h"

using namespace std;

const int N = 1010;

int d[N][N];

int richest(int n, int k, int m) {
	vector <int> a, b;
	for (int i = 0; i < n; i++) {
		for (int j = i+1; j < n; j++) {
			a.push_back(i), b.push_back(j);
		}
	}
	vector <int> c = ask(a, b);
	int tot = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i+1; j < n; j++) {
			d[i][j] = (c[tot++] == i ? 0 : 1);
		}
	}
	for (int i = 0; i < n; i++) {
		bool flag = true;
		for (int j = 0; j < i; j++) {
			if (!d[j][i]) {
				flag = false; break;
			}
		}
		for (int j = i+1; j < n; j++) {
			if (d[i][j]) {
				flag = false; break;
			}
		}
		if (flag) return i;
	}
}

//int main() {
//	
//	return 0;
//}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 605ms
memory: 31172kb

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:

Unauthorized output

result:



Final Tests

Test #1:

score: 15
Accepted
time: 602ms
memory: 31164kb

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:

Unauthorized output

result: