| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 799527 | andecaandeci | Kitchen (BOI19_kitchen) | C++17 | 1046 ms | 20712 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define sec second
#define pb push_back
#define pqueue priority_queue
#define int long long
#define pii pair<int,int>
#define supercepat ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
//GA AC GA LAKI
using namespace std;
int tc,ans=0,n,m,k,sum;
int INF=10000000;
int a[305];
int b[305];
int bin[30];
int tothour,totdish;
bool cek(){
tothour=0; totdish=0;
for(int i=0;i<=29;i++){
if(bin[i]==1){
tothour+=b[i+1];
totdish+=min(b[i+1],n);
if(b[i+1]<k) return 0;
}
}
if(totdish<k*n) return 0;
if(tothour<sum) return 0;
return 1;
}
void conv(int x){
int temp=x,biton=0;
memset(bin,0,sizeof(bin));
for(int i=29;i>=0;i--){
if(temp>=pow(2,i)){
biton++;
temp-=pow(2,i);
bin[i]=1;
}
}
if(biton>=k&&cek()){
ans=min(ans,tothour-sum);
}
for(int i=0;i<m;i++){
cout<<bin[i]<<" ";
}
cout<<endl;
cout<<ans<<endl;
}
main(){
supercepat;
cin>>n>>m>>k;
bool ok=1;
for(int i=1;i<=n;i++){
cin>>a[i];
sum+=a[i];
if(a[i]<k) ok=0;
}
for(int i=1;i<=m;i++) cin>>b[i];
if(!ok){
cout<<"Impossible"<<endl;
return 0;
}
int t1=pow(2,m)-1;
ans=INF;
for(int i=0;i<=t1;i++){
conv(i);
}
if(ans==INF) cout<<"Impossible"<<endl;
else cout<<ans<<endl;
}
컴파일 시 표준 에러 (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... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
