Submission #528704

# Submission time Handle Problem Language Result Execution time Memory
528704 2022-02-21T06:46:51 Z manizare Bali Sculptures (APIO15_sculpture) C++14
0 / 100
1 ms 220 KB
#include <bits/stdc++.h>   
#define all(a) a.begin() , a.end()
#define pb push_back
#define int long long
using namespace std;
const int maxn =2e6+10 , maxq = 1e7  , sq = sqrt(1e9) , N = 1e5 , lg = 20 , mod = 1e9+7 ;
int c[maxn] , dp[maxn];

signed main(){
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);	
	int n , a , b;
	cin >> n >> a >> b ;
	if(a!=1)return 0 ;
	for(int i = 1 ; i<= n ; i++){
		cin >> c[i] ;
	}
	int ans = (1<<36) - 1;
	for(int i = 36 ; i >= 0 ; i--){
		ans^=(1<<i);
		for(int i = 1 ; i <= n ; i++){
			dp[i] = 1e9 ;
		}
		dp[0] = 0 ;
		for(int j =1 ;j <= n ; j ++){
			int s = 0 ;
			for(int k = j ; k >= 1 ; k--){
				s+=c[k];
				if((ans&s) == s){
					dp[j] = min(dp[j] , dp[k-1] + 1);
				}
			}
		}
		if(dp[n] > b){
			ans^=(1<<i);
		}
	}
	cout << ans << "\n";
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:17:14: warning: left shift count >= width of type [-Wshift-count-overflow]
   17 |  int ans = (1<<36) - 1;
      |             ~^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 220 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -