Submission #297489

#TimeUsernameProblemLanguageResultExecution timeMemory
297489AaronNaiduBali Sculptures (APIO15_sculpture)C++14
9 / 100
1083 ms504 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll n, a, b; ll y[2001]; ll prefSums[2001]; ll minAns = 1000000000000; void makeSubset(int x, vector<int> v) { if (x == n-1) { v.push_back(n-1); if (a <= v.size() and v.size() <= b) { ll thisAns = prefSums[v[0]]; ll thisSum = 0; for (int i = 1; i < v.size(); i++) { thisSum = prefSums[v[i]] - prefSums[v[i-1]]; thisAns |= thisSum; } minAns = min(minAns, thisAns); } return; } v.push_back(x); makeSubset(x+1, v); v.pop_back(); makeSubset(x+1, v); } int main() { cin >> n >> a >> b; cin >> y[0]; prefSums[0] = y[0]; for (int i = 1; i < n; i++) { cin >> y[i]; prefSums[i] = prefSums[i-1] + y[i]; } makeSubset(0, {}); cout << minAns << "\n"; }

Compilation message (stderr)

sculpture.cpp: In function 'void makeSubset(int, std::vector<int>)':
sculpture.cpp:14:15: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |         if (a <= v.size() and v.size() <= b)
      |             ~~^~~~~~~~~~~
sculpture.cpp:14:40: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
   14 |         if (a <= v.size() and v.size() <= b)
      |                               ~~~~~~~~~^~~~
sculpture.cpp:18:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |             for (int i = 1; i < v.size(); 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...