답안 #41370

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
41370 2018-02-17T05:52:53 Z fest Bali Sculptures (APIO15_sculpture) C++14
46 / 100
1000 ms 58796 KB
// fest
#include <bits/stdc++.h>	

#define pb push_back
#define F first
#define S second
#define y1 dasdasfasfas
#define x1 wqdadfasfasfas
#define All(c) c.begin(), c.end()
#define SZ(A) (int((A).size()))
#define umap unordered_map
#define FILENAME ""
#define __ fflush(stdout)

typedef long long ll;
typedef long double ld;    

using namespace std;

void FREOPEN() {
	#ifdef COMP
		freopen(".in", "r", stdin);
		freopen("1.out", "w", stdout);
	#else
		freopen(FILENAME".in", "r", stdin);
		freopen(FILENAME".out", "w", stdout);
	#endif
}                           

inline double Time() {return (clock() * 1.0) / CLOCKS_PER_SEC; }             

const int N = 101, inf = 1e9 * 2, MOD = (int)1e9 + 7;

char CH[N];

const ll INF = 1e18;

const int dx[] = {1, -1, 0, 0, -1, 1, -1, 1};
const int dy[] = {0, 0, 1, -1, -1, 1, 1, -1};

ll a[N];

map<ll, bool> dp[N][N];

int main() {
  
	int n, l, r;
	cin >> n >> l >> r;
	for (int i = 1; i <= n; i++) scanf("%lld ", a + i);
	dp[0][0][0] = 1;
	for (int i = 1; i <= n; i++) {
		for (int k = 1; k <= r; k++) {
			ll sum = a[i];
			for (int j = i - 1; j >= 0; j--) {
				for (auto m : dp[j][k - 1]) dp[i][k][(m.F | sum)] = 1;
				sum += a[j];	
			}
		}
	}
	ll ans = INF;
	for (int k = l; k <= r; k++) for (auto m : dp[n][k]) ans = min(ans, m.F);
	cout << ans;	
	return 0;	
}

Compilation message

sculpture.cpp: In function 'void FREOPEN()':
sculpture.cpp:25:37: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   freopen(FILENAME".in", "r", stdin);
                                     ^
sculpture.cpp:26:39: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   freopen(FILENAME".out", "w", stdout);
                                       ^
sculpture.cpp: In function 'int main()':
sculpture.cpp:49:52: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for (int i = 1; i <= n; i++) scanf("%lld ", a + i);
                                                    ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 760 KB Output is correct
