Submission #447846

#TimeUsernameProblemLanguageResultExecution timeMemory
447846MohamedAliSaidaneArranging Shoes (IOI19_shoes)C++14
25 / 100
98 ms70816 KiB
#include "shoes.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<ll> vll; typedef pair<ll,ll> pll; #define pb push_back #define popb pop_back #define ff first #define ss second const ll MOD = 1e9 + 7; const ll INF = 1e18; ll count_swaps(vi s) { int n =s.size()/2; if(n == 1) { if(s[0] <= 0) return 0; else return 1; } else { queue<int> pos[n+1]; ll ans = 0; for(int i = n; i < 2 *n; i ++) { pos[s[i]].push(i); } for(int i= 0; i < n; i ++) { ans += pos[-s[i]].front() - 2 * i - 1; pos[-s[i]].pop(); } return ans; } return 1; }
#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...