#include<bits/stdc++.h>
using namespace std;
const int nax = 2004;
int n, m, q;
vector<pair<long long, int>>lines[nax];
long long rem[nax];
void PlayGround() {
cin>>n>>m>>q;
for(int i=1; i<=n; ++i) {
lines[i].emplace_back(0LL, 0);
}
while(q--) {
int tp;
cin>>tp;
if(tp==1) {
int l, r, c, k;
cin>>l>>r>>c>>k;
for(int i=l; i<=r; ++i) {
rem[i] = min(lines[i].back().first, rem[i]);
lines[i].emplace_back(lines[i].back().first+k, c);
}
} else if(tp==2) {
int l, r, k;
cin>>l>>r>>k;
for(int i=l; i<=r; ++i) {
rem[i] += k;
}
} else {
long long a, b;
cin>>a>>b;
rem[a] = min(rem[a], lines[a].back().first);
b += rem[a];
if(b > lines[a].back().first) {
cout<<"0\n";
} else {
auto it = lower_bound(lines[a].begin(), lines[a].end(), make_pair(b, -1));
cout<<it->second<<'\n';
}
}
}
// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
PlayGround();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
6228 KB |
Output is correct |
2 |
Correct |
10 ms |
11780 KB |
Output is correct |
3 |
Correct |
12 ms |
13780 KB |
Output is correct |
4 |
Correct |
20 ms |
24384 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
16 ms |
17792 KB |
Output is correct |
8 |
Correct |
17 ms |
17620 KB |
Output is correct |
9 |
Correct |
16 ms |
17364 KB |
Output is correct |
10 |
Correct |
21 ms |
18356 KB |
Output is correct |
11 |
Correct |
17 ms |
18932 KB |
Output is correct |
12 |
Correct |
16 ms |
17880 KB |
Output is correct |
13 |
Correct |
22 ms |
26192 KB |
Output is correct |
14 |
Correct |
28 ms |
31340 KB |
Output is correct |
15 |
Correct |
16 ms |
15956 KB |
Output is correct |
16 |
Correct |
28 ms |
30904 KB |
Output is correct |
17 |
Correct |
11 ms |
9472 KB |
Output is correct |
18 |
Correct |
15 ms |
14164 KB |
Output is correct |
19 |
Correct |
2 ms |
652 KB |
Output is correct |
20 |
Correct |
3 ms |
724 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
6228 KB |
Output is correct |
2 |
Correct |
10 ms |
11780 KB |
Output is correct |
3 |
Correct |
12 ms |
13780 KB |
Output is correct |
4 |
Correct |
20 ms |
24384 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
16 ms |
17792 KB |
Output is correct |
8 |
Correct |
17 ms |
17620 KB |
Output is correct |
9 |
Correct |
16 ms |
17364 KB |
Output is correct |
10 |
Correct |
21 ms |
18356 KB |
Output is correct |
11 |
Correct |
17 ms |
18932 KB |
Output is correct |
12 |
Correct |
16 ms |
17880 KB |
Output is correct |
13 |
Correct |
22 ms |
26192 KB |
Output is correct |
14 |
Correct |
28 ms |
31340 KB |
Output is correct |
15 |
Correct |
16 ms |
15956 KB |
Output is correct |
16 |
Correct |
28 ms |
30904 KB |
Output is correct |
17 |
Correct |
11 ms |
9472 KB |
Output is correct |
18 |
Correct |
15 ms |
14164 KB |
Output is correct |
19 |
Correct |
2 ms |
652 KB |
Output is correct |
20 |
Correct |
3 ms |
724 KB |
Output is correct |
21 |
Correct |
10 ms |
10708 KB |
Output is correct |
22 |
Correct |
10 ms |
11952 KB |
Output is correct |
23 |
Correct |
16 ms |
16060 KB |
Output is correct |
24 |
Correct |
20 ms |
24532 KB |
Output is correct |
25 |
Correct |
1 ms |
340 KB |
Output is correct |
26 |
Correct |
1 ms |
388 KB |
Output is correct |
27 |
Correct |
15 ms |
15228 KB |
Output is correct |
28 |
Correct |
17 ms |
18428 KB |
Output is correct |
29 |
Correct |
17 ms |
18136 KB |
Output is correct |
30 |
Correct |
17 ms |
17640 KB |
Output is correct |
31 |
Correct |
19 ms |
14676 KB |
Output is correct |
32 |
Correct |
15 ms |
14560 KB |
Output is correct |
33 |
Correct |
22 ms |
24600 KB |
Output is correct |
34 |
Correct |
28 ms |
31188 KB |
Output is correct |
35 |
Correct |
19 ms |
22952 KB |
Output is correct |
36 |
Correct |
27 ms |
30728 KB |
Output is correct |
37 |
Correct |
2 ms |
636 KB |
Output is correct |
38 |
Correct |
2 ms |
764 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
640 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
724 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
6228 KB |
Output is correct |
2 |
Correct |
10 ms |
11780 KB |
Output is correct |
3 |
Correct |
12 ms |
13780 KB |
Output is correct |
4 |
Correct |
20 ms |
24384 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
16 ms |
17792 KB |
Output is correct |
8 |
Correct |
17 ms |
17620 KB |
Output is correct |
9 |
Correct |
16 ms |
17364 KB |
Output is correct |
10 |
Correct |
21 ms |
18356 KB |
Output is correct |
11 |
Correct |
17 ms |
18932 KB |
Output is correct |
12 |
Correct |
16 ms |
17880 KB |
Output is correct |
13 |
Correct |
22 ms |
26192 KB |
Output is correct |
14 |
Correct |
28 ms |
31340 KB |
Output is correct |
15 |
Correct |
16 ms |
15956 KB |
Output is correct |
16 |
Correct |
28 ms |
30904 KB |
Output is correct |
17 |
Correct |
11 ms |
9472 KB |
Output is correct |
18 |
Correct |
15 ms |
14164 KB |
Output is correct |
19 |
Correct |
2 ms |
652 KB |
Output is correct |
20 |
Correct |
3 ms |
724 KB |
Output is correct |
21 |
Runtime error |
1 ms |
640 KB |
Execution killed with signal 11 |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
724 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
6228 KB |
Output is correct |
2 |
Correct |
10 ms |
11780 KB |
Output is correct |
3 |
Correct |
12 ms |
13780 KB |
Output is correct |
4 |
Correct |
20 ms |
24384 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
16 ms |
17792 KB |
Output is correct |
8 |
Correct |
17 ms |
17620 KB |
Output is correct |
9 |
Correct |
16 ms |
17364 KB |
Output is correct |
10 |
Correct |
21 ms |
18356 KB |
Output is correct |
11 |
Correct |
17 ms |
18932 KB |
Output is correct |
12 |
Correct |
16 ms |
17880 KB |
Output is correct |
13 |
Correct |
22 ms |
26192 KB |
Output is correct |
14 |
Correct |
28 ms |
31340 KB |
Output is correct |
15 |
Correct |
16 ms |
15956 KB |
Output is correct |
16 |
Correct |
28 ms |
30904 KB |
Output is correct |
17 |
Correct |
11 ms |
9472 KB |
Output is correct |
18 |
Correct |
15 ms |
14164 KB |
Output is correct |
19 |
Correct |
2 ms |
652 KB |
Output is correct |
20 |
Correct |
3 ms |
724 KB |
Output is correct |
21 |
Correct |
10 ms |
10708 KB |
Output is correct |
22 |
Correct |
10 ms |
11952 KB |
Output is correct |
23 |
Correct |
16 ms |
16060 KB |
Output is correct |
24 |
Correct |
20 ms |
24532 KB |
Output is correct |
25 |
Correct |
1 ms |
340 KB |
Output is correct |
26 |
Correct |
1 ms |
388 KB |
Output is correct |
27 |
Correct |
15 ms |
15228 KB |
Output is correct |
28 |
Correct |
17 ms |
18428 KB |
Output is correct |
29 |
Correct |
17 ms |
18136 KB |
Output is correct |
30 |
Correct |
17 ms |
17640 KB |
Output is correct |
31 |
Correct |
19 ms |
14676 KB |
Output is correct |
32 |
Correct |
15 ms |
14560 KB |
Output is correct |
33 |
Correct |
22 ms |
24600 KB |
Output is correct |
34 |
Correct |
28 ms |
31188 KB |
Output is correct |
35 |
Correct |
19 ms |
22952 KB |
Output is correct |
36 |
Correct |
27 ms |
30728 KB |
Output is correct |
37 |
Correct |
2 ms |
636 KB |
Output is correct |
38 |
Correct |
2 ms |
764 KB |
Output is correct |
39 |
Runtime error |
1 ms |
640 KB |
Execution killed with signal 11 |
40 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
6228 KB |
Output is correct |
2 |
Correct |
10 ms |
11780 KB |
Output is correct |
3 |
Correct |
12 ms |
13780 KB |
Output is correct |
4 |
Correct |
20 ms |
24384 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
16 ms |
17792 KB |
Output is correct |
8 |
Correct |
17 ms |
17620 KB |
Output is correct |
9 |
Correct |
16 ms |
17364 KB |
Output is correct |
10 |
Correct |
21 ms |
18356 KB |
Output is correct |
11 |
Correct |
17 ms |
18932 KB |
Output is correct |
12 |
Correct |
16 ms |
17880 KB |
Output is correct |
13 |
Correct |
22 ms |
26192 KB |
Output is correct |
14 |
Correct |
28 ms |
31340 KB |
Output is correct |
15 |
Correct |
16 ms |
15956 KB |
Output is correct |
16 |
Correct |
28 ms |
30904 KB |
Output is correct |
17 |
Correct |
11 ms |
9472 KB |
Output is correct |
18 |
Correct |
15 ms |
14164 KB |
Output is correct |
19 |
Correct |
2 ms |
652 KB |
Output is correct |
20 |
Correct |
3 ms |
724 KB |
Output is correct |
21 |
Correct |
10 ms |
10708 KB |
Output is correct |
22 |
Correct |
10 ms |
11952 KB |
Output is correct |
23 |
Correct |
16 ms |
16060 KB |
Output is correct |
24 |
Correct |
20 ms |
24532 KB |
Output is correct |
25 |
Correct |
1 ms |
340 KB |
Output is correct |
26 |
Correct |
1 ms |
388 KB |
Output is correct |
27 |
Correct |
15 ms |
15228 KB |
Output is correct |
28 |
Correct |
17 ms |
18428 KB |
Output is correct |
29 |
Correct |
17 ms |
18136 KB |
Output is correct |
30 |
Correct |
17 ms |
17640 KB |
Output is correct |
31 |
Correct |
19 ms |
14676 KB |
Output is correct |
32 |
Correct |
15 ms |
14560 KB |
Output is correct |
33 |
Correct |
22 ms |
24600 KB |
Output is correct |
34 |
Correct |
28 ms |
31188 KB |
Output is correct |
35 |
Correct |
19 ms |
22952 KB |
Output is correct |
36 |
Correct |
27 ms |
30728 KB |
Output is correct |
37 |
Correct |
2 ms |
636 KB |
Output is correct |
38 |
Correct |
2 ms |
764 KB |
Output is correct |
39 |
Runtime error |
1 ms |
640 KB |
Execution killed with signal 11 |
40 |
Halted |
0 ms |
0 KB |
- |