QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#488675#9156. 百万富翁qwqUwU_100 ✓2648ms90388kbC++171.3kb2024-07-24 13:44:052024-07-24 13:44:05

Judging History

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

  • [2024-07-24 13:44:05]
  • 评测
  • 测评结果:100
  • 用时:2648ms
  • 内存:90388kb
  • [2024-07-24 13:44:05]
  • 提交

answer

#include "richest.h"
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
#define pb push_back
const int N=1e6;
int richest(int n, int T, int S) {
	if(T==1){
		vi a,b;
		rep(i,1,n-1)rep(j,0,i-1)a.pb(i),b.pb(j);
		vi res=ask(a,b);
		static int cnt[1000];
		rep(i,0,n-1)cnt[i]=0;
		for(auto x:res)++cnt[x];
		rep(i,0,n-1)if(cnt[i]==n-1)return i;
	}
	const int dx[9]={1,183,3472,20832,62496,125000,250000,500000,1000000};
	vi A;rep(i,0,n-1)A.pb(i);
	per(t,8,1){
		static int cnt[N];
		rep(i,0,n-1)cnt[i]=0;
		vi a,b,B;
		int x=dx[t-1],y=dx[t],b1=y/x,b2=y%x,idx=0;
		rep(i,1,b2){
			vi c;
			rep(j,1,b1+1)c.pb(A[idx++]);
			rep(j,0,b1)rep(k,0,j-1)a.pb(c[j]),b.pb(c[k]);
		}
		rep(i,1,x-b2){
			vi c;
			rep(j,1,b1)c.pb(A[idx++]);
			rep(j,0,b1-1)rep(k,0,j-1)a.pb(c[j]),b.pb(c[k]);
		}
		vi res=ask(a,b);
		idx=0;int tp=0;
		rep(i,1,b2){
			vi c;
			rep(j,1,b1+1)c.pb(A[idx++]);
			rep(j,0,b1)rep(k,0,j-1)++cnt[res[tp]],++tp;
			for(auto x:c)if(cnt[x]==b1)B.pb(x);
		}
		rep(i,1,x-b2){
			vi c;
			rep(j,1,b1)c.pb(A[idx++]);
			rep(j,0,b1-1)rep(k,0,j-1)++cnt[res[tp]],++tp;
			for(auto x:c)if(cnt[x]==b1-1)B.pb(x);
		}
		A.swap(B);
	}
	return A[0];
}

详细


Pretests

Pretest #1:

score: 15
Accepted
time: 609ms
memory: 23108kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 85
Accepted
time: 2648ms
memory: 90388kb

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: 610ms
memory: 22960kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 85
Accepted
time: 2648ms
memory: 90312kb

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