제출 #297585

#제출 시각아이디문제언어결과실행 시간메모리
297585pit4hBubble Sort 2 (JOI18_bubblesort2)C++14
38 / 100
9090 ms2432 KiB
#include "bubblesort2.h" #include<bits/stdc++.h> using namespace std; struct Dynamic_segtree { }; vector<int> countScans(vector<int> a, vector<int> x, vector<int> v){ int q = x.size(); int n = a.size(); vector<int> answer(q); vector<int> inv(n); for(int i=0; i<n; ++i) { for(int j=i+1; j<n; ++j) { if(a[i] > a[j]) { inv[j]++; } } } for(int i=0; i<q; ++i) { int old = a[x[i]]; a[x[i]] = v[i]; inv[x[i]] = 0; for(int j=0; j<x[i]; ++j) { if(a[j] > a[x[i]]) { inv[x[i]]++; } } for(int j=x[i]+1; j<n; ++j) { if(a[x[i]] > a[j] && old <= a[j]) { inv[j]++; } if(a[x[i]] <= a[j] && old > a[j]) { inv[j]--; } } for(int j=0; j<n; ++j) { answer[i] = max(answer[i], inv[j]); } } return answer; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...