QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#72275#5430. TriangeltalJerryTcl0 1ms5728kbC++14619b2023-01-15 11:52:292023-01-15 11:52:47

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-15 11:52:47]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:5728kb
  • [2023-01-15 11:52:29]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int n, a[500007], c[500007], mx;
int main() {
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i)
		scanf("%d", a + i), ++c[a[i]], mx = max(mx, a[i]);
	for(int i = n, p = n, m = 0, x = 1, l = 0; i >= 1; --i) {
		if(m += c[i], !c[i]) continue;
		while(p >= i || !c[p]) --p;
		while(x <= m || !c[x]) l += c[x++];
		if(mx + p < n - m || l < p) continue;
		puts("YES");
		for(int j = 1; j <= n; ++j)
			if(a[j] >= i) putchar('1');
			else if(a[j] >= x) putchar('2');
			else if(p) putchar('3'), --p;
			else putchar('2');
		return 0;
	}
	return puts("NO"), 0;
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

input:

3
1 1 1

output:

NO

result:

wrong answer Contestant said no, but judge found a solution

Subtask #2:

score: 0
Wrong Answer

Test #11:

score: 0
Wrong Answer
time: 1ms
memory: 5728kb

input:

3
1 1 1

output:

NO

result:

wrong answer Contestant said no, but judge found a solution

Subtask #3:

score: 0
Wrong Answer

Test #24:

score: 0
Wrong Answer
time: 1ms
memory: 5688kb

input:

4
1 1 1 1

output:

NO

result:

wrong answer Contestant said no, but judge found a solution

Subtask #4:

score: 0
Skipped

Dependency #2:

0%

Subtask #5:

score: 0
Skipped

Dependency #1:

0%