Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals), problem: (A) Unimodal Array Solution In C/C++

By |2017-07-24T17:41:42+00:00July 24th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , , , |

#include<cstdio> using namespace std; int n,i,la,nw,fl,tp; int main(){ for(scanf("%d%d",&n,&la);++i<n;la=nw,fl=tp) if(scanf("%d",&nw),fl>(tp=(nw>la?0:(nw<la?2:1))))return puts("NO"); return puts("YES"); }