Submission #832103

#TimeUsernameProblemLanguageResultExecution timeMemory
832103maomao90Arranging Shoes (IOI19_shoes)C++17
45 / 100
22 ms3924 KiB
// I can do all things through Christ who strengthens me // Philippians 4:13 #include "shoes.h" #include "bits/stdc++.h" using namespace std; #define REP(i, j, k) for (int i = j; i < (k); i++) #define RREP(i, j, k) for (int i = j; i >= (k); i--) template <class T> inline bool mnto(T &a, const T b) {return a > b ? a = b, 1 : 0;} template <class T> inline bool mxto(T &a, const T b) {return a < b ? a = b, 1 : 0;} typedef long long ll; typedef long double ld; #define FI first #define SE second typedef pair<int, int> ii; typedef pair<ll, ll> pll; #define SZ(x) (int) x.size() #define ALL(x) x.begin(), x.end() #define pb push_back typedef vector<int> vi; typedef vector<ii> vii; typedef vector<ll> vll; typedef tuple<int, int, int> iii; typedef vector<iii> viii; #ifndef DEBUG #define cerr if (0) cerr #endif const int INF = 1000000005; const ll LINF = 1000000000000000005; const int MAXN = 100005; int n; namespace st3 { ll count_swaps(vi s) { int ptr = 0; ll ans = 0; REP (i, 0, 2 * n) { if (s[i] < 0) { ans += abs(i - ptr); ptr += 2; } } return ans; } } ll count_swaps(vi s) { n = SZ(s) / 2; bool st3 = 1; REP (i, 1, 2 * n) { if (abs(s[i]) != abs(s[i - 1])) { st3 = 0; } } if (st3) { return st3::count_swaps(s); } ll ans = 0; REP (i, 0, n) { ans += i; } 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...