Submission #54070

# Submission time Handle Problem Language Result Execution time Memory
54070 2018-07-02T09:39:13 Z Mahmoud_Adel Bali Sculptures (APIO15_sculpture) C++14
0 / 100
3 ms 860 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;
//========================================
ll n, l, r, mx, sum[101], a[2001], dp[101][101], ans;
ll h = (1LL << 6) - 1;
bool sol(ll T)
{
	clr(dp, 0);
	dp[0][0] = 1;
	for(int j=1; j<=r; j++)
 	{
		for(int i=1; i<=n; i++)
		{
			ll tmp = 0;
			for(int k=0; k<=i; k++)
   			{
				ll enc = sum[i] - tmp;
				enc ^= h;
				bitset<6> b(enc&T);
				bitset<6> c(T);
				//cout << sum[i] << " " << tmp << " " << b << " " << c << endl;
				//cout << sum << " " << tmp << endl;
				if(dp[k][j-1] && (enc & T) == T)
				dp[i][j] = 1;
				tmp += a[k];
			}
		}
	}
	for(int j=l; j<=r; j++)
	{
		if(dp[n][j])
		return 1;
	}
	return 0;
}
int main()
{
	opt;
	cin >> n >> l >> r;
	for(int i=0; i<n; i++)
	cin >> a[i], sum[i+1] = sum[i] + a[i];
	for(int i=5; i>=0; i--)
	{
		if(sol((ans | (1LL << i))))
		ans |= (1LL << i);
	}
	cout << (ans^h) << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Correct 2 ms 780 KB Output is correct
4 Correct 2 ms 780 KB Output is correct
5 Correct 2 ms 780 KB Output is correct
6 Correct 2 ms 780 KB Output is correct
7 Incorrect 3 ms 780 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 780 KB Output is correct
2 Correct 2 ms 780 KB Output is correct
3 Correct 3 ms 780 KB Output is correct
4 Correct 2 ms 780 KB Output is correct
5 Correct 2 ms 780 KB Output is correct
6 Correct 2 ms 780 KB Output is correct
7 Incorrect 2 ms 780 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 804 KB Output is correct
2 Correct 2 ms 804 KB Output is correct
3 Correct 2 ms 804 KB Output is correct
4 Correct 2 ms 804 KB Output is correct
5 Correct 3 ms 804 KB Output is correct
6 Correct 3 ms 804 KB Output is correct
7 Incorrect 2 ms 804 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 804 KB Output is correct
2 Correct 2 ms 804 KB Output is correct
3 Correct 2 ms 804 KB Output is correct
4 Correct 2 ms 804 KB Output is correct
5 Correct 2 ms 804 KB Output is correct
6 Correct 2 ms 804 KB Output is correct
7 Incorrect 2 ms 804 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 804 KB Output is correct
2 Correct 2 ms 804 KB Output is correct
3 Correct 2 ms 804 KB Output is correct
4 Correct 2 ms 804 KB Output is correct
5 Correct 2 ms 804 KB Output is correct
6 Correct 3 ms 860 KB Output is correct
7 Incorrect 2 ms 860 KB Output isn't correct
8 Halted 0 ms 0 KB -