#include "bits/stdc++.h"
using namespace std;
// #define ORD_SET
// #define ROPE
#ifdef ORD_SET
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#endif
#ifdef ROPE
#include <ext/rope>
using namespace __gnu_cxx;
#endif
#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 ll = long long;//a
using ld = long double;
#define pb push_back
#define ff first
#define ss second
#define sz(x) (ll)(x).size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
// #define ll int
void freopen(string s) { freopen((s + ".in").c_str(), "r", stdin); freopen((s + ".out").c_str(), "w", stdout); }
void NotInteractive() { ios_base::sync_with_stdio(false); cin.tie(NULL); }
void pre(ll a) { cout<<fixed<<setprecision(a); }
ll bit(ll x) { return __builtin_popcountll(x); }
ll binpow(ll x, ll y, ll z) { ll pow = 1; while(y) { if(y&1) pow *= x, pow %= z; x *= x, x %= z; y >>= 1; } return pow; }
template<typename T> T gcd(T a, T b) { if(b==0) return a; return gcd(b, a%b); }
template<typename T> T lcm(T a, T b) { return a/gcd(a, b)*b; }
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
struct sn { ll l, r, x; }; // a.swap(b)
ll B = 316;
const ll mod = (ll)1e9+7;
const ll inf = (ll)1e18+7;
const ll MX = LLONG_MAX;
const ll MN = LLONG_MIN;
const ld P = acos(-1.0);
const ll N = (ll)3e5+5;
vector<ll> v[N];
void kigash() {
ll n, m, q;
cin>>n>>m>>q;
while(q--) {
ll t, l, r, c, k;
cin>>t;
if(t==1) {
cin>>l>>r>>c>>k;
for(ll i=l; i<=r; i++) {
for(ll j=1; j<=k; j++) v[i].pb(c);
}
}
else if(t==2) {
cin>>l>>r>>k;
for(ll i=l; i<=r; i++) {
if(sz(v[i])<=k) v[i].clear();
else {
vector<ll> tmp;
for(ll j=k; j<sz(v[i]); j++) tmp.pb(v[i][j]);
v[i] = tmp;
}
}
}
else {
cin>>c>>k;
// cout<<sz(v[c])<<" ";
if(sz(v[c])>=k) cout<<v[c][k-1]<<"\n";
else cout<<"0\n";
}
}
return;
}
signed main(/**/) {
// freopen("");
NotInteractive();
// precalc();
ll tt = 1;
// cin>>tt;
for(ll i=1; i<=tt; i++) kigash();
exit(0);
}
Compilation message
foodcourt.cpp:18: warning: ignoring '#pragma comment ' [-Wunknown-pragmas]
18 | #pragma comment(linker, "/stack:200000000")
|
foodcourt.cpp: In function 'void freopen(std::string)':
foodcourt.cpp:31:33: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
31 | void freopen(string s) { freopen((s + ".in").c_str(), "r", stdin); freopen((s + ".out").c_str(), "w", stdout); }
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foodcourt.cpp:31:75: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
31 | void freopen(string s) { freopen((s + ".in").c_str(), "r", stdin); freopen((s + ".out").c_str(), "w", stdout); }
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
36 ms |
7608 KB |
Output is correct |
2 |
Correct |
85 ms |
7964 KB |
Output is correct |
3 |
Correct |
113 ms |
13060 KB |
Output is correct |
4 |
Correct |
237 ms |
15028 KB |
Output is correct |
5 |
Correct |
4 ms |
7380 KB |
Output is correct |
6 |
Correct |
4 ms |
7452 KB |
Output is correct |
7 |
Correct |
622 ms |
16540 KB |
Output is correct |
8 |
Correct |
462 ms |
13660 KB |
Output is correct |
9 |
Correct |
140 ms |
8060 KB |
Output is correct |
10 |
Correct |
402 ms |
13500 KB |
Output is correct |
11 |
Correct |
285 ms |
10828 KB |
Output is correct |
12 |
Correct |
137 ms |
8044 KB |
Output is correct |
13 |
Correct |
220 ms |
7848 KB |
Output is correct |
14 |
Correct |
222 ms |
9424 KB |
Output is correct |
15 |
Correct |
287 ms |
9384 KB |
Output is correct |
16 |
Correct |
201 ms |
8348 KB |
Output is correct |
17 |
Correct |
47 ms |
7560 KB |
Output is correct |
18 |
Correct |
84 ms |
7824 KB |
Output is correct |
19 |
Correct |
6 ms |
7380 KB |
Output is correct |
20 |
Correct |
5 ms |
7380 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
36 ms |
7608 KB |
Output is correct |
2 |
Correct |
85 ms |
7964 KB |
Output is correct |
3 |
Correct |
113 ms |
13060 KB |
Output is correct |
4 |
Correct |
237 ms |
15028 KB |
Output is correct |
5 |
Correct |
4 ms |
7380 KB |
Output is correct |
6 |
Correct |
4 ms |
7452 KB |
Output is correct |
7 |
Correct |
622 ms |
16540 KB |
Output is correct |
8 |
Correct |
462 ms |
13660 KB |
Output is correct |
9 |
Correct |
140 ms |
8060 KB |
Output is correct |
10 |
Correct |
402 ms |
13500 KB |
Output is correct |
11 |
Correct |
285 ms |
10828 KB |
Output is correct |
12 |
Correct |
137 ms |
8044 KB |
Output is correct |
13 |
Correct |
220 ms |
7848 KB |
Output is correct |
14 |
Correct |
222 ms |
9424 KB |
Output is correct |
15 |
Correct |
287 ms |
9384 KB |
Output is correct |
16 |
Correct |
201 ms |
8348 KB |
Output is correct |
17 |
Correct |
47 ms |
7560 KB |
Output is correct |
18 |
Correct |
84 ms |
7824 KB |
Output is correct |
19 |
Correct |
6 ms |
7380 KB |
Output is correct |
20 |
Correct |
5 ms |
7380 KB |
Output is correct |
21 |
Runtime error |
421 ms |
524288 KB |
Execution killed with signal 9 |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
773 ms |
9280 KB |
Output is correct |
2 |
Correct |
509 ms |
10000 KB |
Output is correct |
3 |
Correct |
685 ms |
10020 KB |
Output is correct |
4 |
Correct |
690 ms |
10076 KB |
Output is correct |
5 |
Correct |
523 ms |
10220 KB |
Output is correct |
6 |
Correct |
572 ms |
10072 KB |
Output is correct |
7 |
Correct |
17 ms |
7996 KB |
Output is correct |
8 |
Correct |
19 ms |
7992 KB |
Output is correct |
9 |
Execution timed out |
1095 ms |
9904 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
411 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
36 ms |
7608 KB |
Output is correct |
2 |
Correct |
85 ms |
7964 KB |
Output is correct |
3 |
Correct |
113 ms |
13060 KB |
Output is correct |
4 |
Correct |
237 ms |
15028 KB |
Output is correct |
5 |
Correct |
4 ms |
7380 KB |
Output is correct |
6 |
Correct |
4 ms |
7452 KB |
Output is correct |
7 |
Correct |
622 ms |
16540 KB |
Output is correct |
8 |
Correct |
462 ms |
13660 KB |
Output is correct |
9 |
Correct |
140 ms |
8060 KB |
Output is correct |
10 |
Correct |
402 ms |
13500 KB |
Output is correct |
11 |
Correct |
285 ms |
10828 KB |
Output is correct |
12 |
Correct |
137 ms |
8044 KB |
Output is correct |
13 |
Correct |
220 ms |
7848 KB |
Output is correct |
14 |
Correct |
222 ms |
9424 KB |
Output is correct |
15 |
Correct |
287 ms |
9384 KB |
Output is correct |
16 |
Correct |
201 ms |
8348 KB |
Output is correct |
17 |
Correct |
47 ms |
7560 KB |
Output is correct |
18 |
Correct |
84 ms |
7824 KB |
Output is correct |
19 |
Correct |
6 ms |
7380 KB |
Output is correct |
20 |
Correct |
5 ms |
7380 KB |
Output is correct |
21 |
Correct |
773 ms |
9280 KB |
Output is correct |
22 |
Correct |
509 ms |
10000 KB |
Output is correct |
23 |
Correct |
685 ms |
10020 KB |
Output is correct |
24 |
Correct |
690 ms |
10076 KB |
Output is correct |
25 |
Correct |
523 ms |
10220 KB |
Output is correct |
26 |
Correct |
572 ms |
10072 KB |
Output is correct |
27 |
Correct |
17 ms |
7996 KB |
Output is correct |
28 |
Correct |
19 ms |
7992 KB |
Output is correct |
29 |
Execution timed out |
1095 ms |
9904 KB |
Time limit exceeded |
30 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
420 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
36 ms |
7608 KB |
Output is correct |
2 |
Correct |
85 ms |
7964 KB |
Output is correct |
3 |
Correct |
113 ms |
13060 KB |
Output is correct |
4 |
Correct |
237 ms |
15028 KB |
Output is correct |
5 |
Correct |
4 ms |
7380 KB |
Output is correct |
6 |
Correct |
4 ms |
7452 KB |
Output is correct |
7 |
Correct |
622 ms |
16540 KB |
Output is correct |
8 |
Correct |
462 ms |
13660 KB |
Output is correct |
9 |
Correct |
140 ms |
8060 KB |
Output is correct |
10 |
Correct |
402 ms |
13500 KB |
Output is correct |
11 |
Correct |
285 ms |
10828 KB |
Output is correct |
12 |
Correct |
137 ms |
8044 KB |
Output is correct |
13 |
Correct |
220 ms |
7848 KB |
Output is correct |
14 |
Correct |
222 ms |
9424 KB |
Output is correct |
15 |
Correct |
287 ms |
9384 KB |
Output is correct |
16 |
Correct |
201 ms |
8348 KB |
Output is correct |
17 |
Correct |
47 ms |
7560 KB |
Output is correct |
18 |
Correct |
84 ms |
7824 KB |
Output is correct |
19 |
Correct |
6 ms |
7380 KB |
Output is correct |
20 |
Correct |
5 ms |
7380 KB |
Output is correct |
21 |
Runtime error |
421 ms |
524288 KB |
Execution killed with signal 9 |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
36 ms |
7608 KB |
Output is correct |
2 |
Correct |
85 ms |
7964 KB |
Output is correct |
3 |
Correct |
113 ms |
13060 KB |
Output is correct |
4 |
Correct |
237 ms |
15028 KB |
Output is correct |
5 |
Correct |
4 ms |
7380 KB |
Output is correct |
6 |
Correct |
4 ms |
7452 KB |
Output is correct |
7 |
Correct |
622 ms |
16540 KB |
Output is correct |
8 |
Correct |
462 ms |
13660 KB |
Output is correct |
9 |
Correct |
140 ms |
8060 KB |
Output is correct |
10 |
Correct |
402 ms |
13500 KB |
Output is correct |
11 |
Correct |
285 ms |
10828 KB |
Output is correct |
12 |
Correct |
137 ms |
8044 KB |
Output is correct |
13 |
Correct |
220 ms |
7848 KB |
Output is correct |
14 |
Correct |
222 ms |
9424 KB |
Output is correct |
15 |
Correct |
287 ms |
9384 KB |
Output is correct |
16 |
Correct |
201 ms |
8348 KB |
Output is correct |
17 |
Correct |
47 ms |
7560 KB |
Output is correct |
18 |
Correct |
84 ms |
7824 KB |
Output is correct |
19 |
Correct |
6 ms |
7380 KB |
Output is correct |
20 |
Correct |
5 ms |
7380 KB |
Output is correct |
21 |
Runtime error |
421 ms |
524288 KB |
Execution killed with signal 9 |
22 |
Halted |
0 ms |
0 KB |
- |