# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
320963 | 2020-11-10T11:12:07 Z | nishuz | Pilot (NOI19_pilot) | C++14 | 1000 ms | 1764 KB |
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll long long #define ull unsigned long long #define ld long double #define F first #define S second #define eb emplace_back #define pb push_back #define mp make_pair #define all(x) begin(x), end(x) #define rall(x) rbegin(x), rend(x) using namespace __gnu_pbds; using namespace std; template <typename T> using oset = tree <pair <T, T>, null_type, less <pair <T, T>>, rb_tree_tag, tree_order_statistics_node_update>; template <typename T> void ckmin(T& a, const T b) {a = min(a, b);} template <typename T> void ckmax(T& a, const T b) {a = max(a, b);} template <typename T> void print(vector <T> v) { for (T i : v) cout << i << " "; cout << '\n'; } template <typename T> void print(vector <vector <T>>& v) { for (vector <T>& vv : v) { for (T& i : vv) cout << i << " "; cout << '\n'; } } template <typename T> void read(vector <T>& v) {for (T& i : v) cin >> i;} template <typename T> void read(T&& t) {cin >> t;} template <typename T, typename... Args> void read(T&& t, Args&&... args) { cin >> t; read(forward<Args>(args)...); } template <typename T> void print(T&& t) {cout << t << '\n';} template <typename T, typename... Args> void print(T&& t, Args&&... args) { cout << t << " "; print(forward<Args>(args)...); } void usaco(string name = "") { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if(name.size()) { freopen((name+".in").c_str(), "r", stdin); freopen((name+".txt").c_str(), "w", stdout); } } void solve() { int n, q; cin >> n >> q; vector <int> a(n); read(a); for (int Q = 0; Q < q; ++Q) { int y; ll ans = 0, sz = 0; cin >> y; for (int i = 0; i < n; ++i) { if (a[i] <= y) ++sz; else { ans += (sz*(sz+1))/2; sz = 0; } } ans += (sz*(sz+1))/2; print(ans); } } int32_t main() { usaco(); int t = 1; while (t--) solve(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 384 KB | Output is correct |
13 | Correct | 0 ms | 364 KB | Output is correct |
14 | Correct | 0 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 384 KB | Output is correct |
13 | Correct | 0 ms | 364 KB | Output is correct |
14 | Correct | 0 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
16 | Correct | 1 ms | 512 KB | Output is correct |
17 | Correct | 1 ms | 364 KB | Output is correct |
18 | Correct | 1 ms | 364 KB | Output is correct |
19 | Correct | 1 ms | 364 KB | Output is correct |
20 | Correct | 1 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 384 KB | Output is correct |
13 | Correct | 0 ms | 364 KB | Output is correct |
14 | Correct | 0 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
16 | Correct | 1 ms | 512 KB | Output is correct |
17 | Correct | 1 ms | 364 KB | Output is correct |
18 | Correct | 1 ms | 364 KB | Output is correct |
19 | Correct | 1 ms | 364 KB | Output is correct |
20 | Correct | 1 ms | 364 KB | Output is correct |
21 | Correct | 2 ms | 364 KB | Output is correct |
22 | Correct | 3 ms | 364 KB | Output is correct |
23 | Correct | 3 ms | 364 KB | Output is correct |
24 | Correct | 3 ms | 364 KB | Output is correct |
25 | Correct | 2 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 1260 KB | Output is correct |
2 | Correct | 10 ms | 1388 KB | Output is correct |
3 | Correct | 12 ms | 1260 KB | Output is correct |
4 | Correct | 12 ms | 1260 KB | Output is correct |
5 | Correct | 9 ms | 1260 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1091 ms | 1664 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1046 ms | 1764 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 10 ms | 1260 KB | Output is correct |
12 | Correct | 10 ms | 1388 KB | Output is correct |
13 | Correct | 12 ms | 1260 KB | Output is correct |
14 | Correct | 12 ms | 1260 KB | Output is correct |
15 | Correct | 9 ms | 1260 KB | Output is correct |
16 | Correct | 9 ms | 1260 KB | Output is correct |
17 | Correct | 10 ms | 1388 KB | Output is correct |
18 | Correct | 10 ms | 1388 KB | Output is correct |
19 | Correct | 9 ms | 1260 KB | Output is correct |
20 | Correct | 10 ms | 1388 KB | Output is correct |
21 | Correct | 9 ms | 1260 KB | Output is correct |
22 | Correct | 10 ms | 1388 KB | Output is correct |
23 | Correct | 12 ms | 1260 KB | Output is correct |
24 | Correct | 10 ms | 1260 KB | Output is correct |
25 | Correct | 10 ms | 1260 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 384 KB | Output is correct |
13 | Correct | 0 ms | 364 KB | Output is correct |
14 | Correct | 0 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
16 | Correct | 1 ms | 512 KB | Output is correct |
17 | Correct | 1 ms | 364 KB | Output is correct |
18 | Correct | 1 ms | 364 KB | Output is correct |
19 | Correct | 1 ms | 364 KB | Output is correct |
20 | Correct | 1 ms | 364 KB | Output is correct |
21 | Correct | 2 ms | 364 KB | Output is correct |
22 | Correct | 3 ms | 364 KB | Output is correct |
23 | Correct | 3 ms | 364 KB | Output is correct |
24 | Correct | 3 ms | 364 KB | Output is correct |
25 | Correct | 2 ms | 364 KB | Output is correct |
26 | Correct | 10 ms | 1260 KB | Output is correct |
27 | Correct | 10 ms | 1388 KB | Output is correct |
28 | Correct | 12 ms | 1260 KB | Output is correct |
29 | Correct | 12 ms | 1260 KB | Output is correct |
30 | Correct | 9 ms | 1260 KB | Output is correct |
31 | Execution timed out | 1091 ms | 1664 KB | Time limit exceeded |
32 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 384 KB | Output is correct |
13 | Correct | 0 ms | 364 KB | Output is correct |
14 | Correct | 0 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
16 | Correct | 1 ms | 512 KB | Output is correct |
17 | Correct | 1 ms | 364 KB | Output is correct |
18 | Correct | 1 ms | 364 KB | Output is correct |
19 | Correct | 1 ms | 364 KB | Output is correct |
20 | Correct | 1 ms | 364 KB | Output is correct |
21 | Correct | 2 ms | 364 KB | Output is correct |
22 | Correct | 3 ms | 364 KB | Output is correct |
23 | Correct | 3 ms | 364 KB | Output is correct |
24 | Correct | 3 ms | 364 KB | Output is correct |
25 | Correct | 2 ms | 364 KB | Output is correct |
26 | Correct | 10 ms | 1260 KB | Output is correct |
27 | Correct | 10 ms | 1388 KB | Output is correct |
28 | Correct | 12 ms | 1260 KB | Output is correct |
29 | Correct | 12 ms | 1260 KB | Output is correct |
30 | Correct | 9 ms | 1260 KB | Output is correct |
31 | Execution timed out | 1091 ms | 1664 KB | Time limit exceeded |
32 | Halted | 0 ms | 0 KB | - |