답안 #382823

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
382823 2021-03-28T09:22:26 Z Slavita Po (COCI21_po) C++14
30 / 70
13 ms 1132 KB
#include <bits/stdc++.h>
#define ve vector<int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pi pair<int,int>
#define all(v) v.begin(),v.end()
#define si(v) (int)v.size()
#define en '\n'
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

const int N = 1e5 + 228;
const int big = 1e9;
int n, n2, a[N], b[N];

int main(){
    iostream::sync_with_stdio(false); cin.tie(0); ios_base::sync_with_stdio(false); cout.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    cin >> n;
    n2 = 0;
    b[0] = -9999999;
    for (int i = 1; i <= n; i++) {cin >> b[i]; if (b[i] != b[i - 1]) {n2++; a[n2] = b[i];}}
    int kol = 0, kol2 = 0;
    a[0] = 0;
    for (int i = 1; i <= n2; i++){
        if (a[i] < a[i - 1]) kol++;
    }
    for (int i = 0; i <= n2; i++){
        if (a[i] > a[i + 1]) kol2++;
    }
    cout << max(kol, kol2);
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Incorrect 1 ms 364 KB Output isn't correct
4 Incorrect 5 ms 748 KB Output isn't correct
5 Incorrect 7 ms 876 KB Output isn't correct
6 Correct 13 ms 1132 KB Output is correct
7 Correct 13 ms 1132 KB Output is correct