# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
894667 | lunaTu | Bubble Sort 2 (JOI18_bubblesort2) | C++17 | 9067 ms | 2060 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#include "bubblesort2.h"
typedef long long ll;
using namespace std;
using namespace __gnu_pbds;
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
const int N = 5e4 + 1;
int A[N];
int ans[N];
int add(int n, int i, int x) {
int mx = 0;
for (int j = i + 1; j < n; j++) {
if (A[j] < A[i]) ans[j]--;
if (A[j] < x) ans[j]++;
mx = max(mx, ans[j]);
}
ans[i] = 0;
for (int j = i - 1; j >= 0; j--) {
if (A[j] > x) ans[i]++;
mx = max(mx, ans[j]);
}
A[i] = x;
return max(mx, ans[i]);
}
vector<int> countScans(vector<int> a, vector<int> x, vector<int> v){
int n = a.size();
for (int i = 0; i < n; i++) {
int w = add(n, i, a[i]);
}
int q = x.size();
vector<int> answer(q);
for (int j = 0; j < q; j++) answer[j] = add(n, x[j], v[j]);
return answer;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |