답안 #382814

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
382814 2021-03-28T09:06:45 Z Sashuk_keshuk Po (COCI21_po) C++14
0 / 70
25 ms 2156 KB
#include <bits/stdc++.h>
using namespace std;

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

int main(){
    cin.tie(0); cout.tie(0); iostream::sync_with_stdio(false); ios_base::sync_with_stdio(false);
    cin >> n;
    n2 = 0;
    for (int i = 1; i <= n; i++) {cin >> b[i]; if (b[i] != b[i - 1]) {n2++; a[n2] = b[i];}}
    a[0] = 0;
    int kol = 0;
    int kol2 = 0;
    for (int i = 1; i <= n2; i++) cout << a[i] << ' '; cout << '\n';
    for (int i = 0; i <= n2; i++){
        if (a[i] < a[i + 1]) kol++;
    }
    /*a[0] = 999;
    for (int i = n2 + 1; i >= 1; i--){
        if (a[i] < a[i - 1]) kol++;
    }*/
    cout << kol;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:15:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   15 |     for (int i = 1; i <= n2; i++) cout << a[i] << ' '; cout << '\n';
      |     ^~~
Main.cpp:15:56: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   15 |     for (int i = 1; i <= n2; i++) cout << a[i] << ' '; cout << '\n';
      |                                                        ^~~~
Main.cpp:14:9: warning: unused variable 'kol2' [-Wunused-variable]
   14 |     int kol2 = 0;
      |         ^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Incorrect 1 ms 364 KB Output isn't correct
4 Incorrect 9 ms 876 KB Output isn't correct
5 Incorrect 13 ms 1132 KB Output isn't correct
6 Incorrect 23 ms 2156 KB Output isn't correct
7 Incorrect 25 ms 2156 KB Output isn't correct