Submission #1098148

#TimeUsernameProblemLanguageResultExecution timeMemory
1098148vjudge1Bank (IZhO14_bank)C++17
0 / 100
3 ms456 KiB
#include<bits/stdc++.h> #define pb push_back #define int long long #define S second #define F first #define ahah ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; const int N=1e6+7; const int MOD=1e9+7; int a[N],b[N]; bool used[N]; signed main() { ahah freopen("bank.in" , "r" , stdin); freopen("bank.out" , "w" , stdout); int n,m; cin >> n >> m; for(int i = 1 ; i <= n ; i++){ cin >> a[i]; } for(int i = 1 ; i <= m ; i++){ cin >> b[i]; } sort(a+1,a+1+n); sort(b+1,b+1+m); for(int uk = 1 ; uk <= n ; uk++){ bool ok=false; for(int i = 0 ; i < (1 << m) ; i++){ vector<int>vc; for(int j = 0 ; j < m ; j++){ if(i&(1 << j) and !used[j+1]){ vc.pb(j+1); } } int cnt=0; for(int j = 0 ; j < vc.size() ; j++){ cnt+=b[vc[j]]; } if(cnt == a[uk]){ for(int j = 0 ; j < vc.size() ; j++){ used[vc[j]]=true; } ok =true; break; } } if(!ok){ cout << "NO"; return 0; } } cout << "YES"; }

Compilation message (stderr)

bank.cpp: In function 'int main()':
bank.cpp:39:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |    for(int j = 0 ; j < vc.size() ; j++){
      |                    ~~^~~~~~~~~~~
bank.cpp:43:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |     for(int j = 0 ; j < vc.size() ; j++){
      |                     ~~^~~~~~~~~~~
bank.cpp:17:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |  freopen("bank.in" , "r" , stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
bank.cpp:18:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |  freopen("bank.out" , "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...