제출 #839208

#제출 시각아이디문제언어결과실행 시간메모리
839208Alfraganus은행 (IZhO14_bank)C++17
0 / 100
96 ms97612 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define printmp(a) for(auto x : a) cout << x.first << ' ' << x.second << endl; signed main(){ freopen("bank.in", "r", stdin); freopen("bank.out", "w", stdout); int n, m; cin >> n >> m; vector<int> b(n); for (int i = 0; i < n; i++) cin >> b[i]; // debt vector<int> a(m); for(int i = 0; i < m; i ++) cin >> a[i]; // tenges vector<pair<int, int>> dp((1 << m) + 1); for(int i = 0; i <= (1 << m); i ++){ pair<int, int> best = {0, 0}; for(int j = 0; j < m; j ++){ if((i & (1 << j)) == (1 << j)){ if(b[dp[i ^ (1 << j)].first] - dp[i ^ (1 << j)].second > a[j]) best = max(best, {dp[i ^ (1 << j)].first, dp[i ^ (1 << j)].second + a[j]}); if (b[dp[i ^ (1 << j)].first] - dp[i ^ (1 << j)].second == a[j]) best = max(best, {dp[i ^ (1 << j)].first + 1, 0}); } } if(best.first == n){ cout << "YES"; return 0; } dp[i] = best; } cout << "NO"; }

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

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