# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
12352 |
2014-12-26T13:04:16 Z |
baneling100 |
전선 연결하기 (GA9_wire) |
C++ |
|
0 ms |
10460 KB |
#include <stdio.h>
int N, A[600001], Check[300001], S[600001], Top;
int M, Down[600001], Ans[300001];
int main(void) {
int i, j;
scanf("%d",&N);
for(i=1 ; i<=2*N ; i++)
scanf("%d",&A[i]);
for(i=1 ; i<=2*N ; i++) {
if(Check[A[i]]>0) {
Ans[A[i]]=1;
for(j=Check[A[i]]+1 ; j<=Top ; j++) {
Check[S[j]]=-1;
Down[++M]=S[j];
}
Top=Check[A[i]]-1;
Check[A[i]]=0;
}
else if(Check[A[i]]==0) {
S[++Top]=A[i];
Check[A[i]]=Top;
}
else {
Check[A[i]]=0;
Down[++M]=A[i];
}
}
Top=0;
for(i=1 ; i<=M ; i++) {
if(Check[Down[i]]) {
if(S[Top]!=Down[i]) {
printf("IMPOSSIBLE");
return 0;
}
Top--;
}
else {
Check[Down[i]]=1;
S[++Top]=Down[i];
}
}
for(i=1 ; i<=2*N ; i++) {
if(Ans[A[i]])
printf("^");
else
printf("v");
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
10460 KB |
Output is correct |
2 |
Correct |
0 ms |
10460 KB |
Output is correct |
3 |
Incorrect |
0 ms |
10460 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |