제출 #980106

#제출 시각아이디문제언어결과실행 시간메모리
980106ShaShiArranging Shoes (IOI19_shoes)C++17
50 / 100
1087 ms1988 KiB
#include "shoes.h" #include <bits/stdc++.h> #define F first #define S seond #define all(x) x.begin(), x.end() #define pb push_back #define mp make_pair #define pii pair<int, int> using namespace std; typedef long long ll; const int MAXN = (int)1e6 + 7; const int MOD = 998244353; const int INF = (int)1e9 + 7; int n, m, t, tmp, tmp2, tmp3, u, v, w, ans; ll count_swaps(vector<int> s) { n = s.size()/2; ans = 0; tmp = 0; while (tmp != n) { int j = 2*tmp; // cout << "!" << tmp << endl; // while (s[j] >= 0) j++; // while (j != 2*tmp) { // swap(s[j], s[j-1]); // ans++; j--; // } j = 2*tmp+1; while (s[j] != 0-s[2*tmp]) j++; while (j != 2*tmp+1) { swap(s[j], s[j-1]); ans++; j--; } if (s[2*tmp] >= 0) ans++; tmp++; } 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...