Submission #846925

# Submission time Handle Problem Language Result Execution time Memory
846925 2023-09-08T16:40:49 Z vjudge1 Growing Trees (BOI11_grow) C++17
0 / 100
1000 ms 2388 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 17;
int n, m, x, y, z, zz, a[N];
char t;
int main()
{
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    sort (a + 1, a + n + 1);
    while (m--)
    {
        cin >> t >> x >> y;
        if (t == 'F')
        {
            int i = 1;
            while (x > 0 && i <= n)
            {
                z = upper_bound (a + i, a + n + 1, y) - a - 1;
                i = z + 1;
                while (z > 0 && a[z] >= y && x > 0)
                {
                    a[z]++;
                    z--;
                    x--;
                }
                y = a[i];
            }
        }
        else
        {
            z = lower_bound (a + 1, a + n + 1, x) - a;
            zz = upper_bound (a + 1, a + n + 1, y) - a;
            cout << zz - z << "\n";
        }
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 799 ms 1524 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 141 ms 1364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 160 ms 1260 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 167 ms 1364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 216 ms 1364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 218 ms 1360 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1059 ms 1660 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 244 ms 1632 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 426 ms 2388 KB Output isn't correct
2 Halted 0 ms 0 KB -