답안 #41587

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
41587 2018-02-19T14:31:42 Z repeating Bali Sculptures (APIO15_sculpture) C++11
21 / 100
4 ms 1032 KB
#include <bits/stdc++.h>

#define F first
#define S second
#define P push
#define pb push_back
#define MEM(dp,i) memset(dp,i,sizeof(dp))
#define W while
#define R return
#define C continue
#define SI size()
#define ll long long
#define ld long double
#define pll pair<ll,ll>
#define pii pair<int,int>
#define SF(x) scanf("%Id",&x)
#define SF2(x,y) scanf("%Id%Id",&x,&y)
#define SF3(x,y,z) scanf("%I64d%I64d%I64d",&x,&y,&z)
#define SF4(x,y,z,o) scanf("%I64d%I64d%I64d%I64d",&x,&y,&z,&o)
#define all(v) v.begin(),v.end()

using namespace std;
const long long INF = 1e9;
const long long MOD = 1e9+7;
const int MX=200015;
ll is=0,notis=0;
int n,l,r,bit;
int a[2222];
int dp[2002];
int DP(int x){
    if(x==n)R 0;
    int &ret=dp[x];
    if(ret!=-1)R ret;
    ret=INF;
    ll sum=0;
    for(int i=x;i<n;i++){
        sum+=a[i];
        if((sum&notis)==0){ret=min(ret,DP(i+1)+1);}
    }
    R ret;
}
int main(){
    cin>>n>>l>>r;
    for(int i=0;i<n;i++)cin>>a[i];
//    is=8;
    for(int i=42;i>=0;i--){
        notis+=(1LL<<i);
        MEM(dp,-1);
        if(DP(0)>r){
            is+=(1<<i);
            notis-=(1<<i);
        }
//        cout<<DP(0)<<" ";
//        cout<<is<<endl;

    }
    cout<<is;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 248 KB Output is correct
2 Correct 2 ms 484 KB Output is correct
3 Correct 2 ms 484 KB Output is correct
4 Correct 1 ms 484 KB Output is correct
5 Correct 2 ms 484 KB Output is correct
6 Correct 1 ms 484 KB Output is correct
7 Correct 2 ms 524 KB Output is correct
8 Correct 2 ms 560 KB Output is correct
9 Correct 2 ms 632 KB Output is correct
10 Correct 1 ms 756 KB Output is correct
11 Correct 2 ms 756 KB Output is correct
12 Correct 2 ms 756 KB Output is correct
13 Correct 1 ms 756 KB Output is correct
14 Correct 1 ms 756 KB Output is correct
15 Incorrect 2 ms 756 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 756 KB Output is correct
2 Correct 1 ms 756 KB Output is correct
3 Correct 2 ms 756 KB Output is correct
4 Correct 1 ms 756 KB Output is correct
5 Correct 2 ms 756 KB Output is correct
6 Correct 1 ms 756 KB Output is correct
7 Correct 2 ms 756 KB Output is correct
8 Correct 2 ms 820 KB Output is correct
9 Correct 2 ms 820 KB Output is correct
10 Correct 2 ms 820 KB Output is correct
11 Correct 2 ms 820 KB Output is correct
12 Correct 2 ms 820 KB Output is correct
13 Correct 1 ms 820 KB Output is correct
14 Correct 2 ms 820 KB Output is correct
15 Incorrect 1 ms 820 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 820 KB Output is correct
2 Correct 2 ms 820 KB Output is correct
3 Correct 1 ms 820 KB Output is correct
4 Correct 2 ms 820 KB Output is correct
5 Correct 2 ms 820 KB Output is correct
6 Correct 2 ms 820 KB Output is correct
7 Correct 2 ms 820 KB Output is correct
8 Correct 2 ms 820 KB Output is correct
9 Correct 2 ms 820 KB Output is correct
10 Correct 2 ms 884 KB Output is correct
11 Correct 2 ms 884 KB Output is correct
12 Correct 2 ms 884 KB Output is correct
13 Correct 2 ms 884 KB Output is correct
14 Correct 2 ms 884 KB Output is correct
15 Correct 2 ms 884 KB Output is correct
16 Correct 2 ms 884 KB Output is correct
17 Correct 2 ms 884 KB Output is correct
18 Correct 2 ms 884 KB Output is correct
19 Correct 2 ms 884 KB Output is correct
20 Correct 2 ms 884 KB Output is correct
21 Correct 2 ms 884 KB Output is correct
22 Correct 2 ms 884 KB Output is correct
23 Correct 2 ms 884 KB Output is correct
24 Correct 2 ms 884 KB Output is correct
25 Correct 2 ms 884 KB Output is correct
26 Correct 3 ms 884 KB Output is correct
27 Correct 3 ms 884 KB Output is correct
28 Correct 3 ms 884 KB Output is correct
29 Correct 4 ms 884 KB Output is correct
30 Correct 2 ms 884 KB Output is correct
31 Correct 2 ms 884 KB Output is correct
32 Correct 2 ms 884 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 884 KB Output is correct
2 Correct 1 ms 884 KB Output is correct
3 Correct 2 ms 884 KB Output is correct
4 Correct 2 ms 884 KB Output is correct
5 Correct 2 ms 884 KB Output is correct
6 Correct 2 ms 884 KB Output is correct
7 Correct 2 ms 884 KB Output is correct
8 Correct 2 ms 884 KB Output is correct
9 Correct 2 ms 884 KB Output is correct
10 Correct 1 ms 884 KB Output is correct
11 Correct 1 ms 884 KB Output is correct
12 Correct 1 ms 888 KB Output is correct
13 Correct 1 ms 900 KB Output is correct
14 Correct 2 ms 900 KB Output is correct
15 Incorrect 1 ms 904 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1032 KB Output is correct
2 Correct 1 ms 1032 KB Output is correct
3 Correct 1 ms 1032 KB Output is correct
4 Correct 2 ms 1032 KB Output is correct
5 Correct 2 ms 1032 KB Output is correct
6 Correct 2 ms 1032 KB Output is correct
7 Correct 2 ms 1032 KB Output is correct
8 Correct 2 ms 1032 KB Output is correct
9 Correct 1 ms 1032 KB Output is correct
10 Correct 2 ms 1032 KB Output is correct
11 Correct 2 ms 1032 KB Output is correct
12 Correct 1 ms 1032 KB Output is correct
13 Correct 1 ms 1032 KB Output is correct
14 Correct 1 ms 1032 KB Output is correct
15 Correct 1 ms 1032 KB Output is correct
16 Correct 2 ms 1032 KB Output is correct
17 Incorrect 1 ms 1032 KB Output isn't correct
18 Halted 0 ms 0 KB -