# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
539132 | LucaDantas | Bubble Sort 2 (JOI18_bubblesort2) | C++17 | 9075 ms | 800 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "bubblesort2.h"
using namespace std;
constexpr int maxn = 2000+10; // subtasks brutao, mudar
struct BIT {
int bit[maxn];
void upd(int x, int v) {
for(; x > 0; x -= x&-x)
bit[x] += v;
}
int query(int x) {
int ans = 0;
for(; x < maxn; x += x&-x)
ans += bit[x];
return ans;
}
void clear() { memset(bit, 0, sizeof bit); }
} bit;
// fazer o brutao pra checar se essa ideia ta certo e se eu codo ela pra full
int calc(const vector<int>& A) {
int ans = 0;
vector<int> foi;
// bit.clear();
for(int i = 0; i < (int)A.size(); i++) {
int aq = 0;
for(int x : foi)
aq += x > A[i];
ans = max(ans, aq);
foi.push_back(A[i]);
// ans = max(ans, bit.query(A[i]+1)), bit.upd(A[i], 1);
}
return ans;
}
std::vector<int> countScans(std::vector<int> A,std::vector<int> X,std::vector<int> V){
int Q = (int)X.size(), N = (int)A.size();
std::vector<int> answer(Q);
for(int q = 0; q < Q; q++) {
A[X[q]] = V[q];
answer[q] = calc(A);
}
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... |