제출 #385197

#제출 시각아이디문제언어결과실행 시간메모리
385197Aryan_Raina은행 (IZhO14_bank)C++14
52 / 100
1087 ms19820 KiB
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, "/stack:200000000") #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define int long long #define ld long double #define ar array const int INF = 1e15; const int MOD = 1e9+7; const int LIMIT = 1e18; const int MXN = 21; int dp[MXN][1<<MXN], a[MXN], b[MXN]; vector<int> smh[1005*MXN]; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, m; cin>>n>>m; for (int i = 0; i < n; i++) cin>>a[i]; for (int i = 0; i < m; i++) cin>>b[i]; for (int i = 0; i < 1<<m; i++) { int sum = 0; for (int j = 0; j < m; j++) if ((i>>j) & 1) { sum += b[j]; } smh[sum].push_back(i); } int ans = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < 1<<m; j++) { for (int x : smh[a[i]]) if ((j & x) == 0) { dp[i+1][j ^ x] = max(dp[i+1][j ^ x], dp[i][j] + 1); ans = max(ans, dp[i+1][j ^ x]); } } } if (ans == n) { cout<<"YES\n"; } else cout<<"NO\n"; }

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

bank.cpp:3: warning: ignoring #pragma comment  [-Wunknown-pragmas]
    3 | #pragma comment(linker, "/stack:200000000")
      |
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...