Submission #201730

#TimeUsernameProblemLanguageResultExecution timeMemory
201730a_playerArranging Shoes (IOI19_shoes)C++14
50 / 100
1091 ms137848 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5; deque<int> d[2*MAXN]; int sh[MAXN]; bitset<MAXN> v; long long count_swaps(vector<int> s) { int N=s.size(); long long ans=0; for(int i=0;i<N;i+=2){ int j=i+1; for(;j<N;j++)if(s[j]+s[i]==0)break; for(int k=j;k>=i+2;k--)swap(s[k],s[k-1]),ans++; if(s[i]>s[i+1])swap(s[i],s[i+1]),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...