제출 #523955

#제출 시각아이디문제언어결과실행 시간메모리
523955AA_SurelyBali Sculptures (APIO15_sculpture)C++17
16 / 100
1078 ms69232 KiB
#pragma GCC optimize("unroll-loops,O3") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #include <bits/stdc++.h> #define FOR(i,x,n) for(int i=x; i<n; i++) #define F0R(i,n) FOR(i,0,n) #define ROF(i,x,n) for(int i=n-1; i>=x; i--) #define R0F(i,n) ROF(i,0,n) #define WTF cout << "WTF" << endl #define IOS ios::sync_with_stdio(false); cin.tie(0) #define F first #define S second #define pb push_back #define ALL(x) x.begin(), x.end() #define RALL(x) x.rbegin(), x.rend() using namespace std; typedef long long LL; typedef pair<int, int> PII; typedef pair<LL, LL> PLL; typedef vector<int> VI; typedef vector<LL> VLL; typedef vector<PII> VPII; typedef vector<PLL> VPLL; const int MAXN = 100 + 7; const int ALPHA = 27; const int INF = 1e9 + 7; const int MOD = 1e9 + 7; const int LOG = 22; int dp[102][102][2050]; int ns[MAXN], a, b, n; int main() { IOS; cin >> n >> a >> b; FOR(i, 1, n + 1) { cin >> ns[i]; if (ns[i] > 20) return 0; } F0R(i, 2048) dp[0][0][i] = 1; FOR(i, 1, n + 1) FOR(j, 1, b + 1) F0R(k, 2048) { int po = 0; ROF(x, 1, i + 1) { po += ns[x]; if ((po & k) == po) dp[i][j][k] |= dp[x - 1][j - 1][k]; } } //cout << dp[6][2][11] << endl; int minim = INF; FOR(i, a, b + 1) F0R(j, 2048) if (dp[n][i][j]) minim = min(minim, j); cout << minim; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...