Submission #1012161

#TimeUsernameProblemLanguageResultExecution timeMemory
1012161vjudge1Bubble Sort 2 (JOI18_bubblesort2)C++17
17 / 100
9076 ms600 KiB
#include "bubblesort2.h" #include <bits/stdc++.h> using namespace std; int solve(int N, vector<int> A) { int cnt = 0; while (1) { bool move = 0; for (int i = 0; i+1 < N; i++) { if (A[i] > A[i+1]) { swap(A[i], A[i+1]); move = 1; } } if (!move) break; cnt++; } return cnt; } vector<int> countScans(vector<int> A, vector<int> X, vector<int> V){ int N = A.size(); int Q = X.size(); vector<int> ans(Q); for (int j = 0; j < Q; j++) { A[X[j]] = V[j]; ans[j] = solve(N, A); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...