제출 #554570

#제출 시각아이디문제언어결과실행 시간메모리
554570rafatoa은행 (IZhO14_bank)C++17
0 / 100
100 ms97612 KiB
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; #define int ll #define double ld const int inf = 2e9; const int INF = 4e18; const int mod = 1e9+7; const int mx = 200001; #define F first #define S second #define vi vector<int> #define vvi vector<vi> #define pi pair<int, int> #define vpi vector<pi> #define vb vector<bool> #define pb push_back #define read(a) for(auto &x:a) cin >> x; #define print(a) for(auto x:a) cout << x << " "; cout << "\n"; #define ppb pop_back signed main(){ ios::sync_with_stdio(0); cin.tie(0); // #ifndef ONLINE_JUDGE // freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout); // #endif freopen("bank.in", "r", stdin); freopen("bank.out", "w", stdout); int n, m; cin >> n >> m; vi a(n), b(m); read(a); read(b); vpi best(1<<m, {0, 0}); for(int s=1; s<(1<<m); s++){ for(int t=0; t<m; t++){ pi option = best[s^(1<<t)]; if(best[s^(1<<t)].S + b[t] < a[best[s^(1<<t)].F]){ option.S = best[s^(1<<t)].S + b[t]; } else if(best[s^(1<<t)].S + b[t] == a[best[s^(1<<t)].F]){ option.F++; option.S = 0; } best[s] = max(best[s], option); } } for(auto x:best){ if(x.F == n && x.S == 0){ cout << "YES\n"; return 0; } } cout << "NO\n"; return 0; }

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

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