Submission #11544

#TimeUsernameProblemLanguageResultExecution timeMemory
11544cki86201전선 연결하기 (GA9_wire)C++98
0 / 100
48 ms6068 KiB
#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("INVALID");return 0;} } puts(ans+1); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...