QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#488244#9156. 百万富翁frostaur_78.75 1947ms86208kbC++142.1kb2024-07-23 18:55:132024-07-23 18:55:13

Judging History

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

  • [2024-07-23 18:55:13]
  • 评测
  • 测评结果:78.75
  • 用时:1947ms
  • 内存:86208kb
  • [2024-07-23 18:55:13]
  • 提交

answer

#include "richest.h"
#include<bits/stdc++.h>
using namespace std;
#define rep(x,qwq,qaq) for(int (x)=(qwq);(x)<=(qaq);++(x))
#define emp emplace_back
int richest(int N,int T,int S) {
	int n=N;
	if(T==1) {
		vector<int>a(N*(N-1)/2),b(N*(N-1)/2);
		int tot=-1;
		rep(i,0,n-1)rep(j,i+1,n-1) {
			++tot;
			a[tot]=i,b[tot]=j;
		}
		vector<int>c=ask(a,b);
		tot=-1;
		rep(i,0,n-1) {
			int cnt=0;
			rep(j,i+1,n-1) {
				++tot;
				cnt+=(c[tot]==i);
			}
			if(cnt==n-1-i)return i;
		}
	} else {
		vector<int>rest(N);
		rep(i,0,N-1)rest[i]=i;
		while(rest.size()>1) {
			int sz=rest.size();
			vector<int>nw;
			if(sz<=245) {
				vector<int>a(sz*(sz-1)/2),b(sz*(sz-1)/2);
				int tot=-1;
				rep(i,0,sz-1)rep(j,i+1,sz-1) {
					++tot;
					a[tot]=rest[i],b[tot]=rest[j];
				}
				vector<int>c=ask(a,b);
				tot=-1;
				rep(i,0,sz-1) {
					int cnt=0;
					rep(j,i+1,sz-1) {
						++tot;
						cnt+=(c[tot]==rest[i]);
					}
					if(cnt==sz-1-i)return rest[i];
				}
			} else if(sz<=62500) {
				vector<int>a,b;
				rep(i,0,sz/4-1) {
					rep(j,i*4,i*4+3) {
						rep(k,j+1,i*4+3) {
							a.emp(rest[j]),b.emp(rest[k]);
						}
					}
				}
				rep(i,sz-sz%4,sz-1) {
					rep(j,i+1,sz-1) {
						a.emp(rest[i]),b.emp(rest[j]);
					}
				}
				vector<int>c=ask(a,b);
				int tot=-1;
				rep(i,0,sz/4-1) {
					int flag=0;
					rep(j,i*4,i*4+3) {
						int cnt=0;
						rep(k,j+1,i*4+3) {
							++tot;
							cnt+=(c[tot]==rest[j]);
						}
						if(cnt==i*4+3-j&&!flag) {
                            nw.emp(rest[j]);
                            flag=1;
						}
					}
				}
				rep(i,sz-sz%4,sz-1) {
					int cnt=0;
					rep(j,i+1,sz-1) {
						++tot;
						cnt+=(c[tot]==rest[i]);
					}
					if(cnt==sz-1-i){
						nw.emp(rest[i]);
						break;
					}
				}
			} else {
				vector<int>a(sz/2),b(sz/2);
				rep(i,0,sz/2-1) {
					a[i]=rest[i*2];
					b[i]=rest[i*2+1];
					--S;
				}
				nw=ask(a,b);
				if(sz&1)nw.emp(rest[sz-1]);
			}
			rest=nw;
			--T;
		}
		assert(rest.size()==1&&S>=0&&T>=0);
		return rest[0];
	}
	return 20080111;
}

詳細信息


Pretests

Pretest #1:

score: 15
Accepted
time: 611ms
memory: 20520kb

input:

1000 1 499500 957319859

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Pretest #2:

score: 63.75
Acceptable Answer
time: 1947ms
memory: 86020kb

input:

1000000 20 2000000 29091473

output:

Partially correct Case 2, 63 / 85, maxt = 9, maxs = 1091899
15924754611964940863
0.750000
5959859307801994407

result:

points 0.75 Partially correct Case 2, 63 / 85, maxt = 9, maxs = 1091899


Final Tests

Test #1:

score: 15
Accepted
time: 605ms
memory: 20668kb

input:

1000 1 499500 957319857

output:

Correct
7127326332295218295
1.000000
1331569654267968081

result:

points 1.0 Correct

Test #2:

score: 63.75
Acceptable Answer
time: 1931ms
memory: 86208kb

input:

1000000 20 2000000 29091471

output:

Partially correct Case 2, 63 / 85, maxt = 9, maxs = 1091899
15924754611964940863
0.750000
5959859307801994407

result:

points 0.75 Partially correct Case 2, 63 / 85, maxt = 9, maxs = 1091899