#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 2010;
int n, m, q;
deque<pair<ll, ll>> g[N];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin >> n >> m >> q;
if(n <= 2000 && q <= 2000) {
for(int i = 0; i < q; i++) {
int t;
cin >> t;
if(t == 1) {
ll l, r, c, k;
cin >> l >> r >> c >> k;
for(int j = l; j <= r; j++) {
g[j].push_back({c, k});
}
}
if(t == 2) {
ll l, r, k;
cin >> l >> r >> k;
for(int j = l; j <= r; j++) {
while(!g[j].empty() && g[j].front().second <= k) {
k -= g[j].front().second;
g[j].pop_front();
}
if(!g[j].empty())
g[j][0].second -= k;
}
}
if(t == 3) {
ll a, b;
cin >> a >> b;
int ans = 0;
for(auto [c, k] : g[a]) {
if(b > k) b -= k;
else {ans = c; break;}
}
cout << ans << '\n';
}
}
return 0;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
5460 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
5460 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1620 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1620 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
5460 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1620 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
5460 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
5460 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |