QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#513149#9156. 百万富翁Line120 23ms52112kbC++141.0kb2024-08-10 17:03:592024-08-10 17:04:06

Judging History

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

  • [2024-08-10 17:04:06]
  • 评测
  • 测评结果:0
  • 用时:23ms
  • 内存:52112kb
  • [2024-08-10 17:03:59]
  • 提交

answer

#include<bits/stdc++.h>
#include "richest.h"
using namespace std;
const int N=1000009;
int n,p[N],deg[N],m,q[N];
vector<int> a,b,c;
void solve(int x){
	a.clear();
	b.clear();
	int t=n/x;
	int l=0,r=0;
	for(int i=1;i<=x-n%x;i++){
		l=r+1;
		r=l+t-1;
		for(int j=l;j<=r-1;j++)
		    for(int k=j+1;k<=r;k++){
		    	a.push_back(p[j]);
		    	b.push_back(p[k]);
			}
	}
	for(int i=1;i<=n%x;i++){
		l=r+1;
		r=l+t;
		for(int j=l;j<=r-1;j++)
		    for(int k=j+1;k<=r;k++){
		    	a.push_back(p[j]);
		    	b.push_back(p[k]);
			}
	}
	c=ask(a,b);
	int tmp=0;
	for(int i=1;i<=1000000;i++)
	    deg[i]=0;
	for(int i=0;i<c.size();i++){
		if(a[i]==c[i])deg[b[i]]++;
		else deg[a[i]]++;
	}
	m=0;
	for(int i=1;i<=n;i++){
		if(deg[p[i]]!=0)continue;
		q[++m]=p[i];
	}
	n=m;
}
int richest(int N,int T,int S){
	n=N;
	for(int i=1;i<=n;i++)
	    p[i]=i;
	if(n==1000)
		solve(1);
	else{
		solve(500000);
		solve(250000);
		solve(125000);
		solve(62496);
		solve(20832);
		solve(3472);
		solve(183);
		solve(1);
	}
	return p[1];
}

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

score: 0
Wrong Answer
time: 0ms
memory: 19208kb

input:

1000 1 499500 957319859

output:

Index out of bounds
9775460264716263939
0.000000
6906350380861515327

result:

points 0.0 Index out of bounds

Pretest #2:

score: 0
Wrong Answer
time: 23ms
memory: 52064kb

input:

1000000 20 2000000 29091473

output:

Index out of bounds
9775460264716263939
0.000000
6906350380861515327

result:

points 0.0 Index out of bounds


Final Tests

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 19172kb

input:

1000 1 499500 957319857

output:

Index out of bounds
9775460264716263939
0.000000
6906350380861515327

result:

points 0.0 Index out of bounds

Test #2:

score: 0
Wrong Answer
time: 17ms
memory: 52112kb

input:

1000000 20 2000000 29091471

output:

Index out of bounds
9775460264716263939
0.000000
6906350380861515327

result:

points 0.0 Index out of bounds