제출 #1019957

#제출 시각아이디문제언어결과실행 시간메모리
1019957nisanduuArranging Shoes (IOI19_shoes)C++14
50 / 100
1072 ms4032 KiB
#include "shoes.h" #include <bits/stdc++.h> using namespace std; long long count_swaps(std::vector<int> s) { vector<int> cr = s; long long ans = 0; long long n = cr.size(); long long i=0; while(i<n){ long long pos = 0; for(long long j=i+1;j<n;j++){ if(cr[j]*-1 == cr[i]){ pos=j; break; } } long long end = i; if(cr[i]<0){ end = i+1; } //cout<<end<<endl; for(long long j=pos;j>end;j--){ if(j-1 < end){ break; } ans++; swap(cr[j],cr[j-1]); } i+=2; } return ans; }
#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...