Submission #885401

#TimeUsernameProblemLanguageResultExecution timeMemory
885401IsamBank (IZhO14_bank)C++17
44 / 100
203 ms452 KiB
#include<bits/stdc++.h> #ifdef DEBUG #include "debug.h" #else #define debug(...) void(37) #endif using namespace std; int A[21], B[21], N, M; bool OK[21]; signed main(){ ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> N >> M; for(register int i = 0; i < N; ++i) cin >> A[i]; for(register int i = 0; i < M; ++i) cin >> B[i]; if(M < N) return puts("NO"), 0; for(register int i = 0; i < N; ++i){ int mncnt{100000}, cnt(0); vector<int> get; for(register int mask = 0; mask <= (1 << M); ++mask){ int sm(0); vector<int> tmp; for(register int j = 0; j < M; ++j){ if(mask & (1 << j)){ sm += B[j]; tmp.emplace_back(j); } } if(sm ^ A[i]) continue; OK[i] = true; cnt = (int)tmp.size(); if(cnt < mncnt){ mncnt = cnt; get = tmp; } } for(auto j : get) B[j] = 0; } bool flag{true}; for(register int i = 0; i < N; ++i) flag &= OK[i]; cout << (flag ? "YES" : "NO") << '\n'; return 0; }

Compilation message (stderr)

bank.cpp: In function 'int main()':
bank.cpp:18:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   18 |  for(register int i = 0; i < N; ++i) cin >> A[i];
      |                   ^
bank.cpp:19:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   19 |  for(register int i = 0; i < M; ++i) cin >> B[i];
      |                   ^
bank.cpp:21:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   21 |  for(register int i = 0; i < N; ++i){
      |                   ^
bank.cpp:24:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   24 |   for(register int mask = 0; mask <= (1 << M); ++mask){
      |                    ^~~~
bank.cpp:27:21: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   27 |    for(register int j = 0; j < M; ++j){
      |                     ^
bank.cpp:44:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   44 |  for(register int i = 0; i < N; ++i) flag &= OK[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...