QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#508865#9156. 百万富翁Ecrade_15 857ms101880kbC++141.2kb2024-08-07 20:58:002024-08-07 20:58:01

Judging History

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

  • [2024-08-07 20:58:01]
  • 评测
  • 测评结果:15
  • 用时:857ms
  • 内存:101880kb
  • [2024-08-07 20:58:00]
  • 提交

answer

#include "richest.h"
#include <bits/stdc++.h>
using namespace std;
int n;
vector <int> now;
void work(int x){
	vector <int> a,b,c,tmp;
	for (int j = 0;j < n - x + 1;j += x){
		for (int k = 0;k < x;k += 1) for (int l = k + 1;l < x;l += 1){
			a.emplace_back(now[j + k]);
			b.emplace_back(now[j + l]);
		}
	}
	for (int j = n / x * x;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 - x + 1;j += x,qwq += x * (x - 1) / 2){
		for (int k = 0;k < x * (x - 1) / 2;k += 1) cnt[c[qwq + k]] += 1;
		for (int k = 0;k < x;k += 1) if (cnt[now[j + k]] == x - 1){tmp.emplace_back(now[j + k]); break;}
	}
	swap(tmp,now),n = now.size();
}
int richest(int m,int t,int s){
	n = m;
	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;
	}
	for (int i = 0;i < n;i += 1) now.emplace_back(i);
	work(2),work(2),work(2),work(2),work(3),work(6),work(19),work(n);
	return now[0];
}

詳細信息


Pretests

Pretest #1:

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

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 0
Wrong Answer
time: 857ms
memory: 101880kb

input:

1000000 20 2000000 29091473

output:

Wrong answer
4459638610240858557
0.000000
6906350380861515327

result:

points 0.0 Wrong answer


Final Tests

Test #1:

score: 15
Accepted
time: 737ms
memory: 25444kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 0
Wrong Answer
time: 844ms
memory: 101852kb

input:

1000000 20 2000000 29091471

output:

Wrong answer
4459638610240858557
0.000000
6906350380861515327

result:

points 0.0 Wrong answer