# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1006965 | Unforgettablepl | Food Court (JOI21_foodcourt) | C++17 | 12 ms | 14172 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define int long long
deque <pair<int,int>> queues[2001];
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n,m,q;
cin >> n >> m >> q;
for(int i=1;i<=q;i++){
int type;cin>>type;
if(type==1){
int l,r,c,k;cin>>l>>r>>c>>k;
for(int x=l;x<=r;x++)queues[x].emplace_back(k,c);
} else if(type==2){
int l,r,k;cin>>l>>r>>k;
for(int x=l;x<=r;x++){
int tar = k;
while(tar and !queues[x].empty()){
if(queues[x].front().first<=tar){
tar-=queues[x].front().first;
queues[x].pop_front();
} else {
queues[x].front().first-=tar;
tar = 0;
}
}
}
} else {
int a,b;cin>>a>>b;
int curr = 0;
for(int i=0;i<queues[a].size();i++){
curr+=queues[a][i].first;
if(curr>=b){cout<<queues[a][i].second<<'\n';break;}
}
if(curr<b)cout<<"0\n";
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |