답안 #18487

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
18487 2016-02-06T06:59:53 Z eaststar 올림픽 피자 (tutorial5) C++14
100 / 100
110 ms 101096 KB
#include "pizza.h"
void Init(){}
int cnt[8],q[1<<8][100010],s[1<<8],e[1<<8],m;
void Order(int n, int *a){
    int i,t=0;
    for(i=0;i<n;++i)if(!cnt[a[i]])break;
    if(i<n){
        for(i=0;i<n;++i)t+=(1<<a[i]);
        q[t][e[t]++]=m++;
    }
    else{
        Bake(m++);
        for(i=0;i<n;++i)--cnt[a[i]];
    }
}
void Delivery(int x){
    int i,j,k,l=1e6;
    ++cnt[x];
    if(cnt[x]<2){
        for(i=1;i<(1<<8);++i)if(i&(1<<x)){
            for(j=0;j<8;++j)if(i&(1<<j)&&!cnt[j])break;
            if(j>7&&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];
            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 4 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 8 ms 101096 KB Output is correct
2 Correct 5 ms 101096 KB Output is correct
3 Correct 4 ms 101096 KB Output is correct
4 Correct 8 ms 101096 KB Output is correct
5 Correct 7 ms 101096 KB Output is correct
6 Correct 3 ms 101096 KB Output is correct
7 Correct 3 ms 101096 KB Output is correct
8 Correct 3 ms 101096 KB Output is correct
9 Correct 0 ms 101096 KB Output is correct
10 Correct 6 ms 101096 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 101096 KB Output is correct
2 Correct 23 ms 101096 KB Output is correct
3 Correct 29 ms 101096 KB Output is correct
4 Correct 48 ms 101096 KB Output is correct
5 Correct 43 ms 101096 KB Output is correct
6 Correct 51 ms 101096 KB Output is correct
7 Correct 47 ms 101096 KB Output is correct
8 Correct 37 ms 101096 KB Output is correct
9 Correct 46 ms 101096 KB Output is correct
10 Correct 34 ms 101096 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 110 ms 101096 KB Output is correct
2 Correct 101 ms 101096 KB Output is correct
3 Correct 104 ms 101096 KB Output is correct
4 Correct 105 ms 101096 KB Output is correct
5 Correct 107 ms 101096 KB Output is correct
6 Correct 106 ms 101096 KB Output is correct
7 Correct 109 ms 101096 KB Output is correct
8 Correct 107 ms 101096 KB Output is correct
9 Correct 103 ms 101096 KB Output is correct
10 Correct 99 ms 101096 KB Output is correct