답안 #23370

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
23370 2017-05-07T07:19:43 Z TAMREF 올림픽 피자 (tutorial5) C++11
0 / 100
0 ms 2176 KB
#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

grader.cpp: In function 'int main(int, char**)':
grader.cpp:65:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 2176 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 2176 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 2176 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 2176 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -