# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
503480 | 2022-01-08T07:14:00 Z | jpark | Pilot (NOI19_pilot) | C++14 | 1000 ms | 9900 KB |
#include<iostream> #include<vector> #define ll long long using namespace std; int main(){ int n,q; cin >> n >> q; int h[n]; ll hp[(ll)1e6+10]; for(int x = 0; x<n; x++) cin>>h[x]; for(int x=0; x<1e6+10; x++) hp[x] = -1; int y; for(int x=0; x<q; x++){ cin >> y; if(hp[y]!=-1){cout << hp[y] << '\n';} else{ vector<ll> ranges; int cur = 0; for(int i=0; i<n; i++){ if(h[i]<=y){ ++cur; } else{ if(cur>0){ ranges.push_back(cur); cur = 0; } } } if(cur>0){ ranges.push_back(cur); } ll total = 0; for(int i=0; i<ranges.size(); i++){ ll r = ranges[i]; r = r*(r+1)/2; total += r; } cout << total << '\n'; hp[y] = total; } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 8092 KB | Output is correct |
2 | Correct | 4 ms | 8012 KB | Output is correct |
3 | Correct | 4 ms | 8116 KB | Output is correct |
4 | Correct | 4 ms | 8116 KB | Output is correct |
5 | Correct | 4 ms | 8012 KB | Output is correct |
6 | Correct | 4 ms | 8012 KB | Output is correct |
7 | Correct | 4 ms | 8116 KB | Output is correct |
8 | Correct | 4 ms | 8012 KB | Output is correct |
9 | Correct | 4 ms | 8012 KB | Output is correct |
10 | Correct | 4 ms | 8012 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 8092 KB | Output is correct |
2 | Correct | 4 ms | 8012 KB | Output is correct |
3 | Correct | 4 ms | 8116 KB | Output is correct |
4 | Correct | 4 ms | 8116 KB | Output is correct |
5 | Correct | 4 ms | 8012 KB | Output is correct |
6 | Correct | 4 ms | 8012 KB | Output is correct |
7 | Correct | 4 ms | 8116 KB | Output is correct |
8 | Correct | 4 ms | 8012 KB | Output is correct |
9 | Correct | 4 ms | 8012 KB | Output is correct |
10 | Correct | 4 ms | 8012 KB | Output is correct |
11 | Correct | 4 ms | 8116 KB | Output is correct |
12 | Correct | 6 ms | 8116 KB | Output is correct |
13 | Correct | 4 ms | 8108 KB | Output is correct |
14 | Correct | 4 ms | 8012 KB | Output is correct |
15 | Correct | 4 ms | 8012 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 8092 KB | Output is correct |
2 | Correct | 4 ms | 8012 KB | Output is correct |
3 | Correct | 4 ms | 8116 KB | Output is correct |
4 | Correct | 4 ms | 8116 KB | Output is correct |
5 | Correct | 4 ms | 8012 KB | Output is correct |
6 | Correct | 4 ms | 8012 KB | Output is correct |
7 | Correct | 4 ms | 8116 KB | Output is correct |
8 | Correct | 4 ms | 8012 KB | Output is correct |
9 | Correct | 4 ms | 8012 KB | Output is correct |
10 | Correct | 4 ms | 8012 KB | Output is correct |
11 | Correct | 4 ms | 8116 KB | Output is correct |
12 | Correct | 6 ms | 8116 KB | Output is correct |
13 | Correct | 4 ms | 8108 KB | Output is correct |
14 | Correct | 4 ms | 8012 KB | Output is correct |
15 | Correct | 4 ms | 8012 KB | Output is correct |
16 | Correct | 5 ms | 8012 KB | Output is correct |
17 | Correct | 4 ms | 8116 KB | Output is correct |
18 | Correct | 4 ms | 8120 KB | Output is correct |
19 | Correct | 4 ms | 8116 KB | Output is correct |
20 | Correct | 5 ms | 8116 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 8092 KB | Output is correct |
2 | Correct | 4 ms | 8012 KB | Output is correct |
3 | Correct | 4 ms | 8116 KB | Output is correct |
4 | Correct | 4 ms | 8116 KB | Output is correct |
5 | Correct | 4 ms | 8012 KB | Output is correct |
6 | Correct | 4 ms | 8012 KB | Output is correct |
7 | Correct | 4 ms | 8116 KB | Output is correct |
8 | Correct | 4 ms | 8012 KB | Output is correct |
9 | Correct | 4 ms | 8012 KB | Output is correct |
10 | Correct | 4 ms | 8012 KB | Output is correct |
11 | Correct | 4 ms | 8116 KB | Output is correct |
12 | Correct | 6 ms | 8116 KB | Output is correct |
13 | Correct | 4 ms | 8108 KB | Output is correct |
14 | Correct | 4 ms | 8012 KB | Output is correct |
15 | Correct | 4 ms | 8012 KB | Output is correct |
16 | Correct | 5 ms | 8012 KB | Output is correct |
17 | Correct | 4 ms | 8116 KB | Output is correct |
18 | Correct | 4 ms | 8120 KB | Output is correct |
19 | Correct | 4 ms | 8116 KB | Output is correct |
20 | Correct | 5 ms | 8116 KB | Output is correct |
21 | Correct | 7 ms | 8140 KB | Output is correct |
22 | Correct | 8 ms | 8128 KB | Output is correct |
23 | Correct | 7 ms | 8140 KB | Output is correct |
24 | Correct | 8 ms | 8140 KB | Output is correct |
25 | Correct | 8 ms | 8124 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 28 ms | 9036 KB | Output is correct |
2 | Correct | 35 ms | 9144 KB | Output is correct |
3 | Correct | 33 ms | 8956 KB | Output is correct |
4 | Correct | 33 ms | 9036 KB | Output is correct |
5 | Correct | 28 ms | 8908 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1079 ms | 9400 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1037 ms | 9900 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 8092 KB | Output is correct |
2 | Correct | 4 ms | 8012 KB | Output is correct |
3 | Correct | 4 ms | 8116 KB | Output is correct |
4 | Correct | 4 ms | 8116 KB | Output is correct |
5 | Correct | 4 ms | 8012 KB | Output is correct |
6 | Correct | 4 ms | 8012 KB | Output is correct |
7 | Correct | 4 ms | 8116 KB | Output is correct |
8 | Correct | 4 ms | 8012 KB | Output is correct |
9 | Correct | 4 ms | 8012 KB | Output is correct |
10 | Correct | 4 ms | 8012 KB | Output is correct |
11 | Correct | 28 ms | 9036 KB | Output is correct |
12 | Correct | 35 ms | 9144 KB | Output is correct |
13 | Correct | 33 ms | 8956 KB | Output is correct |
14 | Correct | 33 ms | 9036 KB | Output is correct |
15 | Correct | 28 ms | 8908 KB | Output is correct |
16 | Correct | 27 ms | 9368 KB | Output is correct |
17 | Correct | 30 ms | 9516 KB | Output is correct |
18 | Correct | 32 ms | 9280 KB | Output is correct |
19 | Correct | 27 ms | 9016 KB | Output is correct |
20 | Correct | 32 ms | 9412 KB | Output is correct |
21 | Correct | 26 ms | 8964 KB | Output is correct |
22 | Correct | 33 ms | 9464 KB | Output is correct |
23 | Correct | 29 ms | 9376 KB | Output is correct |
24 | Correct | 30 ms | 9196 KB | Output is correct |
25 | Correct | 28 ms | 9408 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 8092 KB | Output is correct |
2 | Correct | 4 ms | 8012 KB | Output is correct |
3 | Correct | 4 ms | 8116 KB | Output is correct |
4 | Correct | 4 ms | 8116 KB | Output is correct |
5 | Correct | 4 ms | 8012 KB | Output is correct |
6 | Correct | 4 ms | 8012 KB | Output is correct |
7 | Correct | 4 ms | 8116 KB | Output is correct |
8 | Correct | 4 ms | 8012 KB | Output is correct |
9 | Correct | 4 ms | 8012 KB | Output is correct |
10 | Correct | 4 ms | 8012 KB | Output is correct |
11 | Correct | 4 ms | 8116 KB | Output is correct |
12 | Correct | 6 ms | 8116 KB | Output is correct |
13 | Correct | 4 ms | 8108 KB | Output is correct |
14 | Correct | 4 ms | 8012 KB | Output is correct |
15 | Correct | 4 ms | 8012 KB | Output is correct |
16 | Correct | 5 ms | 8012 KB | Output is correct |
17 | Correct | 4 ms | 8116 KB | Output is correct |
18 | Correct | 4 ms | 8120 KB | Output is correct |
19 | Correct | 4 ms | 8116 KB | Output is correct |
20 | Correct | 5 ms | 8116 KB | Output is correct |
21 | Correct | 7 ms | 8140 KB | Output is correct |
22 | Correct | 8 ms | 8128 KB | Output is correct |
23 | Correct | 7 ms | 8140 KB | Output is correct |
24 | Correct | 8 ms | 8140 KB | Output is correct |
25 | Correct | 8 ms | 8124 KB | Output is correct |
26 | Correct | 28 ms | 9036 KB | Output is correct |
27 | Correct | 35 ms | 9144 KB | Output is correct |
28 | Correct | 33 ms | 8956 KB | Output is correct |
29 | Correct | 33 ms | 9036 KB | Output is correct |
30 | Correct | 28 ms | 8908 KB | Output is correct |
31 | Execution timed out | 1079 ms | 9400 KB | Time limit exceeded |
32 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 8092 KB | Output is correct |
2 | Correct | 4 ms | 8012 KB | Output is correct |
3 | Correct | 4 ms | 8116 KB | Output is correct |
4 | Correct | 4 ms | 8116 KB | Output is correct |
5 | Correct | 4 ms | 8012 KB | Output is correct |
6 | Correct | 4 ms | 8012 KB | Output is correct |
7 | Correct | 4 ms | 8116 KB | Output is correct |
8 | Correct | 4 ms | 8012 KB | Output is correct |
9 | Correct | 4 ms | 8012 KB | Output is correct |
10 | Correct | 4 ms | 8012 KB | Output is correct |
11 | Correct | 4 ms | 8116 KB | Output is correct |
12 | Correct | 6 ms | 8116 KB | Output is correct |
13 | Correct | 4 ms | 8108 KB | Output is correct |
14 | Correct | 4 ms | 8012 KB | Output is correct |
15 | Correct | 4 ms | 8012 KB | Output is correct |
16 | Correct | 5 ms | 8012 KB | Output is correct |
17 | Correct | 4 ms | 8116 KB | Output is correct |
18 | Correct | 4 ms | 8120 KB | Output is correct |
19 | Correct | 4 ms | 8116 KB | Output is correct |
20 | Correct | 5 ms | 8116 KB | Output is correct |
21 | Correct | 7 ms | 8140 KB | Output is correct |
22 | Correct | 8 ms | 8128 KB | Output is correct |
23 | Correct | 7 ms | 8140 KB | Output is correct |
24 | Correct | 8 ms | 8140 KB | Output is correct |
25 | Correct | 8 ms | 8124 KB | Output is correct |
26 | Correct | 28 ms | 9036 KB | Output is correct |
27 | Correct | 35 ms | 9144 KB | Output is correct |
28 | Correct | 33 ms | 8956 KB | Output is correct |
29 | Correct | 33 ms | 9036 KB | Output is correct |
30 | Correct | 28 ms | 8908 KB | Output is correct |
31 | Execution timed out | 1079 ms | 9400 KB | Time limit exceeded |
32 | Halted | 0 ms | 0 KB | - |