# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
854020 | 2023-09-25T20:23:45 Z | Rifal | Bubble Sort 2 (JOI18_bubblesort2) | C++14 | 429 ms | 1104 KB |
#include "bubblesort2.h" #include<bits/stdc++.h> using namespace std; vector<int> countScans(vector<int> A,vector<int> X,vector<int> V){ vector<int> answer; int siz = A.size(), cnt[siz] = {}; for(int i = 0; i < siz; i++) { int sum = 0; for(int j = 0; j < i; j++) { if(A[j] < A[i]) sum++; } cnt[i] = sum; } for(int i = 0; i < X.size(); i++) { int sum = 0, ans = 0; for(int j = 0; j < X[i]; j++) { if(A[j] < V[i]) sum++; } for(int j = X[i]+1; j < siz; j++) { if(A[X[i]] < A[j]) cnt[j]--; if(V[i] < A[j]) cnt[j]++; } cnt[X[i]] = sum; A[X[i]] = V[i]; for(int j = 0; j < siz; j++) { ans = max(ans,j-cnt[j]); } answer.push_back(ans); } return answer; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 348 KB | Output is correct |
2 | Correct | 3 ms | 480 KB | Output is correct |
3 | Correct | 16 ms | 492 KB | Output is correct |
4 | Correct | 16 ms | 348 KB | Output is correct |
5 | Correct | 13 ms | 552 KB | Output is correct |
6 | Correct | 10 ms | 348 KB | Output is correct |
7 | Correct | 11 ms | 548 KB | Output is correct |
8 | Correct | 12 ms | 548 KB | Output is correct |
9 | Correct | 13 ms | 528 KB | Output is correct |
10 | Correct | 11 ms | 544 KB | Output is correct |
11 | Correct | 11 ms | 344 KB | Output is correct |
12 | Correct | 11 ms | 520 KB | Output is correct |
13 | Correct | 10 ms | 348 KB | Output is correct |
14 | Correct | 10 ms | 524 KB | Output is correct |
15 | Correct | 10 ms | 348 KB | Output is correct |
16 | Correct | 8 ms | 344 KB | Output is correct |
17 | Correct | 8 ms | 600 KB | Output is correct |
18 | Correct | 8 ms | 540 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 348 KB | Output is correct |
2 | Correct | 3 ms | 480 KB | Output is correct |
3 | Correct | 16 ms | 492 KB | Output is correct |
4 | Correct | 16 ms | 348 KB | Output is correct |
5 | Correct | 13 ms | 552 KB | Output is correct |
6 | Correct | 10 ms | 348 KB | Output is correct |
7 | Correct | 11 ms | 548 KB | Output is correct |
8 | Correct | 12 ms | 548 KB | Output is correct |
9 | Correct | 13 ms | 528 KB | Output is correct |
10 | Correct | 11 ms | 544 KB | Output is correct |
11 | Correct | 11 ms | 344 KB | Output is correct |
12 | Correct | 11 ms | 520 KB | Output is correct |
13 | Correct | 10 ms | 348 KB | Output is correct |
14 | Correct | 10 ms | 524 KB | Output is correct |
15 | Correct | 10 ms | 348 KB | Output is correct |
16 | Correct | 8 ms | 344 KB | Output is correct |
17 | Correct | 8 ms | 600 KB | Output is correct |
18 | Correct | 8 ms | 540 KB | Output is correct |
19 | Correct | 192 ms | 788 KB | Output is correct |
20 | Correct | 241 ms | 836 KB | Output is correct |
21 | Correct | 172 ms | 848 KB | Output is correct |
22 | Correct | 199 ms | 1104 KB | Output is correct |
23 | Correct | 160 ms | 852 KB | Output is correct |
24 | Correct | 162 ms | 808 KB | Output is correct |
25 | Correct | 142 ms | 852 KB | Output is correct |
26 | Correct | 146 ms | 832 KB | Output is correct |
27 | Correct | 121 ms | 824 KB | Output is correct |
28 | Correct | 127 ms | 800 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 429 ms | 876 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 348 KB | Output is correct |
2 | Correct | 3 ms | 480 KB | Output is correct |
3 | Correct | 16 ms | 492 KB | Output is correct |
4 | Correct | 16 ms | 348 KB | Output is correct |
5 | Correct | 13 ms | 552 KB | Output is correct |
6 | Correct | 10 ms | 348 KB | Output is correct |
7 | Correct | 11 ms | 548 KB | Output is correct |
8 | Correct | 12 ms | 548 KB | Output is correct |
9 | Correct | 13 ms | 528 KB | Output is correct |
10 | Correct | 11 ms | 544 KB | Output is correct |
11 | Correct | 11 ms | 344 KB | Output is correct |
12 | Correct | 11 ms | 520 KB | Output is correct |
13 | Correct | 10 ms | 348 KB | Output is correct |
14 | Correct | 10 ms | 524 KB | Output is correct |
15 | Correct | 10 ms | 348 KB | Output is correct |
16 | Correct | 8 ms | 344 KB | Output is correct |
17 | Correct | 8 ms | 600 KB | Output is correct |
18 | Correct | 8 ms | 540 KB | Output is correct |
19 | Correct | 192 ms | 788 KB | Output is correct |
20 | Correct | 241 ms | 836 KB | Output is correct |
21 | Correct | 172 ms | 848 KB | Output is correct |
22 | Correct | 199 ms | 1104 KB | Output is correct |
23 | Correct | 160 ms | 852 KB | Output is correct |
24 | Correct | 162 ms | 808 KB | Output is correct |
25 | Correct | 142 ms | 852 KB | Output is correct |
26 | Correct | 146 ms | 832 KB | Output is correct |
27 | Correct | 121 ms | 824 KB | Output is correct |
28 | Correct | 127 ms | 800 KB | Output is correct |
29 | Incorrect | 429 ms | 876 KB | Output isn't correct |
30 | Halted | 0 ms | 0 KB | - |