# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
541754 | FazacasMihai | Baloni (COCI15_baloni) | C++11 | 24 ms | 1204 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 <bits/stdc++.h>
using namespace std;
int v[100005], v2[100005];
int main()
{
int n, k = 1, i, j, l;
bool ok;
cin>>n;
for(i = 1; i <= n; i++)
{
cin>>v[i];
}
v2[k] = v[1];
for(i = 2; i <= n; i++)
{
ok = 0;
for(j = 1; j <= k; j++)
{
if(v[i] == v2[j] - 1)
{
v2[j]--;
ok = 1;
}
}
if(ok != 1)
{
k++;
v2[k] = v[i];
}
}
cout<<k;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |