# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
31645 | antran2202 | Baloni (COCI15_baloni) | C++14 | 113 ms | 9988 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <set>
#include <map>
#include <queue>
#include <cstdio>
#include <algorithm>
#include <stack>
#include <vector>
using namespace std;
#define whole(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define sqr(x) ((x)*(x))
#define pb push_back
#define mp make_pair
#define ins insert
#define maxn int (1e6 + 1)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
//----------------------------------------------------------
int n, k, m;
int shot[maxn] = {}, h[maxn] = {};
void Input ()
{
cin >> n;
cerr << n;
for (int i = 1; i <= n; ++i)
cin >> h[i];
}
void Solve ()
{
for (int i = n; i >= 1; --i)
{
++shot[h[i]];
if (shot[h[i] - 1]) --shot[h[i] - 1];
}
int res = 0;
for (int i = 1; i < maxn; ++i) res += shot[i];
cout << res;
}
int main()
{
//freopen ("baloni.inp", "r", stdin);
//freopen ("baloni.out", "w", stdout);
ios_base::sync_with_stdio(false);
cin.tie (NULL);
cout.tie (NULL);
Input ();
Solve ();
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |