# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
363266 | 2021-02-05T12:02:53 Z | NEvOl | Bubble Sort 2 (JOI18_bubblesort2) | C++14 | 80 ms | 876 KB |
#include "bubblesort2.h" #include <algorithm> using namespace std; int get_cnt(vector<int> curr) { int cnt = 0; int mn = curr[curr.size() - 1]; for(int i = curr.size() - 2; -1 < i; i--) { if(mn < curr[i]) cnt++; mn = min(mn, curr[i]); } return cnt; } std::vector<int> countScans(std::vector<int> A,std::vector<int> X,std::vector<int> V){ int Q=X.size(); std::vector<int> answer(Q); vector<int> curr(A.size()); for(int i = 0; i < A.size(); i++) curr[i] = A[i]; int cnt = get_cnt(curr); for (int j=0;j<Q;j++) { curr[X[j]] = V[j]; answer[j]=get_cnt(curr); } return answer; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 80 ms | 876 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |