# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
624209 |
2022-08-07T13:05:32 Z |
PoonYaPat |
Pilot (NOI19_pilot) |
C++14 |
|
1000 ms |
137076 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,qu;
ll ans[1000001],sum;
vector<int> h[1000001],q[1000001];
set<int> s;
ll cal(ll x) {
return x*(x+1)/2;
}
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
cin>>n>>qu;
s.insert(0);
s.insert(n+1);
for (int i=1; i<=n; ++i) {
int a; cin>>a;
h[a].push_back(i);
}
for (int i=1; i<=qu; ++i) {
int a; cin>>a;
q[a].push_back(i);
}
sum=cal(n);
for (int i=1000000; i>0; --i) {
for (auto s : q[i]) ans[s]=sum;
for (auto j : h[i]) {
auto it=s.upper_bound(j);
int r=*it, l=*(--it);
sum-=cal(r-l-1);
sum+=cal(j-l-1);
sum+=cal(r-j-1);
s.insert(j);
}
}
for (int i=1; i<=qu; ++i) cout<<ans[i]<<"\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
47192 KB |
Output is correct |
2 |
Correct |
26 ms |
47188 KB |
Output is correct |
3 |
Correct |
27 ms |
47260 KB |
Output is correct |
4 |
Correct |
26 ms |
47300 KB |
Output is correct |
5 |
Correct |
26 ms |
47360 KB |
Output is correct |
6 |
Correct |
29 ms |
47372 KB |
Output is correct |
7 |
Correct |
26 ms |
47284 KB |
Output is correct |
8 |
Correct |
30 ms |
47252 KB |
Output is correct |
9 |
Correct |
25 ms |
47192 KB |
Output is correct |
10 |
Correct |
27 ms |
47188 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
47192 KB |
Output is correct |
2 |
Correct |
26 ms |
47188 KB |
Output is correct |
3 |
Correct |
27 ms |
47260 KB |
Output is correct |
4 |
Correct |
26 ms |
47300 KB |
Output is correct |
5 |
Correct |
26 ms |
47360 KB |
Output is correct |
6 |
Correct |
29 ms |
47372 KB |
Output is correct |
7 |
Correct |
26 ms |
47284 KB |
Output is correct |
8 |
Correct |
30 ms |
47252 KB |
Output is correct |
9 |
Correct |
25 ms |
47192 KB |
Output is correct |
10 |
Correct |
27 ms |
47188 KB |
Output is correct |
11 |
Correct |
25 ms |
47300 KB |
Output is correct |
12 |
Correct |
25 ms |
47280 KB |
Output is correct |
13 |
Correct |
26 ms |
47296 KB |
Output is correct |
14 |
Correct |
32 ms |
47272 KB |
Output is correct |
15 |
Correct |
26 ms |
47248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
47192 KB |
Output is correct |
2 |
Correct |
26 ms |
47188 KB |
Output is correct |
3 |
Correct |
27 ms |
47260 KB |
Output is correct |
4 |
Correct |
26 ms |
47300 KB |
Output is correct |
5 |
Correct |
26 ms |
47360 KB |
Output is correct |
6 |
Correct |
29 ms |
47372 KB |
Output is correct |
7 |
Correct |
26 ms |
47284 KB |
Output is correct |
8 |
Correct |
30 ms |
47252 KB |
Output is correct |
9 |
Correct |
25 ms |
47192 KB |
Output is correct |
10 |
Correct |
27 ms |
47188 KB |
Output is correct |
11 |
Correct |
25 ms |
47300 KB |
Output is correct |
12 |
Correct |
25 ms |
47280 KB |
Output is correct |
13 |
Correct |
26 ms |
47296 KB |
Output is correct |
14 |
Correct |
32 ms |
47272 KB |
Output is correct |
15 |
Correct |
26 ms |
47248 KB |
Output is correct |
16 |
Correct |
28 ms |
47180 KB |
Output is correct |
17 |
Correct |
26 ms |
47276 KB |
Output is correct |
18 |
Correct |
28 ms |
47236 KB |
Output is correct |
19 |
Correct |
27 ms |
47316 KB |
Output is correct |
20 |
Correct |
26 ms |
47296 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
47192 KB |
Output is correct |
2 |
Correct |
26 ms |
47188 KB |
Output is correct |
3 |
Correct |
27 ms |
47260 KB |
Output is correct |
4 |
Correct |
26 ms |
47300 KB |
Output is correct |
5 |
Correct |
26 ms |
47360 KB |
Output is correct |
6 |
Correct |
29 ms |
47372 KB |
Output is correct |
7 |
Correct |
26 ms |
47284 KB |
Output is correct |
8 |
Correct |
30 ms |
47252 KB |
Output is correct |
9 |
Correct |
25 ms |
47192 KB |
Output is correct |
10 |
Correct |
27 ms |
47188 KB |
Output is correct |
11 |
Correct |
25 ms |
47300 KB |
Output is correct |
12 |
Correct |
25 ms |
47280 KB |
Output is correct |
13 |
Correct |
26 ms |
47296 KB |
Output is correct |
14 |
Correct |
32 ms |
47272 KB |
Output is correct |
15 |
Correct |
26 ms |
47248 KB |
Output is correct |
16 |
Correct |
28 ms |
47180 KB |
Output is correct |
17 |
Correct |
26 ms |
47276 KB |
Output is correct |
18 |
Correct |
28 ms |
47236 KB |
Output is correct |
19 |
Correct |
27 ms |
47316 KB |
Output is correct |
20 |
Correct |
26 ms |
47296 KB |
Output is correct |
21 |
Correct |
29 ms |
47316 KB |
Output is correct |
22 |
Correct |
28 ms |
47316 KB |
Output is correct |
23 |
Correct |
28 ms |
47308 KB |
Output is correct |
24 |
Correct |
33 ms |
47392 KB |
Output is correct |
25 |
Correct |
26 ms |
47328 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
78 ms |
54212 KB |
Output is correct |
2 |
Correct |
96 ms |
55412 KB |
Output is correct |
3 |
Correct |
76 ms |
53976 KB |
Output is correct |
4 |
Correct |
93 ms |
54728 KB |
Output is correct |
5 |
Correct |
89 ms |
53964 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
110 ms |
59780 KB |
Output is correct |
2 |
Correct |
100 ms |
60108 KB |
Output is correct |
3 |
Correct |
99 ms |
59748 KB |
Output is correct |
4 |
Correct |
101 ms |
60256 KB |
Output is correct |
5 |
Correct |
96 ms |
59660 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
105 ms |
60204 KB |
Output is correct |
2 |
Correct |
106 ms |
60060 KB |
Output is correct |
3 |
Correct |
111 ms |
60044 KB |
Output is correct |
4 |
Correct |
108 ms |
60592 KB |
Output is correct |
5 |
Correct |
117 ms |
60532 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
47192 KB |
Output is correct |
2 |
Correct |
26 ms |
47188 KB |
Output is correct |
3 |
Correct |
27 ms |
47260 KB |
Output is correct |
4 |
Correct |
26 ms |
47300 KB |
Output is correct |
5 |
Correct |
26 ms |
47360 KB |
Output is correct |
6 |
Correct |
29 ms |
47372 KB |
Output is correct |
7 |
Correct |
26 ms |
47284 KB |
Output is correct |
8 |
Correct |
30 ms |
47252 KB |
Output is correct |
9 |
Correct |
25 ms |
47192 KB |
Output is correct |
10 |
Correct |
27 ms |
47188 KB |
Output is correct |
11 |
Correct |
78 ms |
54212 KB |
Output is correct |
12 |
Correct |
96 ms |
55412 KB |
Output is correct |
13 |
Correct |
76 ms |
53976 KB |
Output is correct |
14 |
Correct |
93 ms |
54728 KB |
Output is correct |
15 |
Correct |
89 ms |
53964 KB |
Output is correct |
16 |
Correct |
75 ms |
53864 KB |
Output is correct |
17 |
Correct |
99 ms |
55472 KB |
Output is correct |
18 |
Correct |
97 ms |
55504 KB |
Output is correct |
19 |
Correct |
94 ms |
53892 KB |
Output is correct |
20 |
Correct |
95 ms |
55256 KB |
Output is correct |
21 |
Correct |
73 ms |
53832 KB |
Output is correct |
22 |
Correct |
96 ms |
55016 KB |
Output is correct |
23 |
Correct |
99 ms |
54556 KB |
Output is correct |
24 |
Correct |
86 ms |
54844 KB |
Output is correct |
25 |
Correct |
75 ms |
54212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
47192 KB |
Output is correct |
2 |
Correct |
26 ms |
47188 KB |
Output is correct |
3 |
Correct |
27 ms |
47260 KB |
Output is correct |
4 |
Correct |
26 ms |
47300 KB |
Output is correct |
5 |
Correct |
26 ms |
47360 KB |
Output is correct |
6 |
Correct |
29 ms |
47372 KB |
Output is correct |
7 |
Correct |
26 ms |
47284 KB |
Output is correct |
8 |
Correct |
30 ms |
47252 KB |
Output is correct |
9 |
Correct |
25 ms |
47192 KB |
Output is correct |
10 |
Correct |
27 ms |
47188 KB |
Output is correct |
11 |
Correct |
25 ms |
47300 KB |
Output is correct |
12 |
Correct |
25 ms |
47280 KB |
Output is correct |
13 |
Correct |
26 ms |
47296 KB |
Output is correct |
14 |
Correct |
32 ms |
47272 KB |
Output is correct |
15 |
Correct |
26 ms |
47248 KB |
Output is correct |
16 |
Correct |
28 ms |
47180 KB |
Output is correct |
17 |
Correct |
26 ms |
47276 KB |
Output is correct |
18 |
Correct |
28 ms |
47236 KB |
Output is correct |
19 |
Correct |
27 ms |
47316 KB |
Output is correct |
20 |
Correct |
26 ms |
47296 KB |
Output is correct |
21 |
Correct |
29 ms |
47316 KB |
Output is correct |
22 |
Correct |
28 ms |
47316 KB |
Output is correct |
23 |
Correct |
28 ms |
47308 KB |
Output is correct |
24 |
Correct |
33 ms |
47392 KB |
Output is correct |
25 |
Correct |
26 ms |
47328 KB |
Output is correct |
26 |
Correct |
78 ms |
54212 KB |
Output is correct |
27 |
Correct |
96 ms |
55412 KB |
Output is correct |
28 |
Correct |
76 ms |
53976 KB |
Output is correct |
29 |
Correct |
93 ms |
54728 KB |
Output is correct |
30 |
Correct |
89 ms |
53964 KB |
Output is correct |
31 |
Correct |
110 ms |
59780 KB |
Output is correct |
32 |
Correct |
100 ms |
60108 KB |
Output is correct |
33 |
Correct |
99 ms |
59748 KB |
Output is correct |
34 |
Correct |
101 ms |
60256 KB |
Output is correct |
35 |
Correct |
96 ms |
59660 KB |
Output is correct |
36 |
Correct |
105 ms |
60204 KB |
Output is correct |
37 |
Correct |
106 ms |
60060 KB |
Output is correct |
38 |
Correct |
111 ms |
60044 KB |
Output is correct |
39 |
Correct |
108 ms |
60592 KB |
Output is correct |
40 |
Correct |
117 ms |
60532 KB |
Output is correct |
41 |
Correct |
75 ms |
53864 KB |
Output is correct |
42 |
Correct |
99 ms |
55472 KB |
Output is correct |
43 |
Correct |
97 ms |
55504 KB |
Output is correct |
44 |
Correct |
94 ms |
53892 KB |
Output is correct |
45 |
Correct |
95 ms |
55256 KB |
Output is correct |
46 |
Correct |
73 ms |
53832 KB |
Output is correct |
47 |
Correct |
96 ms |
55016 KB |
Output is correct |
48 |
Correct |
99 ms |
54556 KB |
Output is correct |
49 |
Correct |
86 ms |
54844 KB |
Output is correct |
50 |
Correct |
75 ms |
54212 KB |
Output is correct |
51 |
Correct |
118 ms |
58804 KB |
Output is correct |
52 |
Correct |
144 ms |
59844 KB |
Output is correct |
53 |
Correct |
114 ms |
58876 KB |
Output is correct |
54 |
Correct |
143 ms |
59764 KB |
Output is correct |
55 |
Correct |
116 ms |
58920 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
47192 KB |
Output is correct |
2 |
Correct |
26 ms |
47188 KB |
Output is correct |
3 |
Correct |
27 ms |
47260 KB |
Output is correct |
4 |
Correct |
26 ms |
47300 KB |
Output is correct |
5 |
Correct |
26 ms |
47360 KB |
Output is correct |
6 |
Correct |
29 ms |
47372 KB |
Output is correct |
7 |
Correct |
26 ms |
47284 KB |
Output is correct |
8 |
Correct |
30 ms |
47252 KB |
Output is correct |
9 |
Correct |
25 ms |
47192 KB |
Output is correct |
10 |
Correct |
27 ms |
47188 KB |
Output is correct |
11 |
Correct |
25 ms |
47300 KB |
Output is correct |
12 |
Correct |
25 ms |
47280 KB |
Output is correct |
13 |
Correct |
26 ms |
47296 KB |
Output is correct |
14 |
Correct |
32 ms |
47272 KB |
Output is correct |
15 |
Correct |
26 ms |
47248 KB |
Output is correct |
16 |
Correct |
28 ms |
47180 KB |
Output is correct |
17 |
Correct |
26 ms |
47276 KB |
Output is correct |
18 |
Correct |
28 ms |
47236 KB |
Output is correct |
19 |
Correct |
27 ms |
47316 KB |
Output is correct |
20 |
Correct |
26 ms |
47296 KB |
Output is correct |
21 |
Correct |
29 ms |
47316 KB |
Output is correct |
22 |
Correct |
28 ms |
47316 KB |
Output is correct |
23 |
Correct |
28 ms |
47308 KB |
Output is correct |
24 |
Correct |
33 ms |
47392 KB |
Output is correct |
25 |
Correct |
26 ms |
47328 KB |
Output is correct |
26 |
Correct |
78 ms |
54212 KB |
Output is correct |
27 |
Correct |
96 ms |
55412 KB |
Output is correct |
28 |
Correct |
76 ms |
53976 KB |
Output is correct |
29 |
Correct |
93 ms |
54728 KB |
Output is correct |
30 |
Correct |
89 ms |
53964 KB |
Output is correct |
31 |
Correct |
110 ms |
59780 KB |
Output is correct |
32 |
Correct |
100 ms |
60108 KB |
Output is correct |
33 |
Correct |
99 ms |
59748 KB |
Output is correct |
34 |
Correct |
101 ms |
60256 KB |
Output is correct |
35 |
Correct |
96 ms |
59660 KB |
Output is correct |
36 |
Correct |
105 ms |
60204 KB |
Output is correct |
37 |
Correct |
106 ms |
60060 KB |
Output is correct |
38 |
Correct |
111 ms |
60044 KB |
Output is correct |
39 |
Correct |
108 ms |
60592 KB |
Output is correct |
40 |
Correct |
117 ms |
60532 KB |
Output is correct |
41 |
Correct |
75 ms |
53864 KB |
Output is correct |
42 |
Correct |
99 ms |
55472 KB |
Output is correct |
43 |
Correct |
97 ms |
55504 KB |
Output is correct |
44 |
Correct |
94 ms |
53892 KB |
Output is correct |
45 |
Correct |
95 ms |
55256 KB |
Output is correct |
46 |
Correct |
73 ms |
53832 KB |
Output is correct |
47 |
Correct |
96 ms |
55016 KB |
Output is correct |
48 |
Correct |
99 ms |
54556 KB |
Output is correct |
49 |
Correct |
86 ms |
54844 KB |
Output is correct |
50 |
Correct |
75 ms |
54212 KB |
Output is correct |
51 |
Correct |
118 ms |
58804 KB |
Output is correct |
52 |
Correct |
144 ms |
59844 KB |
Output is correct |
53 |
Correct |
114 ms |
58876 KB |
Output is correct |
54 |
Correct |
143 ms |
59764 KB |
Output is correct |
55 |
Correct |
116 ms |
58920 KB |
Output is correct |
56 |
Execution timed out |
1088 ms |
137076 KB |
Time limit exceeded |
57 |
Halted |
0 ms |
0 KB |
- |