Submission #924640

# Submission time Handle Problem Language Result Execution time Memory
924640 2024-02-09T10:59:58 Z iMeAndMyself Global Warming (NOI13_gw) C++14
0 / 40
277 ms 8272 KB
#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

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 time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 1116 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 1112 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 277 ms 8272 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 251 ms 8232 KB Output isn't correct
2 Halted 0 ms 0 KB -