Submission #249138

#TimeUsernameProblemLanguageResultExecution timeMemory
249138hunni10Bali Sculptures (APIO15_sculpture)C++14
9 / 100
1093 ms384 KiB
#include<stdio.h> #include<algorithm> #include<vector> #include<set> #include<map> #include<bitset> #include<math.h> #include<string.h> #include<queue> #include<list> #include<time.h> #include<assert.h> #include<unordered_set> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<int, ll> pil; typedef pair<ll, int> pli; int n, m, k, t; int a, b; int y[2000]; ll acc[2000]; vector<int> current_division; int get() { int sum = 0; auto riter = current_division.rbegin(); while (true) { if (riter + 1 == current_division.rend()) return 1; sum += *riter; *riter = 0; if (*(riter + 1) != 0) { (*(riter + 1))--; *riter = sum + 1; return 0; } riter++; } return 0; } int main() { scanf("%d %d %d", &n, &a, &b); ll sum = 0; for (int i = 0; i < n; i++) { scanf("%d", y + i); sum += y[i]; acc[i] = sum; } ll mn = 0x7FFFFFFFFFFFFFFF; for (int d = a; d <= b; d++) { current_division.clear(); current_division.assign(d, 0); current_division[0] = n - d; int stop = 0; while (!stop) { int idx = 0; ll ors = 0; for (int num : current_division) { ll subsum = acc[idx + num]; if (idx != 0) { subsum -= acc[idx-1]; } ors |= subsum; idx += num + 1; } if (mn > ors) mn = ors; stop = get(); } } printf("%lld", mn); }

Compilation message (stderr)

sculpture.cpp: In function 'int main()':
sculpture.cpp:47:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d %d", &n, &a, &b);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
sculpture.cpp:50:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", y + 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...