제출 #604453

#제출 시각아이디문제언어결과실행 시간메모리
604453pawnedArranging Shoes (IOI19_shoes)C++17
0 / 100
1 ms336 KiB
#include "shoes.h" #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define fi first #define se second #define pb push_back typedef long long ll; typedef pair<int, int> ii; typedef vector<int> vi; typedef tree<int, null_type, greater<int>, rb_tree_tag, tree_order_statistics_node_update> pbds; long long count_swaps(std::vector<int> s) { ll N = s.size() / 2; int shoes[2 * N]; for (int i = 0; i < 2 * N; i++) { shoes[i] = s[i]; } int counter = 0; for (int i = 0; i < 2 * N; i += 2) { int find = -shoes[i]; int pos = -1; for (int j = i + 1; j < 2 * N; j++) { if (shoes[j] == find) pos = j; } for (int j = pos; j > i; j--) { swap(shoes[j], shoes[j + 1]); counter++; } } return counter; }
#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...