QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#222160#7617. Spectacleucup-team191#WA 1ms3144kbC++141.1kb2023-10-21 16:08:092023-10-21 16:08:09

Judging History

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

  • [2023-10-21 16:08:09]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3144kb
  • [2023-10-21 16:08:09]
  • 提交

answer

#include <cstdio>
#include <vector>
#include <algorithm>

#define X first
#define Y second
#define PB push_back

using namespace std;

typedef long long ll;

const int N = 1e6 + 500;

ll treba[N];
int n, par[N], siz[N], mogu;

vector < ll > v;

int pr(int x) {
	if(par[x] == x) return x;
	return par[x] = pr(par[x]);
}

void mrg(int x, int y) {
	x = pr(x); y = pr(y);
	if(x == y) return;
	mogu -= siz[x] / 2;
	mogu -= siz[y] / 2;
	siz[x] += siz[y];
	mogu += siz[x] / 2;
	par[y] = x;	
}

vector < pair < ll, int > > vp;

int main(){
	scanf("%d", &n);
	for(int i = 0;i < n;i++) {
		ll x; scanf("%lld", &x);
		v.PB(x); par[i] = i; siz[i] = 1;
		treba[i] = (ll)1e18 + 500;
	}
	sort(v.begin(), v.end());
	for(int i = 0;i + 1 < n;i++)
		vp.PB({v[i + 1] - v[i], i + 1});
	sort(vp.begin(), vp.end());
	for(auto tmp : vp) {
		mrg(tmp.Y, tmp.Y + 1);
		treba[mogu] = min(treba[mogu], tmp.X);
	}
	for(int i = n / 2;i >= 1;i--) treba[i] = min(treba[i], treba[i + 1]);
	for(int i = 1;i <= n / 2;i++) printf("%lld ", treba[i]);
	printf("\n");
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3132kb

input:

6
100 13 20 14 10 105

output:

1 5 6 

result:

ok single line: '1 5 6 '

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3144kb

input:

2
1 1000000000000000000

output:

0 

result:

wrong answer 1st lines differ - expected: '999999999999999999', found: '0 '