제출 #41399

#제출 시각아이디문제언어결과실행 시간메모리
41399festBali Sculptures (APIO15_sculpture)C++14
50 / 100
91 ms752 KiB
// 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("2.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 = 2001, inf = 1e9 * 2, MOD = (int)1e9 + 7, M = 42;

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];               

int dp[N];

int main() {
  
	int n, l, r;
	cin >> n >> l >> r;
	for (int i = 1; i <= n; i++) scanf("%lld ", a + i);
	ll ans = 0;
	ll no = 0;
	for (int bit = M - 1; bit >= 0; bit--) {
		ll now = (ans | (1ll << bit));
		now--;
		no |= (1ll << bit);
		for (int i = 1; i <= n; i++) dp[i] = inf;
		for (int i = 1; i <= n; i++) {
			ll sum = a[i];
			for (int j = i - 1; j >= 0; j--) {
				if (sum & no) {
					sum += a[j];
					continue;
				}
				if (sum > now) break;
				dp[i] = min(dp[i], dp[j] + 1);	
				sum += a[j];
			}
		}
		no ^= (1ll << bit);
		if (dp[n] <= r) no |= (1ll << bit);
		else ans |= (1ll << bit);
	}
	cout << ans;
	return 0;	
}

컴파일 시 표준 에러 (stderr) 메시지

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);
                                                    ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...