# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
594195 | 2022-07-12T08:10:50 Z | 박상훈(#8431) | Sandcastle 2 (JOI22_ho_t5) | C++17 | 5 ms | 852 KB |
#include <bits/stdc++.h> typedef long long ll; using namespace std; int n, m; vector<vector<int>> a; void solve1(){ int pt = 0; ll ans = 0; bool flag; for (int i=1;i<=m;i++){ if (i==m) {ans++; break;} if (pt<=i){ pt = i+1; flag = (a[1][i] < a[1][pt]); } while(pt<m && flag==(a[1][pt] < a[1][pt+1])) pt++; ans += pt - i + 1; //printf("%d: %d\n", i, pt); } printf("%lld\n", ans); exit(0); } int main(){ scanf("%d %d", &n, &m); a.resize(n+1, vector<int>(m+1, 0)); for (int i=1;i<=n;i++){ for (int j=1;j<=m;j++){ scanf("%d", &a[i][j]); } } if (n==1) solve1(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 5 ms | 852 KB | Output is correct |
3 | Correct | 5 ms | 852 KB | Output is correct |
4 | Correct | 5 ms | 852 KB | Output is correct |
5 | Correct | 5 ms | 852 KB | Output is correct |
6 | Correct | 5 ms | 852 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |