제출 #1134431

#제출 시각아이디문제언어결과실행 시간메모리
1134431JelalTkm은행 (IZhO14_bank)C++20
0 / 100
23 ms48448 KiB
#include <bits/stdc++.h> #pragma GCC optimize ("O3") #pragma GCC target ("sse4") using namespace std; #define int long long int const int N = 1e6 + 10; const int md = 1e9 + 7; const int INF = 1e18; int32_t main(int32_t argc, char *argv[]) { // #ifndef ONLINE_JUDGE freopen("bank.in", "r", stdin); freopen("bank.out", "w", stdout); // #endif ios::sync_with_stdio(false); cin.tie(nullptr); int T = 1; // cin >> T; while (T--) { int n, m; cin >> n >> m; vector<int> a(n + 1), b(m + 1); for (int i = 1; i <= n; i++) cin >> a[i]; for (int j = 1; j <= m; j++) cin >> b[j]; vector<vector<int>> dp(n + 1, vector<int> ((1 << m) + 1)); for (int j = 0; j < (1 << m); j++) dp[0][j] = 1; string ans = "NO"; for (int i = 1; i <= n; i++) { for (int j = 1; j < (1 << m); j++) { int num = 0, sm = 0; for (int k = 0; k < m; k++) { if (((1 << k) & j)) { sm += b[k + 1]; } else num |= (1 << k); } if (sm == a[i] && dp[i - 1][num]) { dp[i][j] = 1; if (i == n) ans = "YES"; } } } cout << ans << '\n'; } return 0; }

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

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