Submission #43660

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
436602018-03-19 07:34:18top34051Bali Sculptures (APIO15_sculpture)C++14
100 / 100
131 ms1444 KiB
#include<bits/stdc++.h>
using namespace std;
const int maxn = 2e3 + 5;
const long long inf = 2e16 + 5;
int n,a,b;
int p[maxn];
int dp1[maxn], dp2[maxn][maxn];
bool check1(long long bit) {
// printf("check %lld\n",bit);
for(int x=1;x<=n;x++) {
long long cur = 0;
dp1[x] = n+1;
for(int y=x;y>=1;y--) {
cur += p[y];
if((cur|bit) == bit) dp1[x] = min(dp1[x], dp1[y-1] + 1);
}
// printf("\tdp %d = %d\n",x,dp[x]);
}
return dp1[n]<=b;
}
bool check2(long long bit) {
// printf("check %lld\n",bit);
dp2[0][0] = 1;
for(int x=1;x<=n;x++) {
for(int k=1;k<=n;k++) {
dp2[x][k] = 0;
long long cur = 0;
for(int y=x;y>=1;y--) {
cur += p[y];
if((cur|bit) == bit) dp2[x][k] |= dp2[y-1][k-1];
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

sculpture.cpp: In function 'int main()':
sculpture.cpp:42:26: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%d",&n,&a,&b);
                          ^
sculpture.cpp:43:41: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1;i<=n;i++) scanf("%d",&p[i]);
                                         ^
#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...