# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
51049 | 2018-06-15T17:42:56 Z | SpaimaCarpatilor | None (JOI16_matryoshka) | C++17 | 3 ms | 660 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); sort (v + 1, v + N + 1); 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.upper_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 | 248 KB | Output is correct |
2 | Correct | 2 ms | 356 KB | Output is correct |
3 | Correct | 2 ms | 408 KB | Output is correct |
4 | Correct | 2 ms | 484 KB | Output is correct |
5 | Correct | 2 ms | 536 KB | Output is correct |
6 | Correct | 2 ms | 540 KB | Output is correct |
7 | Correct | 2 ms | 660 KB | Output is correct |
8 | Correct | 2 ms | 660 KB | Output is correct |
9 | Correct | 2 ms | 660 KB | Output is correct |
10 | Incorrect | 3 ms | 660 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 356 KB | Output is correct |
3 | Correct | 2 ms | 408 KB | Output is correct |
4 | Correct | 2 ms | 484 KB | Output is correct |
5 | Correct | 2 ms | 536 KB | Output is correct |
6 | Correct | 2 ms | 540 KB | Output is correct |
7 | Correct | 2 ms | 660 KB | Output is correct |
8 | Correct | 2 ms | 660 KB | Output is correct |
9 | Correct | 2 ms | 660 KB | Output is correct |
10 | Incorrect | 3 ms | 660 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 356 KB | Output is correct |
3 | Correct | 2 ms | 408 KB | Output is correct |
4 | Correct | 2 ms | 484 KB | Output is correct |
5 | Correct | 2 ms | 536 KB | Output is correct |
6 | Correct | 2 ms | 540 KB | Output is correct |
7 | Correct | 2 ms | 660 KB | Output is correct |
8 | Correct | 2 ms | 660 KB | Output is correct |
9 | Correct | 2 ms | 660 KB | Output is correct |
10 | Incorrect | 3 ms | 660 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 356 KB | Output is correct |
3 | Correct | 2 ms | 408 KB | Output is correct |
4 | Correct | 2 ms | 484 KB | Output is correct |
5 | Correct | 2 ms | 536 KB | Output is correct |
6 | Correct | 2 ms | 540 KB | Output is correct |
7 | Correct | 2 ms | 660 KB | Output is correct |
8 | Correct | 2 ms | 660 KB | Output is correct |
9 | Correct | 2 ms | 660 KB | Output is correct |
10 | Incorrect | 3 ms | 660 KB | Output isn't correct |