제출 #1275139

#제출 시각아이디문제언어결과실행 시간메모리
1275139almaz은행 (IZhO14_bank)C++17
19 / 100
77 ms19848 KiB
#include <iostream> #include <vector> #include <set> #include <unordered_map> using namespace std; #define endl '\n' signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n , m; scanf( "%d%d" ,&n , &m); vector <int> a(n) , b(m); for(int i = 0;i < n;i++){ scanf("%d" ,&a[i]); } for(int i = 0;i < m;i++){ scanf("%d" ,&b[i]); } vector <vector <int>> mp(200001); for(int i = 0;i < (1 << m);i++){ int sum = 0; for(int j = 0;j < m;j++){ if(1 & (i >> j)){ sum += b[j]; } } if(sum <= 200000) mp[sum].push_back(i); } vector <int> dp(1 << m); dp[0] = 1; for(int i = 0;i < n;i++){ vector <int> cnt(1 << m); for(int j = 0;j <= (1 << m);j++){ if(!dp[j]) continue; for(int k : mp[a[i]]){ if((k & j) == 0){ cnt[k | j] = 1;; } } } swap(cnt , dp); } int f = 0; for(int i : dp){ if(i){ f = 1; } } if(f){ printf("YES"); } else{ printf("NO"); } }

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

bank.cpp: In function 'int main()':
bank.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         scanf( "%d%d" ,&n , &m);
      |         ~~~~~^~~~~~~~~~~~~~~~~~
bank.cpp:18:22: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |                 scanf("%d" ,&a[i]);
      |                 ~~~~~^~~~~~~~~~~~~
bank.cpp:21:22: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |                 scanf("%d" ,&b[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...