답안 #129350

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
129350 2019-07-12T04:35:29 Z ksmzzang2003 Bali Sculptures (APIO15_sculpture) C++14
0 / 100
2 ms 376 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int N,A,B; vector <ll> arr,psum;

ll f(int i,int j)
{
    if(j==1) return psum[i];
    ll ret = 1987654321*1987654321;
    for(int k = 0;k<i;k++)
        ret = min(ret,f(k,j-1)|(psum[i]-psum[k]));
    return ret;
}
int main()
{
    scanf("%d %d %d",&N,&A,&B);
    arr.resize(N); psum.resize(N);
    for(int i=0;i<N;i++) scanf("%lld",&arr[i]);
    psum[0] = arr[0] ;
    for(int i=1;i<N;i++) psum[i] = psum[i-1] + arr[i];
    ll ans = 1987654321*1987654321;
    for(int i=A;i<=B;i++)
        ans = min(ans,f(N-1,i));
    printf("%lld",ans);
}

Compilation message

sculpture.cpp: In function 'll f(int, int)':
sculpture.cpp:9:24: warning: integer overflow in expression [-Woverflow]
     ll ret = 1987654321*1987654321;
              ~~~~~~~~~~^~~~~~~~~~~
sculpture.cpp: In function 'int main()':
sculpture.cpp:21:24: warning: integer overflow in expression [-Woverflow]
     ll ans = 1987654321*1987654321;
              ~~~~~~~~~~^~~~~~~~~~~
sculpture.cpp:16:10: 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:18:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=0;i<N;i++) scanf("%lld",&arr[i]);
                          ~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 2 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -