답안 #53950

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
53950 2018-07-02T04:33:15 Z Mahmoud_Adel Bali Sculptures (APIO15_sculpture) C++14
0 / 100
37 ms 41784 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update


#define f first
#define s second
#define pb push_back
#define mp make_pair
#define clr(dp,i) memset(dp,i,sizeof(dp))
#define opt     ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
tree_order_statistics_node_update> oset;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
const long long mod = 1e9+7;
const ld pi = 3.14159265358979323846264338327950288;
//========================================
int n, a, b, arr[2001], dp[50][100][100][21];
int sol(int i, int cur, int prev, int cnt)
{
	cur += arr[i];
	int &ret = dp[i][cur][prev][cnt];
	if(i == n && cnt >= a && cnt <= b)
	return (prev | cur);
	else if(i == n)
	return 1e9;
	if(ret != -1)
	return ret;
	int take = sol(i+1, 0, (prev | cur), cnt+1);
	int dont = sol(i+1, cur, prev, cnt);
 	return ret = min(dont, take);
}
int main()
{
	clr(dp, -1);
	cin >> n >> a >> b;
	for(int i=0; i<n; i++)
	cin >> arr[i];
	cout << sol(0, 0, 0, 0) << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 41336 KB Output is correct
2 Correct 31 ms 41572 KB Output is correct
3 Correct 31 ms 41572 KB Output is correct
4 Correct 31 ms 41572 KB Output is correct
5 Incorrect 31 ms 41732 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 41732 KB Output is correct
2 Correct 33 ms 41732 KB Output is correct
3 Correct 31 ms 41732 KB Output is correct
4 Correct 31 ms 41732 KB Output is correct
5 Incorrect 32 ms 41732 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 41732 KB Output is correct
2 Correct 31 ms 41784 KB Output is correct
3 Correct 30 ms 41784 KB Output is correct
4 Correct 31 ms 41784 KB Output is correct
5 Incorrect 31 ms 41784 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 41784 KB Output is correct
2 Correct 31 ms 41784 KB Output is correct
3 Correct 31 ms 41784 KB Output is correct
4 Correct 32 ms 41784 KB Output is correct
5 Incorrect 31 ms 41784 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 41784 KB Output is correct
2 Correct 33 ms 41784 KB Output is correct
3 Correct 30 ms 41784 KB Output is correct
4 Correct 32 ms 41784 KB Output is correct
5 Incorrect 31 ms 41784 KB Output isn't correct
6 Halted 0 ms 0 KB -