답안 #467453

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
467453 2021-08-23T03:31:49 Z thiennn Baloni (COCI15_baloni) C++14
100 / 100
223 ms 3856 KB
#include <bits/stdc++.h>
using namespace std;
#define fasty ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define forinc(x,a,b) for(int x=a;x<=b;x++)
#define ford(x,a,b) for(int x=a;x>=b;x--)
#define forv(a,b) for(auto&a:b)
#define fi first
#define se second
#define pb push_back
#define ii pair<int,int>
#define mt make_tuple
#define all(a) a.begin(),a.end()
#define reset(f,x) memset(f,x,sizeof(f))
#define getbit(x,i) ((x>>i)&1)
#define batbit(x,i) (x|(1ll<<i))
#define tatbit(x,i) (x&~(1<<i))
#define gg exit(0);
const int N = 1e6+10;
int h[N];
int cnt[N];
int shoot;
int n;
main()
{
    cin >> n;
    forinc(i,1,n)
    {
        int x;
        cin >> x;
        if(cnt[x] == 0)
        {
            cnt[x-1]++;
            shoot++;
        }
        else
        {
            cnt[x]--;
            cnt[x-1]++;
        }

    }
    cout << shoot;
}

Compilation message

baloni.cpp:23:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   23 | main()
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 2 ms 204 KB Output is correct
5 Correct 208 ms 3856 KB Output is correct
6 Correct 223 ms 3804 KB Output is correct
7 Correct 179 ms 3076 KB Output is correct
8 Correct 176 ms 3076 KB Output is correct
9 Correct 195 ms 3464 KB Output is correct
10 Correct 198 ms 3336 KB Output is correct