# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
594071 | 2022-07-12T04:42:21 Z | 반딧불(#8432) | Sandcastle 2 (JOI22_ho_t5) | C++17 | 10 ms | 856 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n, m; int arr[50002]; ll ans; int main(){ scanf("%d %d", &n, &n); for(int i=1; i<=n; i++) scanf("%d", &arr[i]); ans = n; for(int i=1; i<n; i++){ int j = i; while(j+2<=n && ((arr[j+1]<arr[j+2]) == (arr[i]<arr[i+1]))) j++; ans += ll(j-i+1)*(j-i+2)/2; i=j; } printf("%lld", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 5 ms | 852 KB | Output is correct |
3 | Correct | 10 ms | 856 KB | Output is correct |
4 | Correct | 6 ms | 852 KB | Output is correct |
5 | Correct | 6 ms | 852 KB | Output is correct |
6 | Correct | 8 ms | 852 KB | Output is correct |
# | 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 | - |