제출 #421905

#제출 시각아이디문제언어결과실행 시간메모리
421905lyc푸드 코트 (JOI21_foodcourt)C++14
2 / 100
1098 ms1208 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, 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'; } } }

컴파일 시 표준 에러 (stderr) 메시지

foodcourt.cpp: In function 'int main()':
foodcourt.cpp:39:39: warning: narrowing conversion of '(B - 1)' from 'long long int' to 'int' [-Wnarrowing]
   39 |             stuff.push_back({ A,A,-1,B-1 });
      |                                      ~^~
#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...