Submission #980093

#TimeUsernameProblemLanguageResultExecution timeMemory
980093ShaShiArranging Shoes (IOI19_shoes)C++17
10 / 100
1091 ms3364 KiB
#include "shoes.h" #include <bits/stdc++.h> #define F first #define S seond #define all(x) x.begin(), x.end() #define pb push_back #define mp make_pair #define pii pair<int, int> using namespace std; typedef long long ll; const int MAXN = (int)1e6 + 7; const int MOD = 998244353; const int INF = (int)1e9 + 7; int n, m, t, tmp, tmp2, tmp3, u, v, w, ans; ll count_swaps(vector<int> s) { n = s.size()/2; ans = 0; tmp = 0; while (tmp != n) { int j = 2*tmp; // cout << "!" << tmp << endl; while (s[j] >= 0) j++; while (j != 2*tmp) { swap(s[j], s[j-1]); ans++; j--; } j = 2*tmp+1; while (s[j] != 0-s[2*tmp]) j++; while (j != 2*tmp+1) { swap(s[j], s[j-1]); ans++; j--; } tmp++; } 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...