제출 #1103080

#제출 시각아이디문제언어결과실행 시간메모리
1103080hippo123은행 (IZhO14_bank)C++17
0 / 100
1 ms336 KiB
#include <bits/stdc++.h> using namespace std; #define pr pair<int, int> #define ll long long #define pb push_back #define f first #define s second int main(){ freopen("bank.in", "r", stdin); freopen("bank.out", "w", stdout); int n, m; cin>>n>>m; vector<int> a(n), b(m); for (int i=0; i<n; i++) cin>>a[i]; for (int i=0; i<m; i++) cin>>b[i]; vector<pr> dp(1<<m); // .f number of people covered, .s: remaining bills dp[0]={0, 0}; for (int x=0; x<(1<<m); x++){ for (int i=0; i<m; i++){ if(x&(1<<i)) continue; pr node; if(a[dp[x].f]==dp[x].s+b[i]) node={dp[x].f+1, 0}; else { node={dp[x].f, dp[x].s+b[i]}; } dp[x|(1<<i)]=max(dp[x|(1<<i)], node); } } if(dp[(1<<m)-1].f==n) cout<<"YES"<<endl; else cout<<"NO"; }

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

bank.cpp: In function 'int main()':
bank.cpp:11:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  freopen("bank.in", "r", stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
bank.cpp:12:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |  freopen("bank.out", "w", stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...