| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1370670 | TroySer | Bubble Sort Machine (JOI25_bubble) | C++20 | 2095 ms | 15904 KiB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll N;
cin >> N;
vector<ll> A(N);
for (ll i = 0; i < N; i++) {
cin >> A[i];
}
vector<ll> prfx(N + 1, 0);
for (ll i = 1; i <= N; i++) {
prfx[i] = prfx[i - 1] + A[i - 1];
}
ll Q;
cin >> Q;
while (Q--) {
ll Tj;
cin >> Tj;
if (Tj == 1) {
for (ll i = 0; i < N - 1; i++) {
if (A[i] > A[i + 1]) swap(A[i], A[i + 1]);
}
for (ll i = 1; i <= N; i++) {
prfx[i] = prfx[i - 1] + A[i - 1];
}
} else {
ll Li, Ri;
cin >> Li >> Ri;
cout << prfx[Ri] - prfx[Li - 1] << endl;
}
}
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
