제출 #892741

#제출 시각아이디문제언어결과실행 시간메모리
892741ASN49K은행 (IZhO14_bank)C++14
0 / 100
1 ms464 KiB
#include <bits/stdc++.h> using namespace std; #define all(x) x.begin(),x.end() #define pb push_back #define bug(x) cerr<<#x<<" ( "<<x<<endl using i64=long long; const int inf=1e9; main() { ios::sync_with_stdio(false); cin.tie(0); int n,m; cin>>n>>m; vector<int>a(n); vector<int>b(m); for(auto &c:a)cin>>c; for(auto &c:b)cin>>c; vector<pair<int,int>>dp(1<<m,{0,0}); for(int i=1;i<(1<<m);i++) { for(int j=0;j<m;j++) { if(i&(1<<j)) { auto nou=dp[i^(1<<j)]; nou.second+=b[nou.first]; if(nou.second==a[nou.first]) { nou.first++; nou.second=0; } if(nou.first==n) { cout<<"YES\n"; return 0; } dp[i]=max(dp[i],nou); } } } cout<<"NO\n"; }

컴파일 시 표준 에러 (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...