QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#72456#5430. TriangeltalJerryTcl0 3ms7612kbC++14651b2023-01-15 16:48:172023-01-15 16:48:19

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 16:48:19]
  • 评测
  • 测评结果:0
  • 用时:3ms
  • 内存:7612kb
  • [2023-01-15 16:48:17]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int n, a[500007], d[500007], r[500007], mx;
int main() {
	scanf("%d", &n), iota(d + 1, d + 1 + n, 1);
	for(int i = 1; i <= n; ++i) scanf("%d", a + i);
	sort(d + 1, d + 1 + n, [&](int x, int y) { return a[x] < a[y]; });
	for(int i = n; i >= 1; --i) {
		if(a[d[i - 1]] > n - i + 1) continue;
		if(a[d[n]] + a[d[i - 1]] > i - 1) continue;
		puts("YES");
		for(int j = i; j <= n; ++j) r[d[j]] = 1;
		for(int j = i - a[d[n]]; j < i; ++j) r[d[j]] = 2;
		for(int j = 1; j < i - a[d[n]]; ++j) r[d[j]] = 3;
		for(int j = 1; j <= n; ++j) printf("%d", d[j]);
		return 0;
	}
	return puts("NO"), 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 14
Accepted
time: 1ms
memory: 7592kb

input:

3
1 1 1

output:

YES
123

result:

ok Correct

Test #2:

score: 0
Accepted
time: 0ms
memory: 7372kb

input:

3
2 2 2

output:

NO

result:

ok Correct

Test #3:

score: -14
Wrong Answer
time: 3ms
memory: 7612kb

input:

10
1 1 1 1 1 1 1 1 1 1

output:

YES
12345678910

result:

wrong answer Length of output was 11 instead of 10

Subtask #2:

score: 0
Wrong Answer

Test #11:

score: 16
Accepted
time: 1ms
memory: 7608kb

input:

3
1 1 1

output:

YES
123

result:

ok Correct

Test #12:

score: 0
Accepted
time: 3ms
memory: 7516kb

input:

3
1 2 2

output:

NO

result:

ok Correct

Test #13:

score: -16
Wrong Answer
time: 0ms
memory: 7608kb

input:

9
3 3 3 3 3 3 3 3 3

output:

YES
123456789

result:

wrong answer Output contained invalid character

Subtask #3:

score: 0
Wrong Answer

Test #24:

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

input:

4
1 1 1 1

output:

YES
1234

result:

wrong answer Output contained invalid character

Subtask #4:

score: 0
Skipped

Dependency #2:

0%

Subtask #5:

score: 0
Skipped

Dependency #1:

0%