# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
489709 | 2021-11-24T02:50:56 Z | mdn2002 | Bali Sculptures (APIO15_sculpture) | C++14 | 117 ms | 262148 KB |
#include<bits/stdc++.h> using namespace std; int n , a , b , y [2003] , dp [2003][2003][100] , t; long long mask; bool f ( int x , int num ) { if ( x == n ) { if ( a <= num && num <= b ) return 1; return 0; } if ( dp [x][num][t] != -1 ) return dp [x][num][t]; bool ans = 0; long long sum = 0; for ( int i = x ; i < n ; i ++ ) { sum += y [i]; if ( ( mask | sum ) > mask ) continue; ans = max ( ans , f ( i + 1 , num + 1 ) ); } return dp [x][num][t] = ans; } int main() { //freopen ( "fence8.in" , "r" , stdin ); //freopen ( "fence8.out" , "w" , stdout ); memset ( dp , -1 , sizeof dp ); scanf ( "%d%d%d" , &n , &a , &b ); for ( int i = 0 ; i < n ; i ++ ) scanf ( "%d" , &y [i] ); mask = ( 1ll << 50 ) - 1; for ( int i = 49 ; i >= 0 ; i -- ) { mask ^= ( 1ll << i ); if ( f ( 0 , 0 ) == 0 ) mask ^= ( 1ll << i ); t ++; } printf ( "%lld" , mask ); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 117 ms | 262148 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 106 ms | 262148 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 107 ms | 262148 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 100 ms | 262148 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 102 ms | 262148 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |