# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
955648 | 2024-03-31T08:36:18 Z | n3rm1n | Growing Trees (BOI11_grow) | C++17 | 1000 ms | 6884 KB |
#include<bits/stdc++.h> #define endl '\n' using namespace std; const int MAXN = 1e5 + 10; void speed() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } int n, m; int a[MAXN]; multiset < int > s; void read_array() { cin >> n >> m; for (int i = 1; i <= n; ++ i) { cin >> a[i]; s.insert(a[i]); } } void solve() { char type; int x, y; while(m --) { cin >> type >> x >> y; if(type == 'F') { multiset < int >::iterator it = s.lower_bound(y); vector < int > g; int cnt = 0; for (multiset < int >:: iterator i = it; i != s.end();) { cnt ++; int val = *i; g.push_back(val); if(cnt == x)break; std::advance(i, 1); } for (int i = 0; i < g.size(); ++ i) { s.erase(s.find(g[i])); s.insert(g[i] + 1); } } else { int cut = std::distance(s.begin(), s.lower_bound(x)) - 1; int add = std::distance(s.begin(), s.upper_bound(y)) - 1; cout << add - cut << endl; } } } int main() { speed(); read_array(); solve(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1055 ms | 6240 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 572 KB | Output is correct |
2 | Correct | 36 ms | 600 KB | Output is correct |
3 | Correct | 28 ms | 344 KB | Output is correct |
4 | Correct | 21 ms | 344 KB | Output is correct |
5 | Execution timed out | 1049 ms | 1336 KB | Time limit exceeded |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1034 ms | 1524 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1053 ms | 1372 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1056 ms | 4788 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1010 ms | 5448 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1020 ms | 5692 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1035 ms | 6376 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1043 ms | 6184 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1030 ms | 6884 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |