Submission #33722

#TimeUsernameProblemLanguageResultExecution timeMemory
33722sinhrivBali Sculptures (APIO15_sculpture)C++14
0 / 100
0 ms33916 KiB
#include <bits/stdc++.h> using namespace std; const int N = 2020; int n, a, b; int arr[N]; long long sum[N]; long long f[N][N]; int main(){ if(fopen("1.inp", "r")){ freopen("1.inp", "r", stdin); } cin >> n >> a >> b; for(int i = 1; i <= n; ++i){ cin >> arr[i]; sum[i] = arr[i] + sum[i - 1]; f[i][1] = sum[i]; } for(int i = 2; i <= n; ++i){ for(int j = 2; j <= i; ++j){ f[i][j] = sum[i]; for(int k = i - 1; k >= j - 1; --k){ f[i][j] = min(f[i][j], f[k][j - 1] | (sum[i] - sum[k])); } } } long long ans = sum[n]; for(int i = a; i <= b; ++i){ ans = min(ans, f[n][i]); } cout << ans; return 0; }

Compilation message (stderr)

sculpture.cpp: In function 'int main()':
sculpture.cpp:17:31: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   freopen("1.inp", "r", stdin);
                               ^
#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...