Submission #298951

#TimeUsernameProblemLanguageResultExecution timeMemory
298951TMJNArranging Shoes (IOI19_shoes)C++17
50 / 100
1088 ms3224 KiB
#include <bits/stdc++.h> #include "shoes.h" using namespace std; long long count_swaps(vector<int>v) { int N=v.size(); long long t=0; for(int i=0;i<N;i+=2){ for(int j=i+1;j<N;j++){ if(v[j]==-v[i]){ for(int k=j-1;k>i;k--){ swap(v[k],v[k+1]); t++; } break; } } if(v[i]>0){ swap(v[i],v[i+1]); t++; } } return t; }
#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...