QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#823015#9156. 百万富翁DinoHadzic0 0ms0kbC++141.4kb2024-12-20 18:21:032024-12-20 18:21:03

Judging History

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

  • [2024-12-20 18:21:03]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2024-12-20 18:21:03]
  • 提交

answer

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

#define F first
#define S second
#define all(x) x.begin(), x.end()
#define pb push_back
#define FIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using namespace std;

typedef long long ll;
typedef pair <ll, ll> pii;

const int N = 1e6;

int arr[] = {500000, 250000, 125000, 62500, 20833, 3472, 183, 1};

int richest(int n, int t, int s) {
	vector <int> cur, ncur;
	for (int i = 0; i < N; i++) cur.pb(i);
	for (int i = 0; i < 8; i++) {
		vector <int> v1, v2;
		ncur.clear();
		int x = cur.size(), k = arr[i];
		int y = x%k, z = x/k, uk = 0;
		int si[] = {y, k-y}, co[] = {z+1, z};
		for (int o = 0; o < 2; o++) {
			for (int i = 0; i < si[o]; i++) {
				for (int a = 0; a < co[o]; a++) for (int b = a+1; b < co[o]; b++) {
					if (uk+i*co[o]+b >= n) continue;
					v1.pb(cur[uk+i*co[o]+a]);
					v2.pb(cur[uk+i*co[o]+b]);
				}
			}
			uk += si[o]*co[o];
		}
		vector <int> v = ask(v1, v2);
		int br = 0; uk = 0;
		vector <int> deg(ncur.size(), 0);
		for (int o = 0; o < 2; o++) {
			for (int i = 0; i < si[o]; i++) {
				for (int a = 0; a < co[o]; a++) for (int b = a+1; b < co[o]; b++) {
					if (uk+i*co[o]+b < n) deg[v[br++]]++;
					else deg[uk+i*co[o]+a]++;
				}
				for (int a = 0; a < co[o]; a++) if (deg[uk+i*co[o]+a] == co[o]-1) ncur.pb(uk+i*co[o]+a);
			}
			uk += si[o]*co[o];
		}
		swap(ncur, cur);
	}
	return cur[0];
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 0
Runtime Error

input:

1000 1 499500 957319859

output:

Unauthorized output

result:


Pretest #2:

score: 0
Runtime Error

input:

1000000 20 2000000 29091473

output:

Unauthorized output

result:



Final Tests

Test #1:

score: 0
Runtime Error

input:

1000 1 499500 957319857

output:

Unauthorized output

result:


Test #2:

score: 0
Runtime Error

input:

1000000 20 2000000 29091471

output:

Unauthorized output

result: