제출 #361583

#제출 시각아이디문제언어결과실행 시간메모리
361583shahriarkhan은행 (IZhO14_bank)C++14
71 / 100
1091 ms3240 KiB
#include<bits/stdc++.h> using namespace std ; int main() { int n , m ; scanf("%d%d",&n,&m) ; int a[n+1] , b[m+1] ; for(int i = 1 ; i <= n ; ++i) scanf("%d",&a[i]) ; for(int i = 1 ; i <= m ; ++i) scanf("%d",&b[i]) ; vector<int> pos[n+1] , dp ; for(int i = 1 ; i < (1<<m) ; ++i) { int sum = 0 ; for(int j = 0 ; j < m ; ++j) { if(i&(1<<j)) sum += b[j+1] ; } for(int j = 1 ; j <= n ; ++j) { if(a[j]==sum) pos[j].push_back(i) ; } } dp.push_back(0) ; for(int i = 1 ; i <= n ; ++i) { vector<int> dp2 ; for(int j : dp) { for(int k : pos[i]) { if(j&k) continue ; dp2.push_back(j|k) ; } } dp = dp2 ; if(dp.empty()) { puts("NO") ; return 0 ; } } puts("YES") ; return 0 ; }

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

bank.cpp: In function 'int main()':
bank.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    7 |     scanf("%d%d",&n,&m) ;
      |     ~~~~~^~~~~~~~~~~~~~
bank.cpp:9:40: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    9 |     for(int i = 1 ; i <= n ; ++i) scanf("%d",&a[i]) ;
      |                                   ~~~~~^~~~~~~~~~~~
bank.cpp:10:40: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   10 |     for(int i = 1 ; i <= m ; ++i) 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...