QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#741429#9156. 百万富翁Skadi_H85 2303ms104348kbC++141.0kb2024-11-13 14:21:082024-11-13 14:21:10

Judging History

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

  • [2024-11-13 14:21:10]
  • 评测
  • 测评结果:85
  • 用时:2303ms
  • 内存:104348kb
  • [2024-11-13 14:21:08]
  • 提交

answer

#include "richest.h"
#include <bits/stdc++.h>
using namespace std;
int len[8]={500000,250000,125000,62500,20833,3472,183,1};
bool vis[1000005];
vector<int>lft,a,b,res,lin;
int richest(int N,int T,int S){
	lft.resize(N);
	for(int i=0;i<=N;i++){
		lft[i]=i;
	}
	for(int o=0;o<8;o++){
		vector<int>().swap(a);
		vector<int>().swap(b);
		int q=N/len[o],r=N%len[o];
		int pos=0;
		for(int i=1;i<=len[o]-r;i++,pos+=q){
			for(int j=pos;j<pos+q;j++){
				for(int k=pos;k<j;k++){
					a.push_back(lft[j]);
					b.push_back(lft[k]);
				} 
			}
		}
		for(int i=1;i<=r;i++,pos+=q+1){
			for(int j=pos;j<pos+q+1;j++){
				for(int k=pos;k<j;k++){
					a.push_back(lft[j]);
					b.push_back(lft[k]);
				}
			}
		}
		res=ask(a,b);
		for(int i=0;i<a.size();i++){
			if(res[i]==a[i])
				vis[b[i]]=1;
			else
				vis[a[i]]=1;
		}
		for(int x:lft){
			if(!vis[x])
				lin.push_back(x);
		}
		lft=lin;
		vector<int>().swap(lin);
		N=lft.size();
		memset(vis,0,sizeof vis);
	}
	return lft[0];
}
//Skadi_H

Details

Tip: Click on the bar to expand more detailed information

Pretests

Pretest #1:

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

input:

1000 1 499500 957319859

output:

Too many queries
1294109832092195181
0.000000
6906350380861515327

result:

points 0.0 Too many queries

Pretest #2:

score: 85
Accepted
time: 2299ms
memory: 104348kb

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

input:

1000 1 499500 957319857

output:

Too many queries
1294109832092195181
0.000000
6906350380861515327

result:

points 0.0 Too many queries

Test #2:

score: 85
Accepted
time: 2303ms
memory: 83456kb

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