제출 #1183116

#제출 시각아이디문제언어결과실행 시간메모리
1183116pete555은행 (IZhO14_bank)C++17
100 / 100
99 ms8640 KiB
#include<bits/stdc++.h> using namespace std; #define pi pair<int,int> #define ll long long #define pb push_back #define pf push_front void fileIO(string filename) { freopen((filename + ".in").c_str(), "r", stdin); freopen((filename + ".out").c_str(), "w", stdout); } const int MOD = 1e9+7; int main() { cin.tie(0)->sync_with_stdio(false); //fileIO(""); int n, m; cin >> n >> m; int a[n], b[m]; for(int i = 0; i < n; i++) cin >> a[i]; for(int i = 0; i < m; i++) cin >> b[i]; int covered[1<<m], left[1<<m]; memset(covered, -1, sizeof(covered)); memset(left, -1, sizeof(left)); covered[0] = left[0] = 0; for(int mask = 0; mask < (1<<m); mask++){ for(int i = 0; i < m; i++){ if(mask & (1<<i)){ int prev = (mask ^ (1<<i)); if(covered[prev] == -1) continue; int sal = a[covered[prev]]; int amt = b[i] + left[prev]; if(amt < sal){ covered[mask] = covered[prev]; left[mask] = amt; } else if(amt == sal){ covered[mask] = covered[prev] + 1; left[mask] = 0; } } } if(covered[mask] == n){ cout << "YES"; return 0; } } cout << "NO"; return 0; }

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

bank.cpp: In function 'void fileIO(std::string)':
bank.cpp:10:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |         freopen((filename + ".in").c_str(), "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bank.cpp:11:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         freopen((filename + ".out").c_str(), "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...