# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
886998 | amirhoseinfar1385 | Bubble Sort 2 (JOI18_bubblesort2) | C++17 | 9033 ms | 5184 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2")
#include "bubblesort2.h"
#include<bits/stdc++.h>
using namespace std;
const int maxn=500000+10;
int dp[maxn],n,q,maxa;
std::vector<int> countScans(std::vector<int> A,std::vector<int> X,std::vector<int> V){
n=A.size(),q=X.size(),maxa=0;
for(int i=0;i<n;i++){
int ted=0;
for(int j=i-1;j>=0;j--){
ted+=A[j]>A[i]?1:0;
}
dp[i]=ted;
maxa=maxa>ted?maxa:ted;
}
vector<int>ret(q);
for(int i=0;i<q;i++){
int ind=X[i],w=V[i];
for(int j=ind+1;j<n;j++){
dp[j]+=A[ind]>A[j]?-1:0;
}
dp[ind]=0;
A[ind]=w;
for(int j=ind-1;j>=0;j--){
dp[ind]+=A[j]>A[ind]?1:0;
}
for(int j=ind+1;j<n;j++){
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |