답안 #41375

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
41375 2018-02-17T05:57:15 Z fest Bali Sculptures (APIO15_sculpture) C++14
0 / 100
2 ms 1108 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 = max(l, r - 1); 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 936 KB Output is correct
4 Correct 2 ms 1008 KB Output is correct
5 Correct 2 ms 1008 KB Output is correct
6 Incorrect 2 ms 1072 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1072 KB Output is correct
2 Correct 2 ms 1072 KB Output is correct
3 Correct 2 ms 1072 KB Output is correct
4 Correct 2 ms 1072 KB Output is correct
5 Correct 2 ms 1072 KB Output is correct
6 Incorrect 2 ms 1072 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1072 KB Output is correct
2 Correct 2 ms 1072 KB Output is correct
3 Correct 2 ms 1072 KB Output is correct
4 Correct 2 ms 1072 KB Output is correct
5 Correct 2 ms 1072 KB Output is correct
6 Incorrect 2 ms 1108 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1108 KB Output is correct
2 Correct 2 ms 1108 KB Output is correct
3 Correct 2 ms 1108 KB Output is correct
4 Correct 2 ms 1108 KB Output is correct
5 Correct 2 ms 1108 KB Output is correct
6 Incorrect 2 ms 1108 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1108 KB Output is correct
2 Correct 2 ms 1108 KB Output is correct
3 Correct 2 ms 1108 KB Output is correct
4 Correct 2 ms 1108 KB Output is correct
5 Correct 2 ms 1108 KB Output is correct
6 Incorrect 2 ms 1108 KB Output isn't correct
7 Halted 0 ms 0 KB -