제출 #1096155

#제출 시각아이디문제언어결과실행 시간메모리
1096155muntasir__은행 (IZhO14_bank)C++17
0 / 100
8 ms16732 KiB
// #pragma GCC optimize("O3,unroll-loops") // #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #include <bits/stdc++.h> using namespace std; #define ll long long const ll mod = 1e9 + 7; ll n, m, a[20], b[20], dp1[(1 << 20)], dp2[(1 << 20)]; int main() { #ifndef ONLINE_JUDGE freopen("bank.in", "r", stdin); freopen("bank.out", "w", stdout); #endif ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; for (int i = 0; i < n; i++)cin >> a[i]; for (int i = 0; i < m; i++)cin >> b[i]; memset(dp1, -1, sizeof(dp1)); memset(dp2, -1, sizeof(dp2)); dp1[0] = dp2[0] = 0; for (int mask = 1; mask < (1 << m); mask++) { for (int i = 0; i < m; i++) { if (mask & (1 << i)) { int prev = mask ^ (1 << i); int nwamnt = dp2[prev] + b[i]; int cur_target = a[dp1[prev]]; if (cur_target > nwamnt) { dp1[mask] = dp1[mask]; dp2[mask] = nwamnt; } if (cur_target == nwamnt) { dp1[mask] = dp1[mask] + 1; dp2[mask] = 0; } } } if (dp1[mask] == n) { cout << "YES\n"; return 0; } } cout << "NO\n"; }

컴파일 시 표준 에러 (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...