| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1143815 | bekzhan29 | Bubble Sort 2 (JOI18_bubblesort2) | C++20 | 190 ms | 776 KiB |
#include "bubblesort2.h"
using namespace std;
typedef long long ll;
const ll N=500100;
int res[N];
vector<int> countScans(vector<int> a,vector<int> x,vector<int> v){
ll n=a.size(),q=x.size();
vector<int> ans(q);
for (int j=0;j<q;j++) {
for(ll i=0;i<x[j];i++)
res[i]+=a[i]>v[j];
for(ll i=x[j]+1;i<n;i++)
if(a[i]<a[x[j]]&&v[j]<a[i])
res[i]--;
else if(a[i]>a[x[j]]&&v[j]>a[i])
res[i]++;
a[x[j]]=v[j];
ans[j]=0;
for(ll i=0;i<n;i++)
ans[j]=max(ans[j],res[i]);
}
return ans;
}
/*
4 2
1 2 3 4
0 3
2 1
*/
| # | 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... | ||||
