# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
51050 | 2018-06-15T17:44:28 Z | SpaimaCarpatilor | None (JOI16_matryoshka) | C++17 | 3 ms | 572 KB |
#include<bits/stdc++.h> using namespace std; int nr, N, Q, h[100009]; pair < int, int > v[100009]; int main () { //freopen ("input", "r", stdin); //freopen ("output", "w", stdout); scanf ("%d %d", &N, &Q); for (int i=1; i<=N; i++) scanf ("%d %d", &v[i].first, &v[i].second), v[i].second = -v[i].second; sort (v + 1, v + N + 1); for (int i=1; i<=N; i++) v[i].second = -v[i].second; while (Q --) { int X, Y; scanf ("%d %d", &X, &Y), nr = 0; for (int i=1; i<=N; i++) if (v[i].first >= X && v[i].second <= Y) h[++nr] = v[i].second; set < int > S; for (int i=1; i<=nr; i++) { auto it = S.lower_bound (h[i]); if (it == S.begin ()) S.insert (h[i]); else { it --; S.erase (it), S.insert (h[i]); } } printf ("%d\n", S.size ()); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 476 KB | Output is correct |
3 | Correct | 3 ms | 476 KB | Output is correct |
4 | Correct | 2 ms | 476 KB | Output is correct |
5 | Correct | 2 ms | 476 KB | Output is correct |
6 | Correct | 2 ms | 476 KB | Output is correct |
7 | Correct | 2 ms | 544 KB | Output is correct |
8 | Correct | 2 ms | 556 KB | Output is correct |
9 | Correct | 2 ms | 572 KB | Output is correct |
10 | Incorrect | 2 ms | 572 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 476 KB | Output is correct |
3 | Correct | 3 ms | 476 KB | Output is correct |
4 | Correct | 2 ms | 476 KB | Output is correct |
5 | Correct | 2 ms | 476 KB | Output is correct |
6 | Correct | 2 ms | 476 KB | Output is correct |
7 | Correct | 2 ms | 544 KB | Output is correct |
8 | Correct | 2 ms | 556 KB | Output is correct |
9 | Correct | 2 ms | 572 KB | Output is correct |
10 | Incorrect | 2 ms | 572 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 476 KB | Output is correct |
3 | Correct | 3 ms | 476 KB | Output is correct |
4 | Correct | 2 ms | 476 KB | Output is correct |
5 | Correct | 2 ms | 476 KB | Output is correct |
6 | Correct | 2 ms | 476 KB | Output is correct |
7 | Correct | 2 ms | 544 KB | Output is correct |
8 | Correct | 2 ms | 556 KB | Output is correct |
9 | Correct | 2 ms | 572 KB | Output is correct |
10 | Incorrect | 2 ms | 572 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 476 KB | Output is correct |
3 | Correct | 3 ms | 476 KB | Output is correct |
4 | Correct | 2 ms | 476 KB | Output is correct |
5 | Correct | 2 ms | 476 KB | Output is correct |
6 | Correct | 2 ms | 476 KB | Output is correct |
7 | Correct | 2 ms | 544 KB | Output is correct |
8 | Correct | 2 ms | 556 KB | Output is correct |
9 | Correct | 2 ms | 572 KB | Output is correct |
10 | Incorrect | 2 ms | 572 KB | Output isn't correct |