Submission #847077

# Submission time Handle Problem Language Result Execution time Memory
847077 2023-09-09T06:22:20 Z vjudge1 Growing Trees (BOI11_grow) C++17
0 / 100
1000 ms 3260 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 = lower_bound (a + i, a + n + 1, y) - a;
                y = a[z];
                z = upper_bound (a + i, a + n + 1, y) - a - 1;
                i = z + 1;
                //cout << z << "\n";
                if (a[z] < 1)
                {
                    break;
                }
                while (z > 0 && a[z] >= y && x > 0)
                {
                    a[z]++;
                    z--;
                    x--;
                }
                //for (int i = 1; i <= n; i++) cout << a[i] << " ";
                //cout << "\n";
            }
        }
        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 787 ms 2060 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 500 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 143 ms 1540 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 162 ms 1616 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 168 ms 1572 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 199 ms 1616 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 216 ms 1616 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1075 ms 1516 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 243 ms 1920 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 489 ms 3260 KB Output isn't correct
2 Halted 0 ms 0 KB -