Submission #1085491

#TimeUsernameProblemLanguageResultExecution timeMemory
1085491minggaBali Sculptures (APIO15_sculpture)C++17
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" using namespace std; #define ln "\n" #define dbg(x) cout << #x << " = " << x << ln #define mp make_pair #define pb push_back #define fi first #define se second #define inf 2e18 #define fast_cin() \ ios_base::sync_with_stdio(false); \ cin.tie(NULL) #define out(file) freopen(file, "w", stdout) #define in(file) freopen(file, "r", stdin) #define all(x) (x).begin(), (x).end() #define sz(x) ((int)(x).size()) // #define int long long int MOD = 1e9 + 7; const int N = 2001; int y[N], a, b, n; ll ps[N], dp[N][N]; void sub1() { ll ans = inf; for(int mask = 0; mask < (1 << n); mask++) { if(((mask >> (n-1)) & 1) == 0) continue; int cnt = __builtin_popcount(mask); if(cnt < a or cnt > b) continue; ll s = 0; ll cur = 0; // cerr << "CNT " << cnt << ln; for(int i = 0; i < n; i++) { s += y[i+1]; if((mask >> i) & 1) { cur |= s; // cerr << s << ' '; s = 0; } } // cerr << ln; ans = min(ans, cur); } cout << ans; } signed main() { fast_cin(); cin >> n >> a >> b; for(int i = 1; i <= n; i++) cin >> y[i], ps[i] = ps[i-1] + y[i]; if(n <= 20) sub1(); cerr << "\nTime: " << clock() * 1000 / CLOCKS_PER_SEC; }

Compilation message (stderr)

sculpture.cpp:23:1: error: 'll' does not name a type; did you mean 'ln'?
   23 | ll ps[N], dp[N][N];
      | ^~
      | ln
sculpture.cpp: In function 'void sub1()':
sculpture.cpp:26:3: error: 'll' was not declared in this scope; did you mean 'ln'?
   26 |   ll ans = inf;
      |   ^~
      |   ln
sculpture.cpp:31:7: error: expected ';' before 's'
   31 |     ll s = 0;
      |       ^~
      |       ;
sculpture.cpp:32:7: error: expected ';' before 'cur'
   32 |     ll cur = 0;
      |       ^~~~
      |       ;
sculpture.cpp:35:7: error: 's' was not declared in this scope
   35 |       s += y[i+1];
      |       ^
sculpture.cpp:37:9: error: 'cur' was not declared in this scope
   37 |         cur |= s;
      |         ^~~
sculpture.cpp:43:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   43 |     ans = min(ans, cur);
      |     ^~~
      |     abs
sculpture.cpp:43:20: error: 'cur' was not declared in this scope
   43 |     ans = min(ans, cur);
      |                    ^~~
sculpture.cpp:45:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   45 |   cout << ans;
      |           ^~~
      |           abs
sculpture.cpp: In function 'int main()':
sculpture.cpp:51:46: error: 'ps' was not declared in this scope; did you mean 'pb'?
   51 |     for(int i = 1; i <= n; i++) cin >> y[i], ps[i] = ps[i-1] + y[i];
      |                                              ^~
      |                                              pb