Submission #624759

#TimeUsernameProblemLanguageResultExecution timeMemory
624759QwertyPiSandcastle 2 (JOI22_ho_t5)C++14
9 / 100
23 ms1068 KiB
#include <bits/stdc++.h> #define int long long using namespace std; int a[50013]; int h, w; int id(int i, int j){ return i * w + j; } int32_t main(){ cin >> h >> w; for(int i = 0; i < h * w; i++){ cin >> a[i]; } int cnt = 1; int st = 0; int ans = 1; for(int i = 1; i < w; i++){ if(a[i] > a[i - 1]){ if(st > 0){ cnt++; }else{ cnt = 1; } ans += cnt + 1; st = 1; }else{ if(st < 0){ cnt++; }else{ cnt = 1; } ans += cnt + 1; st = -1; } } cout << ans << endl; }
#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...