# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
526902 | 2022-02-16T15:38:43 Z | eecs | Sandcastle 2 (JOI22_ho_t5) | C++17 | 13 ms | 868 KB |
#include <bits/stdc++.h> using namespace std; const int maxn = 50010; int h, w, a[maxn]; long long ans; int id(int x, int y) { return (x - 1) * w + y; } int main() { scanf("%d %d", &h, &w); for (int i = 1; i <= h; i++) { for (int j = 1; j <= w; j++) { scanf("%d", &a[id(i, j)]); } } if (h == 1) { static int f[maxn], id[maxn]; fill(f + 1, f + w + 1, 1); iota(id + 1, id + w + 1, 1); sort(id + 1, id + w + 1, [&](int x, int y) { return a[x] < a[y]; }); for (int i = 1; i <= w; i++) { int x = id[i]; if (x > 1 && a[x - 1] < a[x]) f[x] += f[x - 1]; if (x < w && a[x + 1] < a[x]) f[x] += f[x + 1]; } printf("%lld\n", accumulate(f + 1, f + w + 1, 0LL)), exit(0); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 6 ms | 844 KB | Output is correct |
3 | Correct | 11 ms | 796 KB | Output is correct |
4 | Correct | 13 ms | 868 KB | Output is correct |
5 | Correct | 9 ms | 844 KB | Output is correct |
6 | Correct | 9 ms | 844 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |