Submission #581

#TimeUsernameProblemLanguageResultExecution timeMemory
581gs13068올림픽 피자 (tutorial5)C++98
0 / 100
0 ms100916 KiB
#include"pizza.h" void Init(){} int v[256][100000]; int f[256],b[256]; int ordern; int jaeryo[8]; int can; void Order(int n,int *a) { bool flag; int i,j=0,min; for(i=0;i<n;i++)j=j|(1<<a[i]); v[j][b[j]++]=ordern++; do { min=-1; flag=false; for(i=0;i<256;i++) { if(i&can!=i)continue; flag=true; if(f[i]<b[i]&&(v[i][f[i]]<v[min][f[min]]||min==-1)) min=i; } if(flag) { Bake(v[min][f[min]]); f[min]++; for(i=0;i<8;i++) { if(min&(1<<i)) { jaeryo[i]--; if(jaeryo[i]==0) can^=1<<i; } } } }while(flag); } void Delivery(int x) { int i,min; bool flag; if(jaeryo[x]==0)can|=1<<x; jaeryo[x]++; do { min=-1; flag=false; for(i=0;i<256;i++) { if(i&can!=i)continue; flag=true; if(f[i]<b[i]&&(v[i][f[i]]<v[min][f[min]]||min==-1)) min=i; } if(flag) { Bake(v[min][f[min]]); f[min]++; for(i=0;i<8;i++) { if(min&(1<<i)) { jaeryo[i]--; if(jaeryo[i]==0) can^=1<<i; } } } }while(flag); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...