Submission #824496

#TimeUsernameProblemLanguageResultExecution timeMemory
824496ttamxSandcastle 2 (JOI22_ho_t5)C++14
9 / 100
5 ms876 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int W=50005; const int inf=1e9; int h,w; int a[W]; ll ans=0; int main(){ cin.tie(nullptr)->sync_with_stdio(false); cin >> h >> w; for(int i=1;i<=h;i++)for(int j=1;j<=w;j++)cin >> a[j]; int mx=inf,sz=0; for(int i=1;i<=w;i++){ if(mx>a[i])sz=1; else sz++; mx=a[i]; ans+=sz; } mx=inf,sz=0; for(int i=w;i>=1;i--){ if(mx>a[i])sz=1; else sz++; mx=a[i]; ans+=sz; } cout << ans-w << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...