# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
23370 | TAMREF | 올림픽 피자 (tutorial5) | C++11 | 0 ms | 2176 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>
#include "pizza.h"
using namespace std;
typedef pair<int,int> pii;
int order_num;
queue<int> ord[256];
int ing[256];
vector<pii> C;
void Init() {
order_num = 0;
C.clear();
for(int i=0;i<256;i++) while(!ord[i].empty()) ord[i].pop();
}
void call_baker(int b){
for(int i=0;i<256;i++) if(b&i) --ing[i];
Bake(order_num);
}
void Order(int N, int *A) {
int b=0;
for(int i=0;i<N;i++) b|=1<<A[i];
if(ing[b]) call_baker(b);
else ord[b].push(order_num++);
}
void Delivery(int I) {
C.clear();
for(int i=0;i<256;i++){
if(i&(1<<I) && ord[i].size()) C.push_back(make_pair(ord[i].front(),i));
}
sort(C.begin(),C.end());
if(C[0].first==INT_MAX) for(auto u : C) ++ing[u.second];
else{
call_baker(C[0].first);
ord[C[0].second].pop();
}
}
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... |