#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
using namespace std;
#define int long long
#define ll long long
#define vi vector<long long>
#define pb push_back
#define sz(s) (int)s.size()
#define all(v) v.begin(), v.end()
#define show(a) cerr << #a <<" -> "<< a <<"\n"
#define pp pair<int,int>
#define FF first
#define SS second
#define endl "\n"
#define ld long double
const int N = 1e6 + 2, N3 = 1e3 + 6, inf = 1e9 + 7, LOG = 20;
map<char, int> md{{'N', 0}, {'E', 1}, {'S', 2}, {'W', 3}};
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
string stepDir = "RDLU";
int n, m, q, cnt[65001];
vi v[65001];
main () {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
// freopen(".in", "r", stdin);
// freopen(".out", "w", stdout);
cin >> n >> m >> q;
for (int i = 1; i <= q; i++) {
int t;
cin >> t;
if (t == 1) {
int l, r, c, k;
cin >> l >> r >> c >> k;
for (int j = l; j <= r; j++) {
for (int f = 1; f <= k; f++) {
v[j].pb(c);
}
}
}
else if (t == 2) {
int l, r, k;
cin >> l >> r >> k;
vi a;
for (int j = l; j <= r; j++) {
cnt[j] += k;
cnt[j] = min(cnt[j], sz(v[j]));
}
}
else {
int a, b;
cin >> a >> b;
if (b + cnt[a] > sz(v[a])) {
cout << "0\n";
}
else cout << v[a][b - 1 + cnt[a]] << "\n";
}
}
return 0;
}
Compilation message
foodcourt.cpp:3: warning: ignoring '#pragma comment ' [-Wunknown-pragmas]
3 | #pragma comment(linker, "/stack:200000000")
|
foodcourt.cpp:31:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
31 | main () {
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4820 KB |
Output is correct |
2 |
Correct |
8 ms |
7632 KB |
Output is correct |
3 |
Correct |
8 ms |
8532 KB |
Output is correct |
4 |
Correct |
16 ms |
14668 KB |
Output is correct |
5 |
Correct |
1 ms |
1876 KB |
Output is correct |
6 |
Correct |
1 ms |
1876 KB |
Output is correct |
7 |
Correct |
14 ms |
11064 KB |
Output is correct |
8 |
Correct |
12 ms |
10708 KB |
Output is correct |
9 |
Correct |
16 ms |
10852 KB |
Output is correct |
10 |
Correct |
12 ms |
11348 KB |
Output is correct |
11 |
Correct |
14 ms |
11844 KB |
Output is correct |
12 |
Correct |
14 ms |
11140 KB |
Output is correct |
13 |
Correct |
17 ms |
16468 KB |
Output is correct |
14 |
Correct |
22 ms |
17884 KB |
Output is correct |
15 |
Correct |
12 ms |
9632 KB |
Output is correct |
16 |
Correct |
21 ms |
17840 KB |
Output is correct |
17 |
Correct |
7 ms |
6392 KB |
Output is correct |
18 |
Correct |
9 ms |
8788 KB |
Output is correct |
19 |
Correct |
2 ms |
2004 KB |
Output is correct |
20 |
Correct |
2 ms |
2004 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4820 KB |
Output is correct |
2 |
Correct |
8 ms |
7632 KB |
Output is correct |
3 |
Correct |
8 ms |
8532 KB |
Output is correct |
4 |
Correct |
16 ms |
14668 KB |
Output is correct |
5 |
Correct |
1 ms |
1876 KB |
Output is correct |
6 |
Correct |
1 ms |
1876 KB |
Output is correct |
7 |
Correct |
14 ms |
11064 KB |
Output is correct |
8 |
Correct |
12 ms |
10708 KB |
Output is correct |
9 |
Correct |
16 ms |
10852 KB |
Output is correct |
10 |
Correct |
12 ms |
11348 KB |
Output is correct |
11 |
Correct |
14 ms |
11844 KB |
Output is correct |
12 |
Correct |
14 ms |
11140 KB |
Output is correct |
13 |
Correct |
17 ms |
16468 KB |
Output is correct |
14 |
Correct |
22 ms |
17884 KB |
Output is correct |
15 |
Correct |
12 ms |
9632 KB |
Output is correct |
16 |
Correct |
21 ms |
17840 KB |
Output is correct |
17 |
Correct |
7 ms |
6392 KB |
Output is correct |
18 |
Correct |
9 ms |
8788 KB |
Output is correct |
19 |
Correct |
2 ms |
2004 KB |
Output is correct |
20 |
Correct |
2 ms |
2004 KB |
Output is correct |
21 |
Runtime error |
414 ms |
524288 KB |
Execution killed with signal 9 |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
616 ms |
4548 KB |
Output is correct |
2 |
Correct |
449 ms |
5416 KB |
Output is correct |
3 |
Correct |
560 ms |
6032 KB |
Output is correct |
4 |
Correct |
602 ms |
5992 KB |
Output is correct |
5 |
Correct |
453 ms |
7512 KB |
Output is correct |
6 |
Correct |
445 ms |
7428 KB |
Output is correct |
7 |
Correct |
20 ms |
2292 KB |
Output is correct |
8 |
Correct |
16 ms |
2364 KB |
Output is correct |
9 |
Correct |
932 ms |
4968 KB |
Output is correct |
10 |
Correct |
921 ms |
4936 KB |
Output is correct |
11 |
Correct |
955 ms |
4876 KB |
Output is correct |
12 |
Correct |
927 ms |
4948 KB |
Output is correct |
13 |
Correct |
193 ms |
6312 KB |
Output is correct |
14 |
Correct |
263 ms |
7216 KB |
Output is correct |
15 |
Correct |
54 ms |
8284 KB |
Output is correct |
16 |
Correct |
66 ms |
8660 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
3528 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4820 KB |
Output is correct |
2 |
Correct |
8 ms |
7632 KB |
Output is correct |
3 |
Correct |
8 ms |
8532 KB |
Output is correct |
4 |
Correct |
16 ms |
14668 KB |
Output is correct |
5 |
Correct |
1 ms |
1876 KB |
Output is correct |
6 |
Correct |
1 ms |
1876 KB |
Output is correct |
7 |
Correct |
14 ms |
11064 KB |
Output is correct |
8 |
Correct |
12 ms |
10708 KB |
Output is correct |
9 |
Correct |
16 ms |
10852 KB |
Output is correct |
10 |
Correct |
12 ms |
11348 KB |
Output is correct |
11 |
Correct |
14 ms |
11844 KB |
Output is correct |
12 |
Correct |
14 ms |
11140 KB |
Output is correct |
13 |
Correct |
17 ms |
16468 KB |
Output is correct |
14 |
Correct |
22 ms |
17884 KB |
Output is correct |
15 |
Correct |
12 ms |
9632 KB |
Output is correct |
16 |
Correct |
21 ms |
17840 KB |
Output is correct |
17 |
Correct |
7 ms |
6392 KB |
Output is correct |
18 |
Correct |
9 ms |
8788 KB |
Output is correct |
19 |
Correct |
2 ms |
2004 KB |
Output is correct |
20 |
Correct |
2 ms |
2004 KB |
Output is correct |
21 |
Correct |
616 ms |
4548 KB |
Output is correct |
22 |
Correct |
449 ms |
5416 KB |
Output is correct |
23 |
Correct |
560 ms |
6032 KB |
Output is correct |
24 |
Correct |
602 ms |
5992 KB |
Output is correct |
25 |
Correct |
453 ms |
7512 KB |
Output is correct |
26 |
Correct |
445 ms |
7428 KB |
Output is correct |
27 |
Correct |
20 ms |
2292 KB |
Output is correct |
28 |
Correct |
16 ms |
2364 KB |
Output is correct |
29 |
Correct |
932 ms |
4968 KB |
Output is correct |
30 |
Correct |
921 ms |
4936 KB |
Output is correct |
31 |
Correct |
955 ms |
4876 KB |
Output is correct |
32 |
Correct |
927 ms |
4948 KB |
Output is correct |
33 |
Correct |
193 ms |
6312 KB |
Output is correct |
34 |
Correct |
263 ms |
7216 KB |
Output is correct |
35 |
Correct |
54 ms |
8284 KB |
Output is correct |
36 |
Correct |
66 ms |
8660 KB |
Output is correct |
37 |
Runtime error |
832 ms |
524288 KB |
Execution killed with signal 9 |
38 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
390 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4820 KB |
Output is correct |
2 |
Correct |
8 ms |
7632 KB |
Output is correct |
3 |
Correct |
8 ms |
8532 KB |
Output is correct |
4 |
Correct |
16 ms |
14668 KB |
Output is correct |
5 |
Correct |
1 ms |
1876 KB |
Output is correct |
6 |
Correct |
1 ms |
1876 KB |
Output is correct |
7 |
Correct |
14 ms |
11064 KB |
Output is correct |
8 |
Correct |
12 ms |
10708 KB |
Output is correct |
9 |
Correct |
16 ms |
10852 KB |
Output is correct |
10 |
Correct |
12 ms |
11348 KB |
Output is correct |
11 |
Correct |
14 ms |
11844 KB |
Output is correct |
12 |
Correct |
14 ms |
11140 KB |
Output is correct |
13 |
Correct |
17 ms |
16468 KB |
Output is correct |
14 |
Correct |
22 ms |
17884 KB |
Output is correct |
15 |
Correct |
12 ms |
9632 KB |
Output is correct |
16 |
Correct |
21 ms |
17840 KB |
Output is correct |
17 |
Correct |
7 ms |
6392 KB |
Output is correct |
18 |
Correct |
9 ms |
8788 KB |
Output is correct |
19 |
Correct |
2 ms |
2004 KB |
Output is correct |
20 |
Correct |
2 ms |
2004 KB |
Output is correct |
21 |
Runtime error |
414 ms |
524288 KB |
Execution killed with signal 9 |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4820 KB |
Output is correct |
2 |
Correct |
8 ms |
7632 KB |
Output is correct |
3 |
Correct |
8 ms |
8532 KB |
Output is correct |
4 |
Correct |
16 ms |
14668 KB |
Output is correct |
5 |
Correct |
1 ms |
1876 KB |
Output is correct |
6 |
Correct |
1 ms |
1876 KB |
Output is correct |
7 |
Correct |
14 ms |
11064 KB |
Output is correct |
8 |
Correct |
12 ms |
10708 KB |
Output is correct |
9 |
Correct |
16 ms |
10852 KB |
Output is correct |
10 |
Correct |
12 ms |
11348 KB |
Output is correct |
11 |
Correct |
14 ms |
11844 KB |
Output is correct |
12 |
Correct |
14 ms |
11140 KB |
Output is correct |
13 |
Correct |
17 ms |
16468 KB |
Output is correct |
14 |
Correct |
22 ms |
17884 KB |
Output is correct |
15 |
Correct |
12 ms |
9632 KB |
Output is correct |
16 |
Correct |
21 ms |
17840 KB |
Output is correct |
17 |
Correct |
7 ms |
6392 KB |
Output is correct |
18 |
Correct |
9 ms |
8788 KB |
Output is correct |
19 |
Correct |
2 ms |
2004 KB |
Output is correct |
20 |
Correct |
2 ms |
2004 KB |
Output is correct |
21 |
Runtime error |
414 ms |
524288 KB |
Execution killed with signal 9 |
22 |
Halted |
0 ms |
0 KB |
- |