제출 #258833

#제출 시각아이디문제언어결과실행 시간메모리
258833karma은행 (IZhO14_bank)C++14
19 / 100
82 ms8572 KiB
#include <bits/stdc++.h> #define pb emplace_back #define ll long long #define fi first #define se second #define mp make_pair //#define int int64_t using namespace std; const int N = 1 << 20 | 1; const int inf = 1e9 + 1; typedef pair<int, int> pii; pii f[N]; int n, m, a[30], b[30]; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); #define Task "test" if(fopen(Task".inp", "r")) { freopen(Task".inp", "r", stdin); freopen(Task".out", "w", stdout); } cin >> n >> m; a[n] = inf; for(int i = 0; i < n; ++i) cin >> a[i]; for(int i = 0; i < m; ++i) cin >> b[i]; f[0] = {0, 0}; for(int i = 0; i < (1 << m); ++i) { if(f[i].fi >= n && f[i].se == 0) return cout << "YES", 0; for(int j = 0; j < m; ++j) { if(i >> j & 1) continue; if(f[i].se + b[j] > a[f[i].fi]) continue; if(f[i].se + b[j] == a[f[i].fi]) { f[i ^ (1 << j)] = {f[i].fi + 1, 0}; continue; } f[i ^ (1 << j)] = {f[i].fi, f[i].se + b[j]}; } } cout << "NO"; }

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

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