답안 #54079

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
54079 2018-07-02T09:47:32 Z Mahmoud_Adel Bali Sculptures (APIO15_sculpture) C++14
21 / 100
1000 ms 32124 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, sum[2001], a[2001], dp[2001][2001], ans;
ll h = (1LL << 60) - 1;
bool sol(ll T)
{
	clr(dp, 0);
	dp[0][0] = 1;
	for(int j=1; j<=r; j++)
 	{
		for(int i=j; i<=n; i++)
		{
			ll tmp = 0;
			for(int k=0; k<=i; k++)
   			{
				ll enc = sum[i] - tmp;
				enc ^= h;
				//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=60; i>=0; i--)
	{
		if(sol((ans | (1LL << i))))
		ans |= (1LL << i);
	}
	cout << (ans^h) << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 422 ms 31736 KB Output is correct
2 Correct 413 ms 31736 KB Output is correct
3 Correct 430 ms 31860 KB Output is correct
4 Correct 454 ms 31896 KB Output is correct
5 Correct 426 ms 31952 KB Output is correct
6 Correct 410 ms 31952 KB Output is correct
7 Correct 431 ms 31952 KB Output is correct
8 Correct 413 ms 31952 KB Output is correct
9 Correct 421 ms 31952 KB Output is correct
10 Correct 409 ms 31952 KB Output is correct
11 Correct 413 ms 31952 KB Output is correct
12 Correct 410 ms 31952 KB Output is correct
13 Correct 434 ms 31952 KB Output is correct
14 Correct 436 ms 32056 KB Output is correct
15 Incorrect 401 ms 32056 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 473 ms 32056 KB Output is correct
2 Correct 432 ms 32056 KB Output is correct
3 Correct 420 ms 32056 KB Output is correct
4 Correct 415 ms 32056 KB Output is correct
5 Correct 428 ms 32056 KB Output is correct
6 Correct 434 ms 32056 KB Output is correct
7 Correct 412 ms 32056 KB Output is correct
8 Correct 436 ms 32056 KB Output is correct
9 Correct 452 ms 32056 KB Output is correct
10 Correct 421 ms 32056 KB Output is correct
11 Correct 421 ms 32056 KB Output is correct
12 Correct 447 ms 32060 KB Output is correct
13 Correct 425 ms 32060 KB Output is correct
14 Correct 456 ms 32060 KB Output is correct
15 Incorrect 451 ms 32060 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 483 ms 32124 KB Output is correct
2 Correct 441 ms 32124 KB Output is correct
3 Correct 419 ms 32124 KB Output is correct
4 Correct 420 ms 32124 KB Output is correct
5 Correct 427 ms 32124 KB Output is correct
6 Correct 445 ms 32124 KB Output is correct
7 Correct 441 ms 32124 KB Output is correct
8 Correct 415 ms 32124 KB Output is correct
9 Correct 420 ms 32124 KB Output is correct
10 Correct 440 ms 32124 KB Output is correct
11 Correct 422 ms 32124 KB Output is correct
12 Correct 425 ms 32124 KB Output is correct
13 Correct 441 ms 32124 KB Output is correct
14 Correct 450 ms 32124 KB Output is correct
15 Correct 413 ms 32124 KB Output is correct
16 Correct 437 ms 32124 KB Output is correct
17 Correct 467 ms 32124 KB Output is correct
18 Correct 428 ms 32124 KB Output is correct
19 Correct 424 ms 32124 KB Output is correct
20 Correct 454 ms 32124 KB Output is correct
21 Correct 452 ms 32124 KB Output is correct
22 Correct 476 ms 32124 KB Output is correct
23 Correct 478 ms 32124 KB Output is correct
24 Correct 493 ms 32124 KB Output is correct
25 Correct 505 ms 32124 KB Output is correct
26 Correct 488 ms 32124 KB Output is correct
27 Correct 510 ms 32124 KB Output is correct
28 Correct 537 ms 32124 KB Output is correct
29 Correct 516 ms 32124 KB Output is correct
30 Correct 502 ms 32124 KB Output is correct
31 Correct 495 ms 32124 KB Output is correct
32 Correct 526 ms 32124 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 469 ms 32124 KB Output is correct
2 Correct 472 ms 32124 KB Output is correct
3 Correct 418 ms 32124 KB Output is correct
4 Correct 419 ms 32124 KB Output is correct
5 Correct 420 ms 32124 KB Output is correct
6 Correct 403 ms 32124 KB Output is correct
7 Correct 420 ms 32124 KB Output is correct
8 Correct 446 ms 32124 KB Output is correct
9 Correct 386 ms 32124 KB Output is correct
10 Correct 388 ms 32124 KB Output is correct
11 Correct 409 ms 32124 KB Output is correct
12 Correct 459 ms 32124 KB Output is correct
13 Correct 395 ms 32124 KB Output is correct
14 Correct 451 ms 32124 KB Output is correct
15 Incorrect 383 ms 32124 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 406 ms 32124 KB Output is correct
2 Correct 421 ms 32124 KB Output is correct
3 Correct 407 ms 32124 KB Output is correct
4 Correct 470 ms 32124 KB Output is correct
5 Correct 486 ms 32124 KB Output is correct
6 Correct 430 ms 32124 KB Output is correct
7 Correct 427 ms 32124 KB Output is correct
8 Correct 453 ms 32124 KB Output is correct
9 Correct 436 ms 32124 KB Output is correct
10 Correct 448 ms 32124 KB Output is correct
11 Correct 432 ms 32124 KB Output is correct
12 Correct 433 ms 32124 KB Output is correct
13 Correct 464 ms 32124 KB Output is correct
14 Correct 444 ms 32124 KB Output is correct
15 Correct 453 ms 32124 KB Output is correct
16 Correct 433 ms 32124 KB Output is correct
17 Correct 450 ms 32124 KB Output is correct
18 Correct 457 ms 32124 KB Output is correct
19 Correct 479 ms 32124 KB Output is correct
20 Correct 439 ms 32124 KB Output is correct
21 Correct 468 ms 32124 KB Output is correct
22 Correct 435 ms 32124 KB Output is correct
23 Correct 429 ms 32124 KB Output is correct
24 Correct 423 ms 32124 KB Output is correct
25 Correct 417 ms 32124 KB Output is correct
26 Correct 454 ms 32124 KB Output is correct
27 Correct 450 ms 32124 KB Output is correct
28 Correct 450 ms 32124 KB Output is correct
29 Correct 446 ms 32124 KB Output is correct
30 Correct 447 ms 32124 KB Output is correct
31 Correct 458 ms 32124 KB Output is correct
32 Correct 444 ms 32124 KB Output is correct
33 Correct 446 ms 32124 KB Output is correct
34 Correct 407 ms 32124 KB Output is correct
35 Correct 440 ms 32124 KB Output is correct
36 Correct 475 ms 32124 KB Output is correct
37 Correct 470 ms 32124 KB Output is correct
38 Correct 491 ms 32124 KB Output is correct
39 Correct 472 ms 32124 KB Output is correct
40 Correct 494 ms 32124 KB Output is correct
41 Correct 510 ms 32124 KB Output is correct
42 Correct 475 ms 32124 KB Output is correct
43 Correct 454 ms 32124 KB Output is correct
44 Correct 470 ms 32124 KB Output is correct
45 Correct 478 ms 32124 KB Output is correct
46 Correct 524 ms 32124 KB Output is correct
47 Correct 478 ms 32124 KB Output is correct
48 Correct 451 ms 32124 KB Output is correct
49 Correct 480 ms 32124 KB Output is correct
50 Correct 491 ms 32124 KB Output is correct
51 Correct 455 ms 32124 KB Output is correct
52 Execution timed out 1074 ms 32124 KB Time limit exceeded
53 Halted 0 ms 0 KB -