Submission #834780

# Submission time Handle Problem Language Result Execution time Memory
834780 2023-08-22T19:19:25 Z mat_jur Growing Trees (BOI11_grow) C++17
0 / 100
175 ms 584 KB
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
auto&operator<<(auto &o, pair<auto, auto> p) {o << "(" << p.first << "," << p.second << ")"; return o;}
auto operator<<(auto&o,auto x)->decltype(x.end(),o){o<<"{";for(auto e:x)o<< e << ", ";return o<<"}";}
#define debug(X) cerr << "["#X"]:" << X << '\n';
#else 
#define debug(X) ;
#endif
#define ll long long

int main () {
	int n, q;
	cin >> n >> q;
	vector<int> cnt(100);
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		cnt[a]++;
	}
	while (q--) {
		char c;
		cin >> c;
		if (c == 'F') {
			int c, h;
			cin >> c >> h;
			while (c > 0) {
				int x = min(cnt[h], c);
				cnt[h] -= x;
				cnt[h+1] += x;
				c -= x;
				h++;
			}
		}
		else {
			int res = 0;
			int l, r;
			cin >> l >> r;
			for (int i = l; i <= r; i++) {
				res += cnt[i];
			}
			cout << res << '\n';
		}
	}

	return 0;
}

# Verdict Execution time Memory Grader output
1 Runtime error 13 ms 340 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 340 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 64 ms 584 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 11 ms 340 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 17 ms 340 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 175 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 13 ms 340 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -