Submission #11548

# Submission time Handle Problem Language Result Execution time Memory
11548 2014-11-30T21:53:30 Z tncks0121 전선 연결하기 (GA9_wire) C++14
0 / 100
76 ms 6068 KB
#include<stdio.h>
 
int a[2][300030];
int t[2];
int n, p[300030], l[300030];
char ans[300030];
 
int main()
{
    scanf("%d",&n);
    int i;
    for(i=1;i<=n+n;i++){
        int x;
        scanf("%d",&x);
        if(p[x] == 0)p[x] = i;
        else l[i] = p[x], l[p[x]] = i;
    }
    for(i=1;i<=n+n;i++){
        if(t[0] != 0 && a[0][t[0]-1] == i)--t[0];
        if(t[1] != 0 && a[1][t[1]-1] == i)--t[1];
        if(l[i] < i)continue;
        if(t[0] == 0 || l[i] < a[0][t[0]-1])a[0][t[0]++] = l[i], ans[i] = ans[l[i]] = '^';
        else if(t[1] == 0 || l[i] < a[1][t[1]-1])a[1][t[1]++] = l[i], ans[i] = ans[l[i]] = 'v';
        else{printf("IMPOSSIBLE");return 0;}
    }
    puts(ans+1);
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 6068 KB Output is correct
2 Correct 0 ms 6068 KB Output is correct
3 Incorrect 0 ms 6068 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 6068 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 6068 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 52 ms 6068 KB Output is correct
2 Incorrect 76 ms 6068 KB Output isn't correct
3 Halted 0 ms 0 KB -