제출 #851217

#제출 시각아이디문제언어결과실행 시간메모리
851217NamPE은행 (IZhO14_bank)C++17
100 / 100
107 ms17068 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n, m; cin >> n >> m; vector<ll> a(n), b(m); for (ll& i : a) { cin >> i; } for (ll& i : b) { cin >> i; } vector<ll> covered(1 << m, -1), leftover(1 << m, -1); covered[0] = leftover[0] = 0; for (ll i = 0; i < covered.size(); i++) { for (ll j = 0; j < m; j++) { if (!(i & (1 << j))) { continue; } ll prev = i ^ (1 << j); if (covered[prev] == -1) { continue; } ll total = leftover[prev] + b[j]; ll salary = a[covered[prev]]; if (total == salary) { covered[i] = covered[prev] + 1; leftover[i] = 0; } else if (total < salary) { covered[i] = covered[prev]; leftover[i] = total; } } if(covered[i] == n) { cout << "YES"; return 0; } } cout << "NO"; }

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

bank.cpp: In function 'int main()':
bank.cpp:23:22: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for (ll i = 0; i < covered.size(); i++) {
      |                    ~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...