QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#518188#9156. 百万富翁Chendaqian100 ✓2218ms86564kbC++141.1kb2024-08-13 17:30:152024-08-13 17:30:15

Judging History

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

  • [2024-08-13 17:30:15]
  • 评测
  • 测评结果:100
  • 用时:2218ms
  • 内存:86564kb
  • [2024-08-13 17:30:15]
  • 提交

answer

#include "richest.h"
#include<bits/stdc++.h>
using namespace std;
const int k[9]={1000000,500000,250000,125000,62500,20833,3472,183,1};
int richest(int N, int T, int S) {
	if(N==1000&&T==1&&S==499500) {
		vector<int> a,b;
		for(int i=0;i<N;i++) for(int j=i+1;j<N;j++) {
			a.emplace_back(i);
			b.emplace_back(j);
		}
		vector<int> c(ask(a,b)),cnt(N,0);
		for(auto p:c) cnt[p]++;
		for(int i=0;i<N;i++) if(cnt[i]==N-1) return i;
		return 0;
	}
	vector<int> cur(N),a,b,c,cnt(N,0);
	for(int i=0;i<N;i++) cur[i]=i;
	vector<int> nw;
	for(int i=1;i<=8;i++) {
		int len=k[i-1]/k[i],lm=k[i-1]%k[i];
		a.clear(),b.clear(),c.clear();
		for(int j=0,st=0,ed;j<k[i];j++,st=ed) {
			ed=st+len+(j<lm);
			for(int x=st;x<ed;x++) for(int y=x+1;y<ed;y++)
				a.push_back(cur[x]),b.push_back(cur[y]);
		}
		c=ask(a,b);
		for(int j=0,st=0,ed,tot=0;j<k[i];j++,st=ed) {
			ed=st+len+(j<lm);
			for(int x=st;x<ed;x++) for(int y=x+1;y<ed;y++)
				cnt[c[tot++]]++;
			for(int x=st;x<ed;x++) {
				if(cnt[cur[x]]==ed-st-1) nw.push_back(cur[x]);
				cnt[cur[x]]=0;
			}
		}
		cur=nw;nw.clear();
	}
	return cur[0];
}

詳細信息


Pretests

Pretest #1:

score: 15
Accepted
time: 607ms
memory: 25332kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 85
Accepted
time: 2218ms
memory: 86376kb

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: 622ms
memory: 25412kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 85
Accepted
time: 2216ms
memory: 86564kb

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