# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
62797 | 2018-07-30T05:39:19 Z | BBang3 | None (KOI18_matrix) | C++14 | 147 ms | 4912 KB |
#include <cstdio> #include <algorithm> #include <vector> using namespace std; struct H { int a; int b; H() {} H(int a, int b) : a(a), b(b) {} bool operator < (const H &t) { return a < t.a; } }; int N, M; int arr[3][200000 + 5]; H matrix[200000 + 5]; int D[200000 + 5]; vector<int> L; int main() { scanf("%d %d", &M, &N); for (int i = 0; i < M; i++) { for (int j = 1; j <= N; j++) { scanf("%d", &arr[i][j]); } } int ans = 0; if (M == 2) { for (int i = 1; i <= N; i++) { matrix[i] = H(arr[0][i], arr[1][i]); } sort(matrix + 1, matrix + 1 + N); L.push_back(-1); for (int i = 1; i <= N; i++) { if (matrix[i].b > L.back()) { L.push_back(matrix[i].b); ans++; } else { auto it = lower_bound(L.begin(), L.end(), matrix[i].b); *it = matrix[i].b; } } } printf("%d", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 508 KB | Output is correct |
2 | Correct | 11 ms | 508 KB | Output is correct |
3 | Correct | 11 ms | 544 KB | Output is correct |
4 | Correct | 12 ms | 596 KB | Output is correct |
5 | Correct | 13 ms | 672 KB | Output is correct |
6 | Correct | 11 ms | 800 KB | Output is correct |
7 | Correct | 9 ms | 800 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 800 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 508 KB | Output is correct |
2 | Correct | 11 ms | 508 KB | Output is correct |
3 | Correct | 11 ms | 544 KB | Output is correct |
4 | Correct | 12 ms | 596 KB | Output is correct |
5 | Correct | 13 ms | 672 KB | Output is correct |
6 | Correct | 11 ms | 800 KB | Output is correct |
7 | Correct | 9 ms | 800 KB | Output is correct |
8 | Correct | 133 ms | 3796 KB | Output is correct |
9 | Correct | 147 ms | 3796 KB | Output is correct |
10 | Correct | 136 ms | 4084 KB | Output is correct |
11 | Correct | 103 ms | 4084 KB | Output is correct |
12 | Correct | 132 ms | 4084 KB | Output is correct |
13 | Correct | 99 ms | 4392 KB | Output is correct |
14 | Correct | 112 ms | 4392 KB | Output is correct |
15 | Correct | 110 ms | 4392 KB | Output is correct |
16 | Correct | 129 ms | 4912 KB | Output is correct |
17 | Correct | 111 ms | 4912 KB | Output is correct |
18 | Correct | 118 ms | 4912 KB | Output is correct |
19 | Correct | 110 ms | 4912 KB | Output is correct |
20 | Correct | 143 ms | 4912 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 800 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |