Submission #283548

#TimeUsernameProblemLanguageResultExecution timeMemory
283548test2Arranging Shoes (IOI19_shoes)C++14
50 / 100
1089 ms2812 KiB
#include<bits/stdc++.h> #include "shoes.h" #define I inline void using namespace std ; using ll = long long ; using ld = long double ; const int N = 3000 + 7 , mod = 1e9 + 7 ; // How interesting! int n; long long count_swaps(std::vector<int> s) { int n = (int) s.size() ; ll ret = 0 ; for(int i = 0 ;i < n; i+=2){ for(int j = i + 1;j < n ;j ++){ if(abs(s[i]) == abs(s[j]) && s[i] * s[j] < 0){ for(int k = j - 1; k > i ;k --){ swap(s[k] , s[k+1]) ; ret++; } break ; } } if(s[i] > s[i+1]){ ret++ ; } } return ret; }
#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...