제출 #421908

#제출 시각아이디문제언어결과실행 시간메모리
421908lycFood Court (JOI21_foodcourt)C++14
7 / 100
1078 ms1340 KiB
#include <bits/stdc++.h> using namespace std; #define TRACE(x) cerr << #x << " :: " << x << endl #define _ << " " << #define SZ(x) ((int)(x).size()) #define ALL(x) (x).begin(),(x).end() #define FOR(i,a,b) for(int i=(a);i<=(b);++i) #define RFOR(i,a,b) for(int i=(a);i>=(b);--i) typedef long long ll; const int mxN = 250005; const int mxM = 250005; const int mxQ = 250005; int N, M, Q; int group[mxM]; struct Data { int L, R, C; ll K; }; vector<Data> stuff; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> N >> M >> Q; FOR(i,1,Q){ int T, L, R, C, K, A; long long B; cin >> T; if (T == 1) { cin >> L >> R >> C >> K; stuff.push_back({L,R,C,K}); } else if (T == 2) { cin >> L >> R >> K; stuff.push_back({L,R,-1,K}); } else { cin >> A >> B; stuff.push_back({ A,A,-1,B-1 }); queue<pair<int,ll>> q; for (auto& x : stuff) if (x.L <= A && A <= x.R) { if (x.C == -1) { ll del = x.K; while (!q.empty() && del) { auto& u = q.front(); if (u.second <= del) { del -= u.second; q.pop(); } else { u.second -= del; del = 0; } } } else { q.push(make_pair(x.C,x.K)); } } stuff.pop_back(); if (q.empty()) cout << 0 << '\n'; else cout << q.front().first << '\n'; } } }
#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...