QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#72275 | #5430. Triangeltal | JerryTcl | 0 | 1ms | 5728kb | C++14 | 619b | 2023-01-15 11:52:29 | 2023-01-15 11:52:47 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
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%