# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1106403 | VinhLuu | Bubble Sort 2 (JOI18_bubblesort2) | C++17 | 9065 ms | 6992 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define ll long long
#include "bubblesort2.h"
using namespace std;
const int N = 1e6 + 5;
int n, q, a[N], _x[N], _y[N], kq[N];
namespace sub1{
int b[N];
vector<int> solve(){
vector<int> ans;
for(int k = 1; k <= q; k ++){
int x = _x[k], y = _y[k];
a[x] = y;
int cnt = 0;
for(int i = 1; i <= n; i ++) b[i] = a[i];
while(true){
bool ff = true;
for(int i = 1; i < n; i ++) if(b[i] > b[i + 1]){
swap(b[i], b[i + 1]);
ff = false;
}
if(ff) break;
cnt++;
}
ans.push_back(cnt);
}
Compilation message (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... |