Submission #924639

# Submission time Handle Problem Language Result Execution time Memory
924639 2024-02-09T10:59:01 Z iMeAndMyself Global Warming (NOI13_gw) C++14
0 / 40
270 ms 17440 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 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 1460 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 1876 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 270 ms 17440 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 262 ms 16680 KB Output isn't correct
2 Halted 0 ms 0 KB -