Submission #170823

# Submission time Handle Problem Language Result Execution time Memory
170823 2019-12-26T12:53:01 Z Nightmar Bali Sculptures (APIO15_sculpture) C++17
46 / 100
770 ms 262148 KB
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstdlib>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <iomanip>
 
#define SWS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb push_back
#define ppb pop_back
#define ft first
#define sd second
#define read freopen("input.txt", "r", stdin)
#define write freopen("output.txt", "w", stdout)
#define files read; write
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pii;
 
const int Z = (int)2e3 + 228;
const int N = (int)3e5 + 228;
const int INF = (int)1e9 + 228;
const int MOD = (int)1e9 + 7;
const ll LLINF = (ll)1e15 + 228;

ll a[Z], pref[Z];
set<ll> dp[Z][Z];

int main()
{
	SWS;
	//files;
	int n, l, r;
	cin >> n >> l >> r;
	for (int i = 1; i <= n; i++) 
	{
		cin >> a[i];
		pref[i] = pref[i - 1] + a[i];
	}
	dp[0][0].insert(0);
	for (int team = 1; team < l; team++)
		for (int i = team; i <= n; i++)
			for (int j = team - 1; j < i; j++) 
				for (auto it : dp[team - 1][j])
				{ 
					ll x = it | (pref[i] - pref[j]);
					dp[team][i].insert(x);
				}
	ll ans = LLINF;
	for (int team = l; team <= r; team++)
	{
		for (int i = team; i <= n; i++)
			for (int j = team - 1; j < i; j++)
				for (auto it : dp[team - 1][j])
				{
					ll x = it | (pref[i] - pref[j]);
					dp[team][i].insert(x);	
					if (i == n) ans = min(ans, x);
				}
	}
	cout << ans;
	return 0;
}
/*
6 1 3
8 1 2 1 5 4
*/
# Verdict Execution time Memory Grader output
1 Correct 234 ms 233548 KB Output is correct
2 Correct 218 ms 233632 KB Output is correct
3 Correct 257 ms 233592 KB Output is correct
4 Correct 221 ms 233464 KB Output is correct
5 Correct 242 ms 233596 KB Output is correct
6 Correct 218 ms 233468 KB Output is correct
7 Correct 217 ms 233556 KB Output is correct
8 Correct 216 ms 233464 KB Output is correct
9 Correct 256 ms 233492 KB Output is correct
10 Correct 252 ms 233600 KB Output is correct
11 Correct 215 ms 233464 KB Output is correct
12 Correct 216 ms 233428 KB Output is correct
13 Correct 216 ms 233780 KB Output is correct
14 Correct 214 ms 233464 KB Output is correct
15 Correct 216 ms 233572 KB Output is correct
16 Correct 214 ms 233552 KB Output is correct
17 Correct 217 ms 233432 KB Output is correct
18 Correct 214 ms 233592 KB Output is correct
19 Correct 226 ms 233552 KB Output is correct
20 Correct 218 ms 233592 KB Output is correct
21 Correct 231 ms 233468 KB Output is correct
22 Correct 238 ms 233568 KB Output is correct
23 Correct 258 ms 233612 KB Output is correct
24 Correct 221 ms 233564 KB Output is correct
25 Correct 220 ms 233464 KB Output is correct
26 Correct 222 ms 233592 KB Output is correct
27 Correct 217 ms 233560 KB Output is correct
28 Correct 215 ms 233544 KB Output is correct
29 Correct 219 ms 233612 KB Output is correct
30 Correct 216 ms 233720 KB Output is correct
31 Correct 216 ms 233556 KB Output is correct
32 Correct 224 ms 233564 KB Output is correct
33 Correct 222 ms 233520 KB Output is correct
34 Correct 214 ms 233464 KB Output is correct
35 Correct 248 ms 233512 KB Output is correct
36 Correct 225 ms 233464 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 217 ms 233464 KB Output is correct
2 Correct 217 ms 233600 KB Output is correct
3 Correct 239 ms 233564 KB Output is correct
4 Correct 216 ms 233536 KB Output is correct
5 Correct 237 ms 233436 KB Output is correct
6 Correct 214 ms 233464 KB Output is correct
7 Correct 214 ms 233520 KB Output is correct
8 Correct 216 ms 233464 KB Output is correct
9 Correct 217 ms 233464 KB Output is correct
10 Correct 222 ms 233600 KB Output is correct
11 Correct 218 ms 233604 KB Output is correct
12 Correct 219 ms 233468 KB Output is correct
13 Correct 249 ms 233716 KB Output is correct
14 Correct 216 ms 233464 KB Output is correct
15 Correct 221 ms 233516 KB Output is correct
16 Correct 218 ms 233592 KB Output is correct
17 Correct 250 ms 233400 KB Output is correct
18 Correct 217 ms 233464 KB Output is correct
19 Correct 216 ms 233472 KB Output is correct
20 Correct 216 ms 233540 KB Output is correct
21 Correct 217 ms 233564 KB Output is correct
22 Correct 216 ms 233500 KB Output is correct
23 Correct 233 ms 233468 KB Output is correct
24 Correct 217 ms 233436 KB Output is correct
25 Correct 217 ms 233752 KB Output is correct
26 Correct 219 ms 233592 KB Output is correct
27 Correct 218 ms 233624 KB Output is correct
28 Correct 216 ms 233720 KB Output is correct
29 Correct 216 ms 233592 KB Output is correct
30 Correct 223 ms 234104 KB Output is correct
31 Correct 236 ms 234744 KB Output is correct
32 Correct 265 ms 234076 KB Output is correct
33 Correct 256 ms 233572 KB Output is correct
34 Correct 236 ms 234232 KB Output is correct
35 Correct 231 ms 234256 KB Output is correct
36 Correct 227 ms 234244 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 245 ms 233516 KB Output is correct
2 Correct 232 ms 233464 KB Output is correct
3 Correct 222 ms 233484 KB Output is correct
4 Correct 214 ms 233464 KB Output is correct
5 Correct 215 ms 233476 KB Output is correct
6 Correct 230 ms 233596 KB Output is correct
7 Correct 215 ms 233464 KB Output is correct
8 Correct 219 ms 233488 KB Output is correct
9 Correct 217 ms 233464 KB Output is correct
10 Correct 216 ms 233484 KB Output is correct
11 Correct 216 ms 233496 KB Output is correct
12 Correct 225 ms 233540 KB Output is correct
13 Correct 216 ms 233604 KB Output is correct
14 Correct 218 ms 233572 KB Output is correct
15 Correct 217 ms 233720 KB Output is correct
16 Correct 256 ms 233540 KB Output is correct
17 Correct 235 ms 234188 KB Output is correct
18 Correct 280 ms 234616 KB Output is correct
19 Correct 249 ms 234204 KB Output is correct
20 Correct 223 ms 233492 KB Output is correct
21 Correct 230 ms 234360 KB Output is correct
22 Correct 228 ms 234232 KB Output is correct
23 Correct 236 ms 234108 KB Output is correct
24 Correct 238 ms 234872 KB Output is correct
25 Correct 252 ms 235000 KB Output is correct
26 Correct 368 ms 238112 KB Output is correct
27 Correct 450 ms 241656 KB Output is correct
28 Correct 598 ms 244488 KB Output is correct
29 Correct 477 ms 240968 KB Output is correct
30 Correct 215 ms 233464 KB Output is correct
31 Correct 618 ms 245468 KB Output is correct
32 Correct 637 ms 246152 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 241 ms 233536 KB Output is correct
2 Correct 220 ms 233436 KB Output is correct
3 Correct 214 ms 233468 KB Output is correct
4 Correct 216 ms 233496 KB Output is correct
5 Correct 218 ms 233564 KB Output is correct
6 Correct 214 ms 233548 KB Output is correct
7 Correct 221 ms 233464 KB Output is correct
8 Correct 219 ms 233484 KB Output is correct
9 Correct 217 ms 233604 KB Output is correct
10 Correct 215 ms 233464 KB Output is correct
11 Correct 218 ms 233672 KB Output is correct
12 Correct 216 ms 233468 KB Output is correct
13 Correct 216 ms 233596 KB Output is correct
14 Correct 220 ms 233600 KB Output is correct
15 Correct 215 ms 233464 KB Output is correct
16 Correct 216 ms 233672 KB Output is correct
17 Correct 224 ms 233464 KB Output is correct
18 Correct 215 ms 233720 KB Output is correct
19 Correct 217 ms 233592 KB Output is correct
20 Correct 217 ms 233464 KB Output is correct
21 Correct 218 ms 233512 KB Output is correct
22 Correct 219 ms 233472 KB Output is correct
23 Correct 216 ms 233520 KB Output is correct
24 Correct 217 ms 233460 KB Output is correct
25 Correct 221 ms 233592 KB Output is correct
26 Correct 235 ms 233720 KB Output is correct
27 Correct 217 ms 233464 KB Output is correct
28 Correct 217 ms 233488 KB Output is correct
29 Correct 223 ms 233592 KB Output is correct
30 Correct 269 ms 233564 KB Output is correct
31 Correct 255 ms 233612 KB Output is correct
32 Correct 216 ms 233464 KB Output is correct
33 Correct 216 ms 233592 KB Output is correct
34 Correct 228 ms 233588 KB Output is correct
35 Correct 215 ms 233464 KB Output is correct
36 Correct 254 ms 233612 KB Output is correct
37 Correct 244 ms 233824 KB Output is correct
38 Correct 219 ms 233564 KB Output is correct
39 Correct 221 ms 233600 KB Output is correct
40 Correct 226 ms 233976 KB Output is correct
41 Correct 238 ms 234616 KB Output is correct
42 Correct 227 ms 234232 KB Output is correct
43 Correct 217 ms 233464 KB Output is correct
44 Correct 270 ms 234312 KB Output is correct
45 Correct 241 ms 234256 KB Output is correct
46 Correct 266 ms 234232 KB Output is correct
47 Correct 383 ms 234776 KB Output is correct
48 Correct 297 ms 235044 KB Output is correct
49 Correct 353 ms 238144 KB Output is correct
50 Correct 467 ms 241712 KB Output is correct
51 Correct 573 ms 244536 KB Output is correct
52 Correct 431 ms 241016 KB Output is correct
53 Correct 216 ms 233572 KB Output is correct
54 Correct 617 ms 245548 KB Output is correct
55 Correct 637 ms 246172 KB Output is correct
56 Runtime error 770 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
57 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 215 ms 233464 KB Output is correct
2 Correct 227 ms 233516 KB Output is correct
3 Correct 219 ms 233548 KB Output is correct
4 Correct 217 ms 233564 KB Output is correct
5 Correct 219 ms 233604 KB Output is correct
6 Correct 223 ms 233696 KB Output is correct
7 Correct 218 ms 233476 KB Output is correct
8 Correct 227 ms 233464 KB Output is correct
9 Correct 232 ms 233608 KB Output is correct
10 Correct 215 ms 233464 KB Output is correct
11 Correct 214 ms 233464 KB Output is correct
12 Correct 218 ms 233588 KB Output is correct
13 Correct 215 ms 233592 KB Output is correct
14 Correct 217 ms 233480 KB Output is correct
15 Correct 216 ms 233720 KB Output is correct
16 Correct 217 ms 233720 KB Output is correct
17 Correct 219 ms 233720 KB Output is correct
18 Correct 205 ms 233528 KB Output is correct
19 Correct 216 ms 233604 KB Output is correct
20 Correct 219 ms 233692 KB Output is correct
21 Correct 215 ms 233564 KB Output is correct
22 Correct 216 ms 233572 KB Output is correct
23 Correct 219 ms 233592 KB Output is correct
24 Correct 221 ms 233592 KB Output is correct
25 Correct 216 ms 233704 KB Output is correct
26 Correct 223 ms 233712 KB Output is correct
27 Correct 223 ms 234156 KB Output is correct
28 Correct 237 ms 234616 KB Output is correct
29 Correct 225 ms 234176 KB Output is correct
30 Correct 217 ms 233592 KB Output is correct
31 Correct 232 ms 234416 KB Output is correct
32 Correct 229 ms 234316 KB Output is correct
33 Correct 227 ms 234104 KB Output is correct
34 Correct 254 ms 234896 KB Output is correct
35 Correct 263 ms 235220 KB Output is correct
36 Correct 348 ms 238012 KB Output is correct
37 Correct 462 ms 241592 KB Output is correct
38 Correct 563 ms 244628 KB Output is correct
39 Correct 429 ms 240784 KB Output is correct
40 Correct 225 ms 233464 KB Output is correct
41 Correct 616 ms 245564 KB Output is correct
42 Correct 637 ms 246116 KB Output is correct
43 Runtime error 753 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
44 Halted 0 ms 0 KB -