Submission #1329622

#TimeUsernameProblemLanguageResultExecution timeMemory
1329622mhn_neekFood Court (JOI21_foodcourt)C++20
2 / 100
1096 ms589824 KiB
//In the name of God
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef long double ld;
typedef pair<lli,lli> pii;
typedef pair<pii,pii> piiii;
typedef vector<lli> ve;
typedef vector<pii> vp;
const lli N=3e5+100;
const lli mod=1e9+7;//998244353;//1e9+9
const lli INF=1e18;
lli power(lli x,lli y){lli res = 1;x = x % mod;while(y>0){if( y & 1 ){res = (res * x) % mod;}y = y >> 1;x = (x * x)%mod;}return res;}
lli modinv(lli x){return power(x,mod-2);}
lli divide(lli x,lli y){return ((x%mod) * modinv(y))%mod;}
#define all(v) v.begin(),v.end()
#define MIN(v) *min_element(all(v))
#define MAX(v) *max_element(all(v))
#define migmig ios_base::sync_with_stdio(false),cout.tie(0), cin.tie(0);
#define read freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define minheap priority_queue<pair<lli,pii>, std::vector<pair<lli,pii>>, std::greater<pair<lli,pii>>>
#define set_preci(x) cout << fixed << setprecision(x);
#define debug(x) cerr << (#x) << " " << (x) << endl
#define MP make_pair
#define PB push_back
#define fi first
#define se second
#define SUM(v) accumulate(v.begin(),v.end(), 0LL)
#define FOR(x,n) for(lli x = 0; x < n; x++)
#define FORS(x,n) for(lli x = 1; x <= n; x++)
#define TEST int TQPWIEJR; cin>>TQPWIEJR;while(TQPWIEJR--)
#define BN(l,a) while(l){a.PB(l%2);l/=2;}
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define sep " "
#define SZ(X) (lli)X.size()
lli tmp;
int main(){
    migmig;
    lli n,m,q;
    cin>>n>>m>>q;
    vector<deque<int>> sp(n+1);
    for(lli i=0;i<q;i++){
        int t;
        cin>>t;
        if(t==1){
            lli L,R,C,K;
            cin>>L>>R>>C>>K;
            for(lli s=L;s<=R;s++){
                for(lli k=0;k<K;k++){
                    sp[s].push_back((int)C);
                }
            }
        } else if(t==2){
            lli L,R,K;
            cin>>L>>R>>K;
            for(lli s=L;s<=R;s++){
                for(lli k=0;k<K && !sp[s].empty();k++){
                    sp[s].pop_front();
                }
            }
        } else if(t==3){
            lli A,B;
            cin>>A>>B;
            if(B <= (lli)sp[A].size()){
                cout << sp[A][(size_t)(B-1)] << endl;
            } else {
                cout << 0 << endl;
            }
        }
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...