Submission #1040823

#TimeUsernameProblemLanguageResultExecution timeMemory
1040823idasArranging Shoes (IOI19_shoes)C++17
45 / 100
17 ms2776 KiB
#include "shoes.h" #include <bits/stdc++.h> #define FOR(i, begin, end) for(int i=(begin); i<(end); i++) #define pb push_back using namespace std; typedef long long ll; typedef vector<int> vi; const int N=1e5+10; int n; long long count_swaps(vector<int> s) { n=s.size(); vi pos; FOR(i, 0, n) if(s[i]<0) pos.pb(i); ll ans=0; int in=n-2; for(int i=n/2-1; i>=0; i--){ ans+=abs(in-pos[i]); in-=2; // cout << pos[i] << " " << in << endl; } 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...