# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
31640 | long10024070 | Baloni (COCI15_baloni) | C++11 | 73 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 <cstdio>
using namespace std;
const string TASK = "Baloni";
int n,h[(int)1e6+1],c[(int)1e6+1],res;
void Enter()
{
cin >> n;
for (int i=1;i<=n;++i)
cin >> h[i];
}
void Init()
{
}
void Solve()
{
res = 0;
for (int i=1;i<=n;++i)
if (c[h[i]] == 0) {
++res;
++c[h[i]-1];
}
else {
--c[h[i]];
++c[h[i]-1];
}
cout << res;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
//freopen((TASK+".INP").c_str(),"r",stdin);
//freopen((TASK+".OUT").c_str(),"w",stdout);
Enter();
Init();
Solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |