제출 #210319

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
2103192020-03-17 03:32:132qbingxuanBubble Sort 2 (JOI18_bubblesort2)C++14
0 / 100
2013 ms1272 KiB
//#include "bubblesort2.h"
#include <bits/stdc++.h>
#define pb emplace_back
#define get_pos(u,x) (lower_bound(begin(u),end(u),x) - begin(u))
using namespace std;
vector<int> countScans(vector<int> A, vector<int> X, vector<int> V) {
int n = A.size(), q = X.size();
//vector<tuple<int,int,int>> evt;
/*for(int i = 0; i < n; i++)
evt.pb(i, i, A[i]);
for(int i = 0; i < q; i++)
evt.pb(i+n, X[i]-1, V[i]);
CDQ(evt);*/
vector<int> u;
for(int i = 0; i < n; i++) u.pb(A[i]);
for(int i = 0; i < q; i++) u.pb(V[i]);
sort(u.begin(), u.end());
u.erase(unique(u.begin(), u.end()), u.end());
for(int i = 0; i < n; i++) A[i] = get_pos(u, A[i]) + 1;
for(int i = 0; i < q; i++) V[i] = get_pos(u, V[i]) + 1;
vector<int> cnt(u.size() + 100000);
auto modify = [&](int p, int d) {
for(; p < int(cnt.size()); p += p&-p) cnt[p] += d;
};
auto query = [&](int p) {
int res = 0;
for(; p; p -= p&-p) res += cnt[p];
return res;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...