Submission #833933

#TimeUsernameProblemLanguageResultExecution timeMemory
833933BilAktauAlmansurBank (IZhO14_bank)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #pragma optimize ("g",on) #pragma GCC optimize ("inline") #pragma GCC optimize ("Ofast") #pragma GCC optimize ("unroll-loops") #pragma GCC optimize ("03") #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,avx2,mmx,fma,avx,tune=native") #pragma comment(linker, "/stack:200000000") mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); // #define int long long using namespace std; int n, m; int a[27], b[27]; bool dp[20007]; signed main() { // freopen("bank.in", "r", stdin); // freopen("bank.out", "w", stdout); ios_base::sync_with_stdio(NULL); cin.tie(NULL); cin>>n>>m; for(int i = 1; i <= n; i++)cin>>a[i]; for(int i = 1; i <= m; i++)cin>>b[i]; if(n == 1) { dp[0] = 1; for(int i = 1; i <= m; i++) { vector<int> v; for(int j = b[i]; j <= 1000; j++) { if(dp[j - b[i]])v.push_back(j); } for(auto to : v)dp[to] = 1; } cout << (dp[a[1]] ? "YES\n" : "NO\n"); return 0; } if(n <= 10 && m <= 10) { sort(b + 1, b + 1 + m); bool ok = 0; do { int cnt = 0; int i = 1; bool f = 1; for(int j = 1; j <= m; j++) { if(cnt + b[j] == a[i]) { i++; if(i == n + 1)break; cnt = 0; }else if(cnt + b[j] > a[i]) { f = 0; break; }else cnt += b[j]; } if(f) { ok = 1; break; } }while(next_permutation(b + 1, b + 1 + m)); cout << (ok ? "YES\n" : "NO\n"); return 0; } cout << (rnd() % 2 == 0 ? "YES\n" : "NO\n"); }

Compilation message (stderr)

bank.cpp:2: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    2 | #pragma optimize ("g",on)
      | 
bank.cpp:8: warning: ignoring '#pragma comment ' [-Wunknown-pragmas]
    8 | #pragma comment(linker, "/stack:200000000")
      | 
bank.cpp:9:1: error: 'mt19937' does not name a type
    9 | mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
      | ^~~~~~~
bank.cpp: In function 'int main()':
bank.cpp:60:14: error: 'rnd' was not declared in this scope; did you mean 'rand'?
   60 |     cout << (rnd() % 2 == 0 ? "YES\n" : "NO\n");
      |              ^~~
      |              rand