제출 #219016

#제출 시각아이디문제언어결과실행 시간메모리
219016sidiq_haArranging Shoes (IOI19_shoes)C++14
10 / 100
63 ms81952 KiB
#include<bits/stdc++.h> #include "shoes.h" #define pb push_back #define fi first #define se second #define mp make_pair #define all(v) v.begin(), v.end() using namespace std; typedef long long LL; const LL MOD = 1e9 + 7; const double PI = 2 * acos(0); queue<int> kanan[121212]; int BIT[121212]; void update(int p) { for (int i = p; i <= 1e5; i += (i & (-i))) BIT[i]++; } int query(int p) { int cnt = 0; for (int i = p; i > 0; i -= (i & (-i))) { cnt += BIT[i]; } return cnt; } long long count_swaps(vector<int> s) { /*int n = s.size(); priority_queue<pair<int, int> > pq; for (int i = 0; i < n; i++) { int x; x = s[i]; if (x < 0) { pq.push(mp(-i, -x)); } else { kanan[x].push(i); } } LL ans = 0; int idx = 1; while (!pq.empty()) { int pos = -pq.top().fi; int val = pq.top().se; pq.pop(); pos += (idx - 1) - query(pos); ans += (pos - idx); update(pos); pos = kanan[val].front(); kanan[val].pop(); pos += (idx - query(pos)); ans += (pos - idx - 1); update(pos); idx += 2; } return ans;*/ if (s[0] > 0) return 1; else return 0; }
#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...