이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "bubblesort2.h"
#define sz(a) ((int)(a).size())
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int NMAX = 5e5+5;
struct Query {
int pos, val;
};
int n, m;
int a[NMAX];
Query q[NMAX];
int bubble_sort(vector<int> a) {
bool ok = 1;
int cnt = 0;
while (ok) {
ok = 0;
for (int i = 1; i < n; i++) {
if (a[i - 1] > a[i]) {
swap(a[i - 1], a[i]);
ok = 1;
}
}
cnt += ok;
}
return cnt;
}
std::vector<int> countScans(std::vector<int> A,std::vector<int> X,std::vector<int> V) {
n = sz(A);
m = sz(X);
for (int i = 0; i < n; i++)
a[i + 1] = A[i];
for (int i = 0; i < m; i++)
q[i + 1] = { X[i], V[i] };
vector<int> ans;
for (int i = 0; i < sz(X); i++) {
A[X[i]] = V[i];
ans.push_back(bubble_sort(A));
}
return ans;
}
| # | 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... |