제출 #87777

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
877772018-12-02 13:19:51KCSCBali Sculptures (APIO15_sculpture)C++14
100 / 100
158 ms2340 KiB
#include <bits/stdc++.h>
using namespace std;
const int DIM = 2005;
int dp1[DIM]; long long psm[DIM];
bool dp2[DIM][DIM];
bool solve(long long val, int n, int a, int b) {
long long aux = ((1LL << 50) - 1) ^ val;
if (a == 1) {
dp1[0] = 0;
for (int i = 1; i <= n; ++i) {
dp1[i] = b + 1;
for (int j = i; j >= 1; --j) {
if (!((psm[i] - psm[j - 1]) & aux)) {
dp1[i] = min(dp1[i], dp1[j - 1] + 1); } } }
return dp1[n] <= b; }
else {
dp2[0][0] = true;
for (int k = 1; k <= b; ++k) {
for (int i = 1; i <= n; ++i) {
dp2[k][i] = false;
for (int j = i; j >= 1; --j) {
if (!((psm[i] - psm[j - 1]) & aux)) {
dp2[k][i] |= dp2[k - 1][j - 1]; } } } }
for (int k = a; k <= b; ++k) {
if (dp2[k][n]) {
return true; } }
return false; } }
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...