# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
693807 | 2023-02-03T08:47:18 Z | ktkerem | Bank (IZhO14_bank) | C++17 | 1000 ms | 1924 KB |
/*#pragma GCC target ("avx2") #pragma GCC optimize ("O3") #pragma GCC optimize("Ofast") #pragma GCC optimize ("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")/**/ #include<bits/stdc++.h> //typedef int ll; typedef long long ll; typedef unsigned long long ull; #define llll std::pair<ll , ll> #define pb push_back #define pf push_front #define halo cout << "hello" << std::endl #define fi first #define sec second #define all(a) a.begin() , a.end() const ll limit = 1e18+7; const ll ous = 2e5 + 500; const ll dx[4] = {-1 , 0 , 1 , 0} , dy[4] = {0,1,0,-1}; std::mt19937 rng(std::chrono::steady_clock::now().time_since_epoch().count()); ll n , m; std::vector<ll> a , b; std::vector<ll> tk[20]; ll dp[(1ll << 20)]; void solve(){ std::cin >> n >> m; a.resize(n);b.resize(m); for(ll i = 0 ; n>i;i++){ std::cin >> a[i]; } for(ll i = 0 ; m>i;i++){ std::cin >> b[i]; } for(ll j=0;n>j;j++){ for(ll o = 0;(1ll << m) > o;o++){ ll sm = 0; for(ll i = 0;m>i;i++){ if((1ll << i) & o){ sm += b[i]; } } if(sm == a[j]){ tk[j].pb(o); } } } ll ans = 0; for(ll j = 0;n>j;j++){ for(ll o = (1ll << m)-1;o>=0;o--){ for(auto i:tk[j]){ if(!(o & i)){ dp[o | i] = std::max(dp[o | i] , dp[o] + 1); ans = std::max(ans , std::max(dp[o | i] , dp[o])); } } } } if(ans == n){ std::cout << "YES\n"; } else{ std::cout << "NO\n"; } return;/**/ } signed main(){ //std::ios_base::sync_with_stdio(false);std::cin.tie(NULL); ll t=1; //std::cin >> t; ll o = 1; while(t--){ //std::cout << "Case " << o << ": "; //o++; solve(); } return 0; }/**/
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 7 ms | 468 KB | Output is correct |
5 | Correct | 63 ms | 292 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Execution timed out | 1089 ms | 1924 KB | Time limit exceeded |
9 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 340 KB | Output is correct |
2 | Correct | 4 ms | 340 KB | Output is correct |
3 | Correct | 9 ms | 440 KB | Output is correct |
4 | Correct | 14 ms | 300 KB | Output is correct |
5 | Correct | 10 ms | 340 KB | Output is correct |
6 | Correct | 5 ms | 212 KB | Output is correct |
7 | Correct | 4 ms | 340 KB | Output is correct |
8 | Correct | 4 ms | 440 KB | Output is correct |
9 | Correct | 8 ms | 340 KB | Output is correct |
10 | Correct | 7 ms | 444 KB | Output is correct |
11 | Correct | 13 ms | 308 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 7 ms | 468 KB | Output is correct |
5 | Correct | 63 ms | 292 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Execution timed out | 1089 ms | 1924 KB | Time limit exceeded |
9 | Halted | 0 ms | 0 KB | - |