# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
31645 | antran2202 | Baloni (COCI15_baloni) | C++14 | 113 ms | 9988 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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... |