Submission #1112415

# Submission time Handle Problem Language Result Execution time Memory
1112415 2024-11-14T07:28:16 Z vjudge1 Baloni (COCI15_baloni) C++17
100 / 100
1878 ms 3896 KB
#include <bits/stdc++.h>

using namespace std;

int n,h[1000000],counter;

inline void arrow(int height,int index)
{
    counter++;
    
    for (int i = index; height>0 && i<n; i++)
    {
        if(h[i]==height)
        {
            height--;
            h[i] = 0;
        }
    }
    
}

int main()
{
    cin >> n;

    for (int i = 0; i < n; i++)
    {
        cin >> h[i];
    }

    for (int i = 0; i < n; i++)
    {
        if(h[i])
        {
            arrow(h[i],i);
        }
    }    

    cout << counter;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 2 ms 336 KB Output is correct
3 Correct 4 ms 336 KB Output is correct
4 Correct 6 ms 464 KB Output is correct
5 Correct 751 ms 3540 KB Output is correct
6 Correct 1878 ms 3896 KB Output is correct
7 Correct 1593 ms 3292 KB Output is correct
8 Correct 1506 ms 3256 KB Output is correct
9 Correct 1096 ms 3400 KB Output is correct
10 Correct 1508 ms 3528 KB Output is correct