# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
594231 | 2022-07-12T09:03:27 Z | 이동현(#8435) | Sandcastle 2 (JOI22_ho_t5) | C++17 | 5 ms | 1284 KB |
#include <bits/stdc++.h> #define int long long using namespace std; signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); int n, m; cin >> m >> n; vector<int> a(n); for(int i = 0; i < n; ++i){ cin >> a[i]; } vector<int> r(n); int ans = 0; for(int i = n - 1; i >= 0; --i){ r[i] = i; if(i + 1 < n) r[i] = i + 1; if(i + 2 < n && (r[i + 1] - r[i]) * (r[i + 2] - r[i + 1] > 0)) r[i] = r[i + 1]; ans += r[i] - i + 1; } cout << ans << '\n'; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 5 ms | 1284 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |