제출 #961535

#제출 시각아이디문제언어결과실행 시간메모리
961535doducanh은행 (IZhO14_bank)C++14
19 / 100
74 ms8488 KiB
#include <bits/stdc++.h> using namespace std; int leftovers[(1<<20)+7]; int people_cover[(1<<20)+7]; int a[25],b[25]; int n,m; main() { cin>>n>>m; for(int i=0;i<n;i++)cin>>a[i]; for(int i=0;i<m;i++)cin>>b[i]; for(int mask=1;mask<(1<<m);mask++){ for(int i=0;i<=m;i++){ if((mask>>i)&1){ int prev=(mask^(1<<i)); int amt=leftovers[mask]+b[i]; if(amt<a[people_cover[mask]]){ leftovers[mask]=amt; people_cover[mask]=people_cover[prev]; } else if(amt==a[people_cover[mask]]){ leftovers[mask]=0; people_cover[mask]=people_cover[prev]+1; } } } if(people_cover[mask]==n){ cout<<"YES"; return 0; } } cout<<"NO"; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

bank.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 | main()
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...