#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
// #define int long long
#define ll long long
#define pb push_back
#define ppb pop_back
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define freopen(x) freopen(x".in","r",stdin);freopen(x".out","w",stdout);
const int N = 250000 + 5;
const int M = 1e3 + 5;
const ll mod = 1e9 + 7;
const ll inf = 1e17;
int n, m, q, typ, l, r, c, k, a, b, pos[N];
vector<int> v[N];
void solve(){
cin >> n >> m >> q;
while(q--){
cin >> typ;
if(typ == 1){
cin >> l >> r >> c >> k;
for(int i = l; i <= r; i++){
for(int j = 1; j <= k; j++){
v[i].pb(c);
}
}
}else if(typ == 2){
cin >> l >> r >> k;
for(int i = l; i <= r; i++){
pos[i] += k;
pos[i] = min(pos[i], int(v[i].size()));
}
}else{
cin >> a >> b;
if(b + pos[a] <= v[a].size()){
cout << v[a][pos[a] + b - 1] << '\n';
}else{
cout << 0 << '\n';
}
}
}
}
main() {
fast
int tt = 1;
// cin >> tt;
while(tt--){
solve();
}
}
Compilation message
foodcourt.cpp:3: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
3 | #pragma GCC optimization("O3")
|
foodcourt.cpp:4: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
4 | #pragma GCC optimization("unroll-loops")
|
foodcourt.cpp:5: warning: ignoring '#pragma comment ' [-Wunknown-pragmas]
5 | #pragma comment(linker, "/stack:200000000")
|
foodcourt.cpp: In function 'void solve()':
foodcourt.cpp:47:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
47 | if(b + pos[a] <= v[a].size()){
| ~~~~~~~~~~~^~~~~~~~~~~~~~
foodcourt.cpp: At global scope:
foodcourt.cpp:56:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
56 | main() {
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
7636 KB |
Output is correct |
2 |
Correct |
9 ms |
9172 KB |
Output is correct |
3 |
Correct |
11 ms |
9652 KB |
Output is correct |
4 |
Correct |
14 ms |
12596 KB |
Output is correct |
5 |
Correct |
4 ms |
6100 KB |
Output is correct |
6 |
Correct |
4 ms |
6096 KB |
Output is correct |
7 |
Correct |
12 ms |
10892 KB |
Output is correct |
8 |
Correct |
11 ms |
10708 KB |
Output is correct |
9 |
Correct |
11 ms |
10708 KB |
Output is correct |
10 |
Correct |
12 ms |
11092 KB |
Output is correct |
11 |
Correct |
14 ms |
11220 KB |
Output is correct |
12 |
Correct |
11 ms |
10964 KB |
Output is correct |
13 |
Correct |
16 ms |
13524 KB |
Output is correct |
14 |
Correct |
18 ms |
14312 KB |
Output is correct |
15 |
Correct |
11 ms |
10068 KB |
Output is correct |
16 |
Correct |
17 ms |
14164 KB |
Output is correct |
17 |
Correct |
7 ms |
8532 KB |
Output is correct |
18 |
Correct |
10 ms |
9812 KB |
Output is correct |
19 |
Correct |
4 ms |
6228 KB |
Output is correct |
20 |
Correct |
5 ms |
6308 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
7636 KB |
Output is correct |
2 |
Correct |
9 ms |
9172 KB |
Output is correct |
3 |
Correct |
11 ms |
9652 KB |
Output is correct |
4 |
Correct |
14 ms |
12596 KB |
Output is correct |
5 |
Correct |
4 ms |
6100 KB |
Output is correct |
6 |
Correct |
4 ms |
6096 KB |
Output is correct |
7 |
Correct |
12 ms |
10892 KB |
Output is correct |
8 |
Correct |
11 ms |
10708 KB |
Output is correct |
9 |
Correct |
11 ms |
10708 KB |
Output is correct |
10 |
Correct |
12 ms |
11092 KB |
Output is correct |
11 |
Correct |
14 ms |
11220 KB |
Output is correct |
12 |
Correct |
11 ms |
10964 KB |
Output is correct |
13 |
Correct |
16 ms |
13524 KB |
Output is correct |
14 |
Correct |
18 ms |
14312 KB |
Output is correct |
15 |
Correct |
11 ms |
10068 KB |
Output is correct |
16 |
Correct |
17 ms |
14164 KB |
Output is correct |
17 |
Correct |
7 ms |
8532 KB |
Output is correct |
18 |
Correct |
10 ms |
9812 KB |
Output is correct |
19 |
Correct |
4 ms |
6228 KB |
Output is correct |
20 |
Correct |
5 ms |
6308 KB |
Output is correct |
21 |
Runtime error |
551 ms |
524288 KB |
Execution killed with signal 9 |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
559 ms |
9436 KB |
Output is correct |
2 |
Correct |
437 ms |
9916 KB |
Output is correct |
3 |
Correct |
583 ms |
10204 KB |
Output is correct |
4 |
Correct |
586 ms |
10072 KB |
Output is correct |
5 |
Correct |
448 ms |
10872 KB |
Output is correct |
6 |
Correct |
444 ms |
10948 KB |
Output is correct |
7 |
Correct |
22 ms |
7116 KB |
Output is correct |
8 |
Correct |
19 ms |
7176 KB |
Output is correct |
9 |
Correct |
982 ms |
9612 KB |
Output is correct |
10 |
Correct |
935 ms |
9592 KB |
Output is correct |
11 |
Correct |
918 ms |
9800 KB |
Output is correct |
12 |
Correct |
956 ms |
9680 KB |
Output is correct |
13 |
Correct |
203 ms |
9472 KB |
Output is correct |
14 |
Correct |
263 ms |
10088 KB |
Output is correct |
15 |
Correct |
65 ms |
10500 KB |
Output is correct |
16 |
Correct |
79 ms |
10888 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
505 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
7636 KB |
Output is correct |
2 |
Correct |
9 ms |
9172 KB |
Output is correct |
3 |
Correct |
11 ms |
9652 KB |
Output is correct |
4 |
Correct |
14 ms |
12596 KB |
Output is correct |
5 |
Correct |
4 ms |
6100 KB |
Output is correct |
6 |
Correct |
4 ms |
6096 KB |
Output is correct |
7 |
Correct |
12 ms |
10892 KB |
Output is correct |
8 |
Correct |
11 ms |
10708 KB |
Output is correct |
9 |
Correct |
11 ms |
10708 KB |
Output is correct |
10 |
Correct |
12 ms |
11092 KB |
Output is correct |
11 |
Correct |
14 ms |
11220 KB |
Output is correct |
12 |
Correct |
11 ms |
10964 KB |
Output is correct |
13 |
Correct |
16 ms |
13524 KB |
Output is correct |
14 |
Correct |
18 ms |
14312 KB |
Output is correct |
15 |
Correct |
11 ms |
10068 KB |
Output is correct |
16 |
Correct |
17 ms |
14164 KB |
Output is correct |
17 |
Correct |
7 ms |
8532 KB |
Output is correct |
18 |
Correct |
10 ms |
9812 KB |
Output is correct |
19 |
Correct |
4 ms |
6228 KB |
Output is correct |
20 |
Correct |
5 ms |
6308 KB |
Output is correct |
21 |
Correct |
559 ms |
9436 KB |
Output is correct |
22 |
Correct |
437 ms |
9916 KB |
Output is correct |
23 |
Correct |
583 ms |
10204 KB |
Output is correct |
24 |
Correct |
586 ms |
10072 KB |
Output is correct |
25 |
Correct |
448 ms |
10872 KB |
Output is correct |
26 |
Correct |
444 ms |
10948 KB |
Output is correct |
27 |
Correct |
22 ms |
7116 KB |
Output is correct |
28 |
Correct |
19 ms |
7176 KB |
Output is correct |
29 |
Correct |
982 ms |
9612 KB |
Output is correct |
30 |
Correct |
935 ms |
9592 KB |
Output is correct |
31 |
Correct |
918 ms |
9800 KB |
Output is correct |
32 |
Correct |
956 ms |
9680 KB |
Output is correct |
33 |
Correct |
203 ms |
9472 KB |
Output is correct |
34 |
Correct |
263 ms |
10088 KB |
Output is correct |
35 |
Correct |
65 ms |
10500 KB |
Output is correct |
36 |
Correct |
79 ms |
10888 KB |
Output is correct |
37 |
Execution timed out |
1112 ms |
427192 KB |
Time limit exceeded |
38 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
503 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
7636 KB |
Output is correct |
2 |
Correct |
9 ms |
9172 KB |
Output is correct |
3 |
Correct |
11 ms |
9652 KB |
Output is correct |
4 |
Correct |
14 ms |
12596 KB |
Output is correct |
5 |
Correct |
4 ms |
6100 KB |
Output is correct |
6 |
Correct |
4 ms |
6096 KB |
Output is correct |
7 |
Correct |
12 ms |
10892 KB |
Output is correct |
8 |
Correct |
11 ms |
10708 KB |
Output is correct |
9 |
Correct |
11 ms |
10708 KB |
Output is correct |
10 |
Correct |
12 ms |
11092 KB |
Output is correct |
11 |
Correct |
14 ms |
11220 KB |
Output is correct |
12 |
Correct |
11 ms |
10964 KB |
Output is correct |
13 |
Correct |
16 ms |
13524 KB |
Output is correct |
14 |
Correct |
18 ms |
14312 KB |
Output is correct |
15 |
Correct |
11 ms |
10068 KB |
Output is correct |
16 |
Correct |
17 ms |
14164 KB |
Output is correct |
17 |
Correct |
7 ms |
8532 KB |
Output is correct |
18 |
Correct |
10 ms |
9812 KB |
Output is correct |
19 |
Correct |
4 ms |
6228 KB |
Output is correct |
20 |
Correct |
5 ms |
6308 KB |
Output is correct |
21 |
Runtime error |
551 ms |
524288 KB |
Execution killed with signal 9 |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
7636 KB |
Output is correct |
2 |
Correct |
9 ms |
9172 KB |
Output is correct |
3 |
Correct |
11 ms |
9652 KB |
Output is correct |
4 |
Correct |
14 ms |
12596 KB |
Output is correct |
5 |
Correct |
4 ms |
6100 KB |
Output is correct |
6 |
Correct |
4 ms |
6096 KB |
Output is correct |
7 |
Correct |
12 ms |
10892 KB |
Output is correct |
8 |
Correct |
11 ms |
10708 KB |
Output is correct |
9 |
Correct |
11 ms |
10708 KB |
Output is correct |
10 |
Correct |
12 ms |
11092 KB |
Output is correct |
11 |
Correct |
14 ms |
11220 KB |
Output is correct |
12 |
Correct |
11 ms |
10964 KB |
Output is correct |
13 |
Correct |
16 ms |
13524 KB |
Output is correct |
14 |
Correct |
18 ms |
14312 KB |
Output is correct |
15 |
Correct |
11 ms |
10068 KB |
Output is correct |
16 |
Correct |
17 ms |
14164 KB |
Output is correct |
17 |
Correct |
7 ms |
8532 KB |
Output is correct |
18 |
Correct |
10 ms |
9812 KB |
Output is correct |
19 |
Correct |
4 ms |
6228 KB |
Output is correct |
20 |
Correct |
5 ms |
6308 KB |
Output is correct |
21 |
Runtime error |
551 ms |
524288 KB |
Execution killed with signal 9 |
22 |
Halted |
0 ms |
0 KB |
- |