#include <bits/stdc++.h>
#define int long long
using namespace std;
void solve(){
int N, M, Q;
cin >> N >> M >> Q;
vector<deque<int>> q(N);
for(int i = 0; i < Q; i++){
int type;
cin >> type;
if(type == 1){
int l, r, c, k;
cin >> l >> r >> c >> k;
for(int j = l - 1; j <= r - 1; j++) q[j].push_back(c);
}else if(type == 2){
int l, r, k;
cin >> l >> r >> k;
for(int j = l - 1; j <= r - 1; j++) if(!q[j].empty()) q[j].pop_front();
}else{
int a, b;
cin >> a >> b;
if(q[a - 1].size() >= b) cout << q[a - 1][b - 1] << endl;
else cout << 0 << endl;
}
}
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
//freopen("output.txt", "w", stdout);
int t = 1;
//cin >> t;
for(int i = 1; i <= t; i++){
//printf("Case #%d: ", i);
solve();
}
}
Compilation message
foodcourt.cpp: In function 'void solve()':
foodcourt.cpp:23:32: warning: comparison of integer expressions of different signedness: 'std::deque<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
23 | if(q[a - 1].size() >= b) cout << q[a - 1][b - 1] << endl;
| ~~~~~~~~~~~~~~~~^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
1620 KB |
Output is correct |
2 |
Correct |
6 ms |
2128 KB |
Output is correct |
3 |
Correct |
7 ms |
5204 KB |
Output is correct |
4 |
Correct |
10 ms |
7124 KB |
Output is correct |
5 |
Correct |
2 ms |
340 KB |
Output is correct |
6 |
Correct |
2 ms |
328 KB |
Output is correct |
7 |
Correct |
9 ms |
7636 KB |
Output is correct |
8 |
Correct |
10 ms |
5704 KB |
Output is correct |
9 |
Correct |
8 ms |
2132 KB |
Output is correct |
10 |
Correct |
12 ms |
5460 KB |
Output is correct |
11 |
Correct |
10 ms |
4132 KB |
Output is correct |
12 |
Correct |
8 ms |
2132 KB |
Output is correct |
13 |
Correct |
12 ms |
2484 KB |
Output is correct |
14 |
Correct |
13 ms |
2644 KB |
Output is correct |
15 |
Correct |
10 ms |
3540 KB |
Output is correct |
16 |
Correct |
15 ms |
2644 KB |
Output is correct |
17 |
Correct |
4 ms |
1492 KB |
Output is correct |
18 |
Correct |
8 ms |
2124 KB |
Output is correct |
19 |
Correct |
2 ms |
1364 KB |
Output is correct |
20 |
Correct |
2 ms |
1620 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
1620 KB |
Output is correct |
2 |
Correct |
6 ms |
2128 KB |
Output is correct |
3 |
Correct |
7 ms |
5204 KB |
Output is correct |
4 |
Correct |
10 ms |
7124 KB |
Output is correct |
5 |
Correct |
2 ms |
340 KB |
Output is correct |
6 |
Correct |
2 ms |
328 KB |
Output is correct |
7 |
Correct |
9 ms |
7636 KB |
Output is correct |
8 |
Correct |
10 ms |
5704 KB |
Output is correct |
9 |
Correct |
8 ms |
2132 KB |
Output is correct |
10 |
Correct |
12 ms |
5460 KB |
Output is correct |
11 |
Correct |
10 ms |
4132 KB |
Output is correct |
12 |
Correct |
8 ms |
2132 KB |
Output is correct |
13 |
Correct |
12 ms |
2484 KB |
Output is correct |
14 |
Correct |
13 ms |
2644 KB |
Output is correct |
15 |
Correct |
10 ms |
3540 KB |
Output is correct |
16 |
Correct |
15 ms |
2644 KB |
Output is correct |
17 |
Correct |
4 ms |
1492 KB |
Output is correct |
18 |
Correct |
8 ms |
2124 KB |
Output is correct |
19 |
Correct |
2 ms |
1364 KB |
Output is correct |
20 |
Correct |
2 ms |
1620 KB |
Output is correct |
21 |
Incorrect |
6 ms |
2004 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
718 ms |
45012 KB |
Output is correct |
2 |
Correct |
566 ms |
45340 KB |
Output is correct |
3 |
Correct |
836 ms |
45236 KB |
Output is correct |
4 |
Correct |
727 ms |
45336 KB |
Output is correct |
5 |
Incorrect |
630 ms |
45232 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1074 ms |
211392 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
1620 KB |
Output is correct |
2 |
Correct |
6 ms |
2128 KB |
Output is correct |
3 |
Correct |
7 ms |
5204 KB |
Output is correct |
4 |
Correct |
10 ms |
7124 KB |
Output is correct |
5 |
Correct |
2 ms |
340 KB |
Output is correct |
6 |
Correct |
2 ms |
328 KB |
Output is correct |
7 |
Correct |
9 ms |
7636 KB |
Output is correct |
8 |
Correct |
10 ms |
5704 KB |
Output is correct |
9 |
Correct |
8 ms |
2132 KB |
Output is correct |
10 |
Correct |
12 ms |
5460 KB |
Output is correct |
11 |
Correct |
10 ms |
4132 KB |
Output is correct |
12 |
Correct |
8 ms |
2132 KB |
Output is correct |
13 |
Correct |
12 ms |
2484 KB |
Output is correct |
14 |
Correct |
13 ms |
2644 KB |
Output is correct |
15 |
Correct |
10 ms |
3540 KB |
Output is correct |
16 |
Correct |
15 ms |
2644 KB |
Output is correct |
17 |
Correct |
4 ms |
1492 KB |
Output is correct |
18 |
Correct |
8 ms |
2124 KB |
Output is correct |
19 |
Correct |
2 ms |
1364 KB |
Output is correct |
20 |
Correct |
2 ms |
1620 KB |
Output is correct |
21 |
Correct |
718 ms |
45012 KB |
Output is correct |
22 |
Correct |
566 ms |
45340 KB |
Output is correct |
23 |
Correct |
836 ms |
45236 KB |
Output is correct |
24 |
Correct |
727 ms |
45336 KB |
Output is correct |
25 |
Incorrect |
630 ms |
45232 KB |
Output isn't correct |
26 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
763 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
1620 KB |
Output is correct |
2 |
Correct |
6 ms |
2128 KB |
Output is correct |
3 |
Correct |
7 ms |
5204 KB |
Output is correct |
4 |
Correct |
10 ms |
7124 KB |
Output is correct |
5 |
Correct |
2 ms |
340 KB |
Output is correct |
6 |
Correct |
2 ms |
328 KB |
Output is correct |
7 |
Correct |
9 ms |
7636 KB |
Output is correct |
8 |
Correct |
10 ms |
5704 KB |
Output is correct |
9 |
Correct |
8 ms |
2132 KB |
Output is correct |
10 |
Correct |
12 ms |
5460 KB |
Output is correct |
11 |
Correct |
10 ms |
4132 KB |
Output is correct |
12 |
Correct |
8 ms |
2132 KB |
Output is correct |
13 |
Correct |
12 ms |
2484 KB |
Output is correct |
14 |
Correct |
13 ms |
2644 KB |
Output is correct |
15 |
Correct |
10 ms |
3540 KB |
Output is correct |
16 |
Correct |
15 ms |
2644 KB |
Output is correct |
17 |
Correct |
4 ms |
1492 KB |
Output is correct |
18 |
Correct |
8 ms |
2124 KB |
Output is correct |
19 |
Correct |
2 ms |
1364 KB |
Output is correct |
20 |
Correct |
2 ms |
1620 KB |
Output is correct |
21 |
Incorrect |
6 ms |
2004 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
1620 KB |
Output is correct |
2 |
Correct |
6 ms |
2128 KB |
Output is correct |
3 |
Correct |
7 ms |
5204 KB |
Output is correct |
4 |
Correct |
10 ms |
7124 KB |
Output is correct |
5 |
Correct |
2 ms |
340 KB |
Output is correct |
6 |
Correct |
2 ms |
328 KB |
Output is correct |
7 |
Correct |
9 ms |
7636 KB |
Output is correct |
8 |
Correct |
10 ms |
5704 KB |
Output is correct |
9 |
Correct |
8 ms |
2132 KB |
Output is correct |
10 |
Correct |
12 ms |
5460 KB |
Output is correct |
11 |
Correct |
10 ms |
4132 KB |
Output is correct |
12 |
Correct |
8 ms |
2132 KB |
Output is correct |
13 |
Correct |
12 ms |
2484 KB |
Output is correct |
14 |
Correct |
13 ms |
2644 KB |
Output is correct |
15 |
Correct |
10 ms |
3540 KB |
Output is correct |
16 |
Correct |
15 ms |
2644 KB |
Output is correct |
17 |
Correct |
4 ms |
1492 KB |
Output is correct |
18 |
Correct |
8 ms |
2124 KB |
Output is correct |
19 |
Correct |
2 ms |
1364 KB |
Output is correct |
20 |
Correct |
2 ms |
1620 KB |
Output is correct |
21 |
Incorrect |
6 ms |
2004 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |