제출 #340615

#제출 시각아이디문제언어결과실행 시간메모리
340615israeladewuyiArranging Shoes (IOI19_shoes)C++17
10 / 100
1086 ms3436 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<string> vs; #define PB push_back #define pb pop_back #define in insert #define endl "\n" const unsigned int M = 1000000007; ll count_swaps(vi s){ ll n = s.size(); vector<ll>arr(n); for(int i =0; i < n; i++){ arr[i] = s[i]; } ll swaps = 0; for(int i = 0; i < n; i+=2){ ll ind = -1; for(int j = 0; j < n; j++){ if(arr[j] == -arr[i]){ ind = j; break; } } for(int j = ind; j > i+1; j--){ swap(arr[j], arr[j-1]); swaps++; } if(arr[i] > 0)swaps++; } return swaps; } //int main(){ // vi v; // v.PB(-2); // v.PB(2); //// v.PB(2); //// v.PB(-2); // cout<<count_swaps(v); //}
#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...