Submission #1006965

#TimeUsernameProblemLanguageResultExecution timeMemory
1006965UnforgettableplFood Court (JOI21_foodcourt)C++17
7 / 100
12 ms14172 KiB
#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)

foodcourt.cpp: In function 'int32_t main()':
foodcourt.cpp:38:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::deque<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |             for(int i=0;i<queues[a].size();i++){
      |                         ~^~~~~~~~~~~~~~~~~
#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...