QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#488242#9156. 百万富翁frostaur_63.75 1908ms86152kbC++142.1kb2024-07-23 18:54:162024-07-23 18:54:16

Judging History

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

  • [2024-07-23 18:54:16]
  • 评测
  • 测评结果:63.75
  • 用时:1908ms
  • 内存:86152kb
  • [2024-07-23 18:54:16]
  • 提交

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-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;
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 0
Wrong Answer
time: 52ms
memory: 19940kb

input:

1000 1 499500 957319859

output:

Wrong answer
4459638610240858557
0.000000
6906350380861515327

result:

points 0.0 Wrong answer

Pretest #2:

score: 63.75
Acceptable Answer
time: 1908ms
memory: 86132kb

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: 0
Wrong Answer
time: 60ms
memory: 20048kb

input:

1000 1 499500 957319857

output:

Wrong answer
4459638610240858557
0.000000
6906350380861515327

result:

points 0.0 Wrong answer

Test #2:

score: 63.75
Acceptable Answer
time: 1898ms
memory: 86152kb

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