제출 #991247

#제출 시각아이디문제언어결과실행 시간메모리
991247hippo123은행 (IZhO14_bank)C++17
0 / 100
24 ms348 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; multiset<int> a; vector<int> b(m); //int amax=0; for (int i=0; i<n; i++) { int temp; cin>>temp; } for (int i=0; i<m; i++) cin>>b[i]; vector<pair<multiset<int>, int>> dp(1<<m, {a, 0}); for (int x=1; x<(1<<m); x++){ pair<multiset<int>, int> mast=dp[x]; multiset<int> nd=mast.f; for (int i=0; i<m; i++){ if(x&(1<<i)){ pair<multiset<int>, int> prev=dp[x^(1<<i)]; multiset<int> elem=prev.f; int last=prev.s; last+=b[i]; if(elem.find(last)!=elem.end()){ elem.erase(last); last=0; } if(nd.size()>elem.size()){ dp[x]={elem, last}; } } } } multiset<int> sf=dp[(1<<m)-1].f; if(sf.size()==0) cout<<"YES"; else cout<<"NO"; }

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

bank.cpp: In function 'int main()':
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.in", "r", stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
bank.cpp:13:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |  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...