2 Correct 2 ms 864 KB Output is correct
3 Correct 2 ms 864 KB Output is correct
4 Correct 2 ms 864 KB Output is correct
5 Correct 2 ms 916 KB Output is correct
6 Correct 2 ms 972 KB Output is correct
7 Correct 2 ms 972 KB Output is correct
8 Correct 2 ms 972 KB Output is correct
9 Correct 2 ms 972 KB Output is correct
10 Correct 2 ms 988 KB Output is correct
11 Correct 2 ms 988 KB Output is correct
12 Correct 2 ms 988 KB Output is correct
13 Correct 2 ms 1040 KB Output is correct
14 Correct 2 ms 1040 KB Output is correct
15 Correct 2 ms 1040 KB Output is correct
16 Correct 2 ms 1040 KB Output is correct
17 Correct 2 ms 1040 KB Output is correct
18 Correct 2 ms 1040 KB Output is correct
19 Correct 2 ms 1040 KB Output is correct
20 Correct 2 ms 1040 KB Output is correct
21 Correct 2 ms 1132 KB Output is correct
22 Correct 2 ms 1132 KB Output is correct
23 Correct 2 ms 1132 KB Output is correct
24 Correct 2 ms 1132 KB Output is correct
25 Correct 2 ms 1132 KB Output is correct
26 Correct 2 ms 1132 KB Output is correct
27 Correct 2 ms 1132 KB Output is correct
28 Correct 2 ms 1132 KB Output is correct
29 Correct 3 ms 1156 KB Output is correct
30 Correct 3 ms 1156 KB Output is correct
31 Correct 2 ms 1156 KB Output is correct
32 Correct 2 ms 1156 KB Output is correct
33 Correct 2 ms 1156 KB Output is correct
34 Correct 2 ms 1156 KB Output is correct
35 Correct 2 ms 1156 KB Output is correct
36 Correct 2 ms 1156 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1156 KB Output is correct
2 Correct 2 ms 1156 KB Output is correct
3 Correct 2 ms 1156 KB Output is correct
4 Correct 2 ms 1156 KB Output is correct
5 Correct 2 ms 1156 KB Output is correct
6 Correct 2 ms 1156 KB Output is correct
7 Correct 2 ms 1156 KB Output is correct
8 Correct 2 ms 1156 KB Output is correct
9 Correct 2 ms 1156 KB Output is correct
10 Correct 2 ms 1156 KB Output is correct
11 Correct 2 ms 1156 KB Output is correct
12 Correct 2 ms 1156 KB Output is correct
13 Correct 2 ms 1156 KB Output is correct
14 Correct 2 ms 1156 KB Output is correct
15 Correct 2 ms 1156 KB Output is correct
16 Correct 2 ms 1156 KB Output is correct
17 Correct 2 ms 1156 KB Output is correct
18 Correct 2 ms 1156 KB Output is correct
19 Correct 2 ms 1156 KB Output is correct
20 Correct 2 ms 1156 KB Output is correct
21 Correct 2 ms 1156 KB Output is correct
22 Correct 2 ms 1156 KB Output is correct
23 Correct 2 ms 1156 KB Output is correct
24 Correct 2 ms 1156 KB Output is correct
25 Correct 2 ms 1156 KB Output is correct
26 Correct 2 ms 1156 KB Output is correct
27 Correct 2 ms 1156 KB Output is correct
28 Correct 3 ms 1156 KB Output is correct
29 Correct 4 ms 1260 KB Output is correct
30 Correct 9 ms 1900 KB Output is correct
31 Correct 24 ms 2668 KB Output is correct
32 Correct 11 ms 2668 KB Output is correct
33 Correct 2 ms 2668 KB Output is correct
34 Correct 15 ms 2668 KB Output is correct
35 Correct 14 ms 2668 KB Output is correct
36 Correct 12 ms 2668 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2668 KB Output is correct
2 Correct 2 ms 2668 KB Output is correct
3 Correct 2 ms 2668 KB Output is correct
4 Correct 2 ms 2668 KB Output is correct
5 Correct 2 ms 2668 KB Output is correct
6 Correct 2 ms 2668 KB Output is correct
7 Correct 2 ms 2668 KB Output is correct
8 Correct 2 ms 2668 KB Output is correct
9 Correct 2 ms 2668 KB Output is correct
10 Correct 2 ms 2668 KB Output is correct
11 Correct 2 ms 2668 KB Output is correct
12 Correct 2 ms 2668 KB Output is correct
13 Correct 2 ms 2668 KB Output is correct
14 Correct 2 ms 2668 KB Output is correct
15 Correct 3 ms 2668 KB Output is correct
16 Correct 3 ms 2668 KB Output is correct
17 Correct 9 ms 2668 KB Output is correct
18 Correct 23 ms 2668 KB Output is correct
19 Correct 11 ms 2668 KB Output is correct
20 Correct 2 ms 2668 KB Output is correct
21 Correct 15 ms 2668 KB Output is correct
22 Correct 13 ms 2668 KB Output is correct
23 Correct 13 ms 2668 KB Output is correct
24 Correct 24 ms 2796 KB Output is correct
25 Correct 36 ms 3056 KB Output is correct
26 Correct 156 ms 7240 KB Output is correct
27 Correct 316 ms 11884 KB Output is correct
28 Correct 469 ms 15632 KB Output is correct
29 Correct 247 ms 15632 KB Output is correct
30 Correct 2 ms 15632 KB Output is correct
31 Correct 519 ms 17000 KB Output is correct
32 Correct 547 ms 17852 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 17852 KB Output is correct
2 Correct 2 ms 17852 KB Output is correct
3 Correct 2 ms 17852 KB Output is correct
4 Correct 2 ms 17852 KB Output is correct
5 Correct 2 ms 17852 KB Output is correct
6 Correct 2 ms 17852 KB Output is correct
7 Correct 2 ms 17852 KB Output is correct
8 Correct 2 ms 17852 KB Output is correct
9 Correct 2 ms 17852 KB Output is correct
10 Correct 2 ms 17852 KB Output is correct
11 Correct 2 ms 17852 KB Output is correct
12 Correct 2 ms 17852 KB Output is correct
13 Correct 2 ms 17852 KB Output is correct
14 Correct 2 ms 17852 KB Output is correct
15 Correct 2 ms 17852 KB Output is correct
16 Correct 2 ms 17852 KB Output is correct
17 Correct 2 ms 17852 KB Output is correct
18 Correct 2 ms 17852 KB Output is correct
19 Correct 2 ms 17852 KB Output is correct
20 Correct 2 ms 17852 KB Output is correct
21 Correct 2 ms 17852 KB Output is correct
22 Correct 2 ms 17852 KB Output is correct
23 Correct 2 ms 17852 KB Output is correct
24 Correct 2 ms 17852 KB Output is correct
25 Correct 2 ms 17852 KB Output is correct
26 Correct 2 ms 17852 KB Output is correct
27 Correct 2 ms 17852 KB Output is correct
28 Correct 2 ms 17852 KB Output is correct
29 Correct 2 ms 17852 KB Output is correct
30 Correct 2 ms 17852 KB Output is correct
31 Correct 2 ms 17852 KB Output is correct
32 Correct 2 ms 17852 KB Output is correct
33 Correct 2 ms 17852 KB Output is correct
34 Correct 2 ms 17852 KB Output is correct
35 Correct 2 ms 17852 KB Output is correct
36 Correct 2 ms 17852 KB Output is correct
37 Correct 2 ms 17852 KB Output is correct
38 Correct 3 ms 17852 KB Output is correct
39 Correct 4 ms 17852 KB Output is correct
40 Correct 9 ms 17852 KB Output is correct
41 Correct 21 ms 17852 KB Output is correct
42 Correct 11 ms 17852 KB Output is correct
43 Correct 2 ms 17852 KB Output is correct
44 Correct 14 ms 17852 KB Output is correct
45 Correct 16 ms 17852 KB Output is correct
46 Correct 11 ms 17852 KB Output is correct
47 Correct 26 ms 17852 KB Output is correct
48 Correct 36 ms 17852 KB Output is correct
49 Correct 124 ms 17852 KB Output is correct
50 Correct 253 ms 17852 KB Output is correct
51 Correct 487 ms 17852 KB Output is correct
52 Correct 226 ms 17852 KB Output is correct
53 Correct 2 ms 17852 KB Output is correct
54 Correct 446 ms 17852 KB Output is correct
55 Correct 504 ms 17904 KB Output is correct
56 Correct 848 ms 47916 KB Output is correct
57 Execution timed out 1085 ms 58796 KB Time limit exceeded
58 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 58796 KB Output is correct
2 Correct 2 ms 58796 KB Output is correct
3 Correct 2 ms 58796 KB Output is correct
4 Correct 2 ms 58796 KB Output is correct
5 Correct 2 ms 58796 KB Output is correct
6 Correct 2 ms 58796 KB Output is correct
7 Correct 2 ms 58796 KB Output is correct
8 Correct 2 ms 58796 KB Output is correct
9 Correct 2 ms 58796 KB Output is correct
10 Correct 2 ms 58796 KB Output is correct
11 Correct 3 ms 58796 KB Output is correct
12 Correct 2 ms 58796 KB Output is correct
13 Correct 3 ms 58796 KB Output is correct
14 Correct 2 ms 58796 KB Output is correct
15 Correct 2 ms 58796 KB Output is correct
16 Correct 2 ms 58796 KB Output is correct
17 Correct 2 ms 58796 KB Output is correct
18 Correct 2 ms 58796 KB Output is correct
19 Correct 2 ms 58796 KB Output is correct
20 Correct 2 ms 58796 KB Output is correct
21 Correct 2 ms 58796 KB Output is correct
22 Correct 2 ms 58796 KB Output is correct
23 Correct 2 ms 58796 KB Output is correct
24 Correct 3 ms 58796 KB Output is correct
25 Correct 3 ms 58796 KB Output is correct
26 Correct 3 ms 58796 KB Output is correct
27 Correct 8 ms 58796 KB Output is correct
28 Correct 21 ms 58796 KB Output is correct
29 Correct 11 ms 58796 KB Output is correct
30 Correct 2 ms 58796 KB Output is correct
31 Correct 14 ms 58796 KB Output is correct
32 Correct 14 ms 58796 KB Output is correct
33 Correct 12 ms 58796 KB Output is correct
34 Correct 25 ms 58796 KB Output is correct
35 Correct 37 ms 58796 KB Output is correct
36 Correct 127 ms 58796 KB Output is correct
37 Correct 261 ms 58796 KB Output is correct
38 Correct 397 ms 58796 KB Output is correct
39 Correct 227 ms 58796 KB Output is correct
40 Correct 2 ms 58796 KB Output is correct
41 Correct 447 ms 58796 KB Output is correct
42 Correct 478 ms 58796 KB Output is correct
43 Correct 848 ms 58796 KB Output is correct
44 Execution timed out 1061 ms 58796 KB Time limit exceeded
45 Halted 0 ms 0 KB -