Submission #1165390

#TimeUsernameProblemLanguageResultExecution timeMemory
1165390mysticmage45Bali Sculptures (APIO15_sculpture)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long const ll bitsize = 40; // Increased bit size int main(){ ios_base::sync_with_stdio(0); cin.tie(0); ll n, a, b; cin >> n >> a >> b; ll year[n+5]; for(ll i = 1; i <= n; i++){ cin >> year[i]; } ll sumyear[n+5][n+5]; for(ll l = 1; l <= n; ++l){ ll sumnow = 0; for(ll r = l; r <= n; ++r){ sumnow += year[r]; sumyear[l][r] = sumnow; } } ll ans = 0; for(ll digit = bitsize; digit >= 0; digit--){ if(a == 1){ // Case when a == 1 ll dp[n+5]; for(ll i = 0; i <= n; i++) dp[i] = 1e18; dp[0] = 0; for(ll i = 0; i <= n; i++){ for(ll j = i+1; j <= n; j++){ ll thissum = sumyear[i+1][j]; bool pass = true; // Check if higher bits are compatible with ans for(ll k = digit+1; k <= bitsize; k++){ if(((thissum >> k) & 1) && !((ans >> k) & 1)){ pass = false; break; } } // Check if the current bit can be 0 if((thissum >> digit) & 1){ pass = false; } if(pass){ dp[j] = min(dp[j], dp[i] + 1); } } } // If no valid partition exists, set this

Compilation message (stderr)

sculpture.cpp: In function 'int main()':
sculpture.cpp:58:14: error: expected '}' at end of input
   58 |             }
      |              ^
sculpture.cpp:30:19: note: to match this '{'
   30 |         if(a == 1){
      |                   ^
sculpture.cpp:58:14: error: expected '}' at end of input
   58 |             }
      |              ^
sculpture.cpp:29:49: note: to match this '{'
   29 |     for(ll digit = bitsize; digit >= 0; digit--){
      |                                                 ^
sculpture.cpp:58:14: error: expected '}' at end of input
   58 |             }
      |              ^
sculpture.cpp:7:11: note: to match this '{'
    7 | int main(){
      |           ^