Submission #424761

#TimeUsernameProblemLanguageResultExecution timeMemory
424761alireza_kavianiArranging Shoes (IOI19_shoes)C++14
50 / 100
1091 ms6568 KiB
#include "shoes.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAXN = 2e5 + 10; int n; vector<int> pos[MAXN]; ll count_swaps(vector<int> s) { n = s.size() / 2; ll ans = 0; for(int i = 0 ; i < n * 2 ; i += 2){ int p = -1; for(int j = i ; j < n * 2 ; j++){ if(s[i] + s[j] == 0){ p = j; break; } } for(int j = p ; j > i + 1 ; j--){ swap(s[j] , s[j - 1]); ans++; } if(s[i] > 0) ans++; } 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...