제출 #40521

#제출 시각아이디문제언어결과실행 시간메모리
40521Pajaraja은행 (IZhO14_bank)C++14
100 / 100
649 ms25280 KiB
#include <bits/stdc++.h> using namespace std; int a[20],b[20]; bool ma[22][1100000]; vector<int> v[22]; vector<int> s[20007]; int main() { int n,m; scanf("%d%d",&n,&m); for(int i=1;i<=n;i++) scanf("%d",&a[i]); for(int i=0;i<m;i++) scanf("%d",&b[i]); v[0].push_back(0); for(int i=0;i<(1<<m);i++) { int ma=i; int sum=0; for(int j=0;j<m;j++) { if(ma%2==1) sum+=b[j]; ma/=2; } s[sum].push_back(i); } for(int i=1;i<=n;i++) { for(int j=0;j<s[a[i]].size();j++) for(int k=0;k<v[i-1].size();k++) if(((v[i-1][k]^s[a[i]][j]) == (v[i-1][k]|s[a[i]][j])) && !ma[i][v[i-1][k] xor s[a[i]][j]]) { v[i].push_back(s[a[i]][j] xor v[i-1][k]); ma[i][s[a[i]][j] xor v[i-1][k]]=true; } } if(v[n].size()>0) printf("YES"); else printf("NO"); }

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

bank.cpp: In function 'int main()':
bank.cpp:27:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j=0;j<s[a[i]].size();j++) for(int k=0;k<v[i-1].size();k++) if(((v[i-1][k]^s[a[i]][j]) == (v[i-1][k]|s[a[i]][j])) && !ma[i][v[i-1][k] xor s[a[i]][j]])
               ~^~~~~~~~~~~~~~~
bank.cpp:27:50: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j=0;j<s[a[i]].size();j++) for(int k=0;k<v[i-1].size();k++) if(((v[i-1][k]^s[a[i]][j]) == (v[i-1][k]|s[a[i]][j])) && !ma[i][v[i-1][k] xor s[a[i]][j]])
                                                 ~^~~~~~~~~~~~~~
bank.cpp:10:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&n,&m);
  ~~~~~^~~~~~~~~~~~~~
bank.cpp:11:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1;i<=n;i++) scanf("%d",&a[i]);
                        ~~~~~^~~~~~~~~~~~
bank.cpp:12:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=0;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...