답안 #541761

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
541761 2022-03-24T10:03:50 Z FazacasMihai Baloni (COCI15_baloni) C++17
100 / 100
186 ms 1668 KB
#include <bits/stdc++.h>

using namespace std;

int v[100005];

int main()
{
    int n, k = 1, i, j, l, nr, cnt = 1;
    bool ok;
    cin>>n;
    cin>>nr;
    v[nr]++;
    for(i = 2; i <= n; i++)
    {
        cin>>nr;
        if(v[nr + 1])
        {
            v[nr]++;
            v[nr + 1]--;
        }
        else
        {
            cnt++;
            v[nr]++;
        }
    }
    cout<<cnt;

    return 0;
}

Compilation message

baloni.cpp: In function 'int main()':
baloni.cpp:9:12: warning: unused variable 'k' [-Wunused-variable]
    9 |     int n, k = 1, i, j, l, nr, cnt = 1;
      |            ^
baloni.cpp:9:22: warning: unused variable 'j' [-Wunused-variable]
    9 |     int n, k = 1, i, j, l, nr, cnt = 1;
      |                      ^
baloni.cpp:9:25: warning: unused variable 'l' [-Wunused-variable]
    9 |     int n, k = 1, i, j, l, nr, cnt = 1;
      |                         ^
baloni.cpp:10:10: warning: unused variable 'ok' [-Wunused-variable]
   10 |     bool ok;
      |          ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 175 ms 1480 KB Output is correct
6 Correct 186 ms 1668 KB Output is correct
7 Correct 142 ms 948 KB Output is correct
8 Correct 141 ms 1004 KB Output is correct
9 Correct 162 ms 1264 KB Output is correct
10 Correct 161 ms 1352 KB Output is correct