답안 #156026

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
156026 2019-10-02T17:38:57 Z bharat2002 Bali Sculptures (APIO15_sculpture) C++14
0 / 100
2 ms 376 KB
/*input
6 1 3
8 1 2 1 5 4
*/
#include<bits/stdc++.h>
using namespace std;
const int N=2010;
const int mod=1e9 + 7;
#define int long long
const int inf=1e18;
#define pii pair<int, int>
#define f first
#define s second 
#define mp make_pair
#define FOR(i, n) for(int i=1;i<=n;i++)
#define TRACE(x) cerr << #x << " = " << x << endl 
//Trace prints the name of the variable and the value.
int dp[N][N], arr[N], n, a, b;
signed main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	cin>>n>>a>>b;
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<=n;j++) dp[i][j]=inf;
	}
	dp[0][0]=0;arr[0]=0;
	for(int i=1;i<=n;i++)
	{
		cin>>arr[i];
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=i;j++)
		{
			int cur=arr[i];
			for(int k=i-1;k>=0;k--)
			{
				dp[i][j]=min(dp[i][j], (dp[k][j-1]|cur));cur+=arr[k];
			}
		}
	}
	int ans=inf;
	for(int i=a;i<=b;i++) ans=min(ans, dp[n][i]);cout<<ans;
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:44:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
  for(int i=a;i<=b;i++) ans=min(ans, dp[n][i]);cout<<ans;
  ^~~
sculpture.cpp:44:47: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  for(int i=a;i<=b;i++) ans=min(ans, dp[n][i]);cout<<ans;
                                               ^~~~
# 결과 실행 시간 메모리 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 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 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 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 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -