Submission #924639

#TimeUsernameProblemLanguageResultExecution timeMemory
924639iMeAndMyselfGlobal Warming (NOI13_gw)C++14
0 / 40
270 ms17440 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { int n,i,vf=0,it=0; cin>>n; ll v[n+1]; for(i=1; i<=n; i++) cin>>v[i]; v[0]=0, v[n+1]=0; for(i=1; i<=n; i++) if(v[i]>v[i-1]&&v[i]>=v[i+1]||v[i]>=v[i-1]&&v[i]>v[i+1]) vf++; for(i=2; i<n; i++) if(v[i]<v[i-1]&&v[i]<=v[i+1]||v[i]<=v[i-1]&&v[i]<v[i+1]) it++; cout<<vf; return 0; }

Compilation message (stderr)

gw.cpp: In function 'int main()':
gw.cpp:13:23: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   13 |         if(v[i]>v[i-1]&&v[i]>=v[i+1]||v[i]>=v[i-1]&&v[i]>v[i+1])
      |            ~~~~~~~~~~~^~~~~~~~~~~~~~
gw.cpp:16:23: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   16 |         if(v[i]<v[i-1]&&v[i]<=v[i+1]||v[i]<=v[i-1]&&v[i]<v[i+1])
      |            ~~~~~~~~~~~^~~~~~~~~~~~~~
#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...