QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#490025#9156. 百万富翁strcmp#15 635ms27356kbC++14897b2024-07-25 10:28:242024-07-25 10:28:24

Judging History

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

  • [2024-07-25 10:28:24]
  • 评测
  • 测评结果:15
  • 用时:635ms
  • 内存:27356kb
  • [2024-07-25 10:28:24]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#include "richest.h"
#define rep(i, a, b) for(int i = a; i <= b; i++)
using vec = vector<int>;
constexpr int maxn = 2e6 + 10;
#define ps push_back
vec p, np; int n, t, s, cnt[maxn];
int qry(int l, int r) {
	vec a, b;
	for (int i = l; i < r; i++) {
		for (int j = i + 1; j <= r; j++) a.ps(p[i]), b.ps(p[j]); 
	}
	vec c = ask(a, b); int ans = 0;
	for (int i = 0; i < c.size(); i++) {
		++cnt[c[i]];
		if (cnt[c[i]] == r - l) ans = c[i];
	}
	for (int i = 0; i < c.size(); i++) --cnt[c[i]];
	return ans;
	
}
void divide(int k) {
	for (int i = 0; i < n - 1; i += k) {
		int j = min(i + k - 1, n - 1);
		np.ps(qry(i, j));
	}
	p = np; n = p.size(); np.clear();
}
int richest(int N, int T, int S) {
	n = N, t = T, s = S;
	for (int i = 0; i < n; i++) p.ps(i);
	//for (int i = 1; i < t; i++) divide(2);
	return qry(0, n - 1);
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 619ms
memory: 27304kb

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: 635ms
memory: 27356kb

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: