답안 #18489

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
18489 2016-02-06T07:06:51 Z eaststar 올림픽 피자 (tutorial5) C++14
100 / 100
103 ms 101096 KB
#include "pizza.h"
void Init(){}
int cnt[8],q[1<<8][100010],s[1<<8],e[1<<8],st,m;
void Order(int n, int *a){
    int i,t=0;
    for(i=0;i<n;++i)t+=(1<<a[i]);
    if((st&t)!=t)q[t][e[t]++]=m++;
    else{
        Bake(m++);
        for(i=0;i<n;++i){
            --cnt[a[i]];
            if(!cnt[a[i]])st-=(1<<a[i]);
        }
    }
}
void Delivery(int x){
    int i,k,l=1e6;
    ++cnt[x];
    if(cnt[x]<2){
        st+=(1<<x);
        for(i=1;i<(1<<8);++i)if(i&(1<<x)){
            if((st&i)!=i)continue;
            if(s[i]<e[i]&&l>q[i][s[i]])k=i,l=q[i][s[i]];
        }
        if(l<1e6){
            for(i=0;i<8;++i)if(k&(1<<i)){
                --cnt[i];
                if(!cnt[i])st-=(1<<i);
            }
            Bake(q[k][s[k]++]);
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 101096 KB Output is correct
2 Correct 0 ms 101096 KB Output is correct
3 Correct 0 ms 101096 KB Output is correct
4 Correct 0 ms 101096 KB Output is correct
5 Correct 0 ms 101096 KB Output is correct
6 Correct 0 ms 101096 KB Output is correct
7 Correct 0 ms 101096 KB Output is correct
8 Correct 0 ms 101096 KB Output is correct
9 Correct 0 ms 101096 KB Output is correct
10 Correct 0 ms 101096 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 101096 KB Output is correct
2 Correct 3 ms 101096 KB Output is correct
3 Correct 3 ms 101096 KB Output is correct
4 Correct 3 ms 101096 KB Output is correct
5 Correct 0 ms 101096 KB Output is correct
6 Correct 3 ms 101096 KB Output is correct
7 Correct 9 ms 101096 KB Output is correct
8 Correct 0 ms 101096 KB Output is correct
9 Correct 0 ms 101096 KB Output is correct
10 Correct 3 ms 101096 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 101096 KB Output is correct
2 Correct 45 ms 101096 KB Output is correct
3 Correct 31 ms 101096 KB Output is correct
4 Correct 49 ms 101096 KB Output is correct
5 Correct 25 ms 101096 KB Output is correct
6 Correct 44 ms 101096 KB Output is correct
7 Correct 26 ms 101096 KB Output is correct
8 Correct 44 ms 101096 KB Output is correct
9 Correct 34 ms 101096 KB Output is correct
10 Correct 34 ms 101096 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 98 ms 101096 KB Output is correct
2 Correct 98 ms 101096 KB Output is correct
3 Correct 102 ms 101096 KB Output is correct
4 Correct 94 ms 101096 KB Output is correct
5 Correct 94 ms 101096 KB Output is correct
6 Correct 86 ms 101096 KB Output is correct
7 Correct 93 ms 101096 KB Output is correct
8 Correct 99 ms 101096 KB Output is correct
9 Correct 103 ms 101096 KB Output is correct
10 Correct 93 ms 101096 KB Output is correct