QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#72456 | #5430. Triangeltal | JerryTcl | 0 | 3ms | 7612kb | C++14 | 651b | 2023-01-15 16:48:17 | 2023-01-15 16:48:19 |
Judging History
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%