# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
590735 | 2022-07-06T09:42:41 Z | UncoolAnon | Bubble Sort 2 (JOI18_bubblesort2) | C++14 | 9000 ms | 2260 KB |
#include <bits/stdc++.h> #define pii pair<int,int> #define F first #define S second #define mp make_pair #define endl '\n' using namespace std; const int inf=1e9,N=2e5+5,md=1e9+7; vector<int> countScans(vector<int> a ,vector<int> x , vector<int> v){ set<int> c; map<int,int> m; for(int&x:a) c.insert(x); for(int&x:v) c.insert(x); int cnt=1; for(int x:c) m[x]=cnt++; for(int&x:a) x=m[x]; for(int&x:v) x=m[x]; vector<int> answer(x.size()); vector<int> ft(cnt+5); function<void(int,int)> update=[&](int index,int value){ for(;index<ft.size();index+=(index&(-index))) ft[index]+=value; return ; }; function<int(int)> query=[&](int index){ int answer=0; for(;index>0;index-=(index&(-index))) answer+=ft[index]; return answer; }; for(int i=0;i<x.size();i++){ a[x[i]]=v[i]; int cnt=0; for(int j=0;j<a.size();j++){ answer[i]=max(answer[i],j-query(a[j])); update(a[j],1); } for(int j=0;j<a.size();j++) update(a[j],-1); } return answer; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 340 KB | Output is correct |
2 | Correct | 41 ms | 468 KB | Output is correct |
3 | Correct | 224 ms | 768 KB | Output is correct |
4 | Correct | 220 ms | 772 KB | Output is correct |
5 | Correct | 217 ms | 776 KB | Output is correct |
6 | Correct | 207 ms | 844 KB | Output is correct |
7 | Correct | 212 ms | 724 KB | Output is correct |
8 | Correct | 222 ms | 768 KB | Output is correct |
9 | Correct | 221 ms | 696 KB | Output is correct |
10 | Correct | 193 ms | 724 KB | Output is correct |
11 | Correct | 196 ms | 724 KB | Output is correct |
12 | Correct | 207 ms | 708 KB | Output is correct |
13 | Correct | 194 ms | 692 KB | Output is correct |
14 | Correct | 191 ms | 688 KB | Output is correct |
15 | Correct | 192 ms | 692 KB | Output is correct |
16 | Correct | 202 ms | 664 KB | Output is correct |
17 | Correct | 192 ms | 668 KB | Output is correct |
18 | Correct | 194 ms | 664 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 340 KB | Output is correct |
2 | Correct | 41 ms | 468 KB | Output is correct |
3 | Correct | 224 ms | 768 KB | Output is correct |
4 | Correct | 220 ms | 772 KB | Output is correct |
5 | Correct | 217 ms | 776 KB | Output is correct |
6 | Correct | 207 ms | 844 KB | Output is correct |
7 | Correct | 212 ms | 724 KB | Output is correct |
8 | Correct | 222 ms | 768 KB | Output is correct |
9 | Correct | 221 ms | 696 KB | Output is correct |
10 | Correct | 193 ms | 724 KB | Output is correct |
11 | Correct | 196 ms | 724 KB | Output is correct |
12 | Correct | 207 ms | 708 KB | Output is correct |
13 | Correct | 194 ms | 692 KB | Output is correct |
14 | Correct | 191 ms | 688 KB | Output is correct |
15 | Correct | 192 ms | 692 KB | Output is correct |
16 | Correct | 202 ms | 664 KB | Output is correct |
17 | Correct | 192 ms | 668 KB | Output is correct |
18 | Correct | 194 ms | 664 KB | Output is correct |
19 | Correct | 2982 ms | 2012 KB | Output is correct |
20 | Correct | 3816 ms | 2260 KB | Output is correct |
21 | Correct | 3706 ms | 2256 KB | Output is correct |
22 | Correct | 3817 ms | 2252 KB | Output is correct |
23 | Correct | 3516 ms | 2036 KB | Output is correct |
24 | Correct | 3524 ms | 2036 KB | Output is correct |
25 | Correct | 3483 ms | 1932 KB | Output is correct |
26 | Correct | 3544 ms | 1976 KB | Output is correct |
27 | Correct | 3470 ms | 1820 KB | Output is correct |
28 | Correct | 3472 ms | 1832 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2600 ms | 636 KB | Output is correct |
2 | Execution timed out | 9037 ms | 1364 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 340 KB | Output is correct |
2 | Correct | 41 ms | 468 KB | Output is correct |
3 | Correct | 224 ms | 768 KB | Output is correct |
4 | Correct | 220 ms | 772 KB | Output is correct |
5 | Correct | 217 ms | 776 KB | Output is correct |
6 | Correct | 207 ms | 844 KB | Output is correct |
7 | Correct | 212 ms | 724 KB | Output is correct |
8 | Correct | 222 ms | 768 KB | Output is correct |
9 | Correct | 221 ms | 696 KB | Output is correct |
10 | Correct | 193 ms | 724 KB | Output is correct |
11 | Correct | 196 ms | 724 KB | Output is correct |
12 | Correct | 207 ms | 708 KB | Output is correct |
13 | Correct | 194 ms | 692 KB | Output is correct |
14 | Correct | 191 ms | 688 KB | Output is correct |
15 | Correct | 192 ms | 692 KB | Output is correct |
16 | Correct | 202 ms | 664 KB | Output is correct |
17 | Correct | 192 ms | 668 KB | Output is correct |
18 | Correct | 194 ms | 664 KB | Output is correct |
19 | Correct | 2982 ms | 2012 KB | Output is correct |
20 | Correct | 3816 ms | 2260 KB | Output is correct |
21 | Correct | 3706 ms | 2256 KB | Output is correct |
22 | Correct | 3817 ms | 2252 KB | Output is correct |
23 | Correct | 3516 ms | 2036 KB | Output is correct |
24 | Correct | 3524 ms | 2036 KB | Output is correct |
25 | Correct | 3483 ms | 1932 KB | Output is correct |
26 | Correct | 3544 ms | 1976 KB | Output is correct |
27 | Correct | 3470 ms | 1820 KB | Output is correct |
28 | Correct | 3472 ms | 1832 KB | Output is correct |
29 | Correct | 2600 ms | 636 KB | Output is correct |
30 | Execution timed out | 9037 ms | 1364 KB | Time limit exceeded |
31 | Halted | 0 ms | 0 KB | - |