QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#508620#9156. 百万富翁Ecrade_77.99996 2428ms86024kbC++143.5kb2024-08-07 18:10:532024-08-07 18:10:53

Judging History

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

  • [2024-08-07 18:10:53]
  • 评测
  • 测评结果:77.99996
  • 用时:2428ms
  • 内存:86024kb
  • [2024-08-07 18:10:53]
  • 提交

answer

#include "richest.h"
#include <bits/stdc++.h>
using namespace std;
#include "richest.h"
#include <bits/stdc++.h>
using namespace std;
int richest(int n,int t,int s){
	if (n == 1000){
		map <int,int> cnt;
		vector <int> a,b,c;
		for (int i = 0;i < n;i += 1) for (int j = i + 1;j < n;j += 1) a.emplace_back(i),b.emplace_back(j);
		c = ask(a,b);
		for (int i = 0;i < c.size();i += 1) cnt[c[i]] += 1;
		for (int i = 0;i < n;i += 1) if (cnt[i] == n - 1) return i;
		return 0;
	}
	vector <int> now;
	for (int i = 0;i < n;i += 1) now.emplace_back(i);
	for (int i = 0;i < 3;i += 1){
		vector <int> a,b,c,tmp;
		for (int j = 0;j < n - 1;j += 2) a.emplace_back(now[j]),b.emplace_back(now[j + 1]);
		for (int j = n / 2 * 2;j < n;j += 1) tmp.emplace_back(now[j]);
		c = ask(a,b);
		for (int j = 0;j < c.size();j += 1) tmp.emplace_back(c[j]);
		swap(now,tmp),n = now.size();
	}
	for (int i = 0;i < 1;i += 1){
		vector <int> a,b,c,tmp;
		for (int j = 0;j < n - 2;j += 3){
			a.emplace_back(now[j]),b.emplace_back(now[j + 1]);
			a.emplace_back(now[j]),b.emplace_back(now[j + 2]);
			a.emplace_back(now[j + 1]),b.emplace_back(now[j + 2]);
		}
		for (int j = n / 3 * 3;j < n;j += 1) tmp.emplace_back(now[j]);
		c = ask(a,b);
		for (int j = 0;j < n - 2;j += 3){
			if (c[j] == now[j] && c[j + 1] == now[j]) tmp.emplace_back(now[j]);
			else tmp.emplace_back(c[j + 2]);
		}
		swap(tmp,now),n = now.size();
	}
	for (int i = 0;i < 1;i += 1){
		vector <int> a,b,c,tmp;
		for (int j = 0;j < n - 3;j += 4){
			a.emplace_back(now[j]),b.emplace_back(now[j + 1]);
			a.emplace_back(now[j + 2]),b.emplace_back(now[j + 3]);
			a.emplace_back(now[j]),b.emplace_back(now[j + 2]);
			a.emplace_back(now[j + 1]),b.emplace_back(now[j + 3]);
			a.emplace_back(now[j]),b.emplace_back(now[j + 3]);
		}
		for (int j = n / 4 * 4;j < n;j += 1) tmp.emplace_back(now[j]);
		c = ask(a,b);
		for (int j = 0,qwq = 0;j < n - 3;j += 4,qwq += 5){
			if (c[qwq] == now[j] && c[qwq + 1] == now[j + 2]) tmp.emplace_back(c[qwq + 2]);
			else if (c[qwq] == now[j + 1] && c[qwq + 1] == now[j + 3]) tmp.emplace_back(c[qwq + 3]);
			else if (c[qwq] == now[j] && c[qwq + 1] == now[j + 3]) tmp.emplace_back(c[qwq + 4]);
			else if (c[qwq + 2] == now[j]) tmp.emplace_back(now[j + 1]);
			else if (c[qwq + 3] == now[j + 3]) tmp.emplace_back(now[j + 2]);
			else tmp.emplace_back(c[qwq]),tmp.emplace_back(c[qwq + 1]);
		}
		swap(tmp,now),n = now.size();
	}
	for (int i = 0;i < 3;i += 1){
		vector <int> a,b,c,tmp;
		for (int j = 0;j < n - 3;j += 4){
			a.emplace_back(now[j]),b.emplace_back(now[j + 1]);
			a.emplace_back(now[j]),b.emplace_back(now[j + 2]);
			a.emplace_back(now[j]),b.emplace_back(now[j + 3]);
			a.emplace_back(now[j + 1]),b.emplace_back(now[j + 2]);
			a.emplace_back(now[j + 1]),b.emplace_back(now[j + 3]);
			a.emplace_back(now[j + 2]),b.emplace_back(now[j + 3]);
		}
		for (int j = n / 4 * 4;j < n;j += 1) tmp.emplace_back(now[j]);
		c = ask(a,b);
		map <int,int> cnt;
		for (int j = 0,qwq = 0;j < n - 3;j += 4,qwq += 6){
			for (int k = 0;k < 6;k += 1) cnt[c[qwq + k]] += 1;
			for (int k = 0;k < 4;k += 1) if (cnt[now[j + k]] == 3){tmp.emplace_back(now[j + k]); break;}
		}
		swap(tmp,now),n = now.size();
	}
	vector <int> a,b,c;
	for (int i = 0;i < n;i += 1) for (int j = i + 1;j < n;j += 1) a.emplace_back(now[i]),b.emplace_back(now[j]);
	c = ask(a,b);
	map <int,int> cnt;
	for (int i = 0;i < c.size();i += 1) cnt[c[i]] += 1;
	for (int i = 0;i < n;i += 1) if (cnt[now[i]] == n - 1) return now[i];
	return 0;
}

详细


Pretests

Pretest #1:

score: 15
Accepted
time: 729ms
memory: 22032kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 63
Acceptable Answer
time: 2428ms
memory: 86024kb

input:

1000000 20 2000000 29091473

output:

Partially correct Case 2, 63 / 85, maxt = 9, maxs = 1085794
7090594423343994649
0.741176
16601290867448354019

result:

points 0.741176 Partially correct Case 2, 63 / 85, maxt = 9, maxs = 1085794


Final Tests

Test #1:

score: 15
Accepted
time: 724ms
memory: 25360kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 63
Acceptable Answer
time: 2426ms
memory: 85984kb

input:

1000000 20 2000000 29091471

output:

Partially correct Case 2, 63 / 85, maxt = 9, maxs = 1085794
7090594423343994649
0.741176
16601290867448354019

result:

points 0.741176 Partially correct Case 2, 63 / 85, maxt = 9, maxs = 1085794