QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#510030#9156. 百万富翁AdamGS#100 ✓2246ms87824kbC++231.2kb2024-08-08 20:40:462024-08-08 20:40:48

Judging History

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

  • [2024-08-08 20:40:48]
  • 评测
  • 测评结果:100
  • 用时:2246ms
  • 内存:87824kb
  • [2024-08-08 20:40:46]
  • 提交

answer

#include "richest.h"
#include<bits/stdc++.h>
using namespace std;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const int INF=1e9+7;
int solve1(int n) {
	vector<int>A, B;
	rep(i, n) rep(j, i) {
		A.pb(j); B.pb(i);
	}
	vector<int>C=ask(A, B);
	vector<int>ile(n);
	for(auto i : C) ++ile[i];
	int ans=-1;
	rep(i, n) if(ile[i]==n-1) ans=i;
	return ans;
}
int richest(int n, int t, int s) {
	if(t==1) return solve1(n);
	vector<pair<int,int>>pyt={{2, INF}, {2, INF}, {2, INF}, {2, INF}, {3, 20832}, {6, 3471}, {18, 5}, {183, 1}};
	vector<int>T(n);
	rep(i, n) T[i]=i;
	for(auto i : pyt) {
		vector<int>A, B;
		int akt=0;
		for(int j=0; j<T.size(); j+=i.st) {
			++akt;
			if(akt==i.nd+1) ++i.st;
			int l=min((int)T.size(), j+i.st)-j;
			rep(a, l) rep(b, a) {
				A.pb(T[j+a]);
				B.pb(T[j+b]);
			}
		}
		if(akt>i.nd) --i.st;
		akt=0;
		vector<int>C=ask(A, B);
		vector<int>ile(n);
		for(auto j : C) ++ile[j];
		vector<int>D;
		for(int j=0; j<T.size(); j+=i.st) {
			++akt;
			if(akt==i.nd+1) ++i.st;
			int l=min((int)T.size(), j+i.st)-j;
			rep(a, l) if(ile[T[j+a]]==l-1) D.pb(T[j+a]);
		}
		T=D;
	}
	return T[0];
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 15
Accepted
time: 601ms
memory: 22916kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 85
Accepted
time: 2246ms
memory: 86556kb

input:

1000000 20 2000000 29091473

output:

Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944
7610580723948932399
1.000000
1331569654267968081

result:

points 1.0 Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944


Final Tests

Test #1:

score: 15
Accepted
time: 599ms
memory: 22248kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 85
Accepted
time: 2220ms
memory: 87824kb

input:

1000000 20 2000000 29091471

output:

Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944
7610580723948932399
1.000000
1331569654267968081

result:

points 1.0 Correct Case 2, 85 / 85, maxt = 8, maxs = 1099944