QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#490220#9156. 百万富翁strcmp#15 636ms27348kbC++141.2kb2024-07-25 13:05:082024-07-25 13:05:08

Judging History

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

  • [2024-07-25 13:05:08]
  • 评测
  • 测评结果:15
  • 用时:636ms
  • 内存:27348kb
  • [2024-07-25 13:05:08]
  • 提交

answer

#include <bits/stdc++.h>
//#include <windows.h>
using namespace std;
#include "richest.h"
#define rep(i, a, b) for(int i = a; i <= b; i++)
using vec = vector<int>;
using ll = long long int;
constexpr int maxn = 2e6 + 10;
#define ps push_back
int p[35] = { 500000, 250000, 125000, 62500, 20834, 3472, 348, 7, 1 }, cnt[maxn];
int richest(int n, int t, int s) {
	if (n <= 1000) {
		vec x, y, z;
		for (int i = 0; i < n - 1; i++) {
			for (int j = i + 1; j < n; j++) x.ps(i), y.ps(j);
		}
		z = ask(x, y); int ans = 0;
		for (int i = 0; i < z.size(); i++) {
			++cnt[z[i]];
			if (cnt[z[i]] == n - 1) ans = z[i];
		}
		for (int i = 0; i < z.size(); i++) --cnt[z[i]];
		return ans;
	}
	vec a; 
	for (int i = 0; i < n; i++) a.push_back(i);
	for (int i = 0; i < t; i++) {
		vec x, y;
		for (int j = 0; j < a.size(); j++) {
			for (int k = j % p[i]; k < j; k += p[i]) if (j != k) x.ps(a[j]), y.ps(a[k]);
		}
		vec z = ask(x, y), na;
		for (int j = 0; j < z.size(); j++) z[j] == x[j] ? ++cnt[y[j]] : ++cnt[x[j]];
		for (int j = 0; j < a.size(); j++) if (!cnt[a[j]]) na.ps(a[j]);
		for (int j = 0; j < z.size(); j++) z[j] == x[j] ? --cnt[y[j]] : --cnt[x[j]];
		a = na; 
	}
	return a[0];
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 617ms
memory: 27256kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 0
Runtime Error

input:

1000000 20 2000000 29091473

output:

Unauthorized output

result:



Final Tests

Test #1:

score: 15
Accepted
time: 636ms
memory: 27348kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 0
Runtime Error

input:

1000000 20 2000000 29091471

output:

Unauthorized output

result: