Submission #12352

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
123522014-12-26 13:04:16baneling100전선 연결하기 (GA9_wire)C++98
0 / 100
0 ms10460 KiB
#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];
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...