제출 #165440

#제출 시각아이디문제언어결과실행 시간메모리
165440piyushkumarArranging Shoes (IOI19_shoes)Java
50 / 100
1045 ms13812 KiB
class shoes{ public static long count_swaps(int[] n) { long c=0; for (int i=0;i<n.length;i+=2){ int j; int x=-n[i]; for (j=i+1;j<n.length;j++){ if(n[j]==x) break; } while (j>i+1){ if(n[j-1]==n[j]){ j--; continue; } int d=n[j-1]; n[j-1]=n[j]; n[j]=d; c++; j--; } if(n[i]>0){ int d=n[j-1]; n[j-1]=n[j]; n[j]=d; c++; } } return c; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...