제출 #455337

#제출 시각아이디문제언어결과실행 시간메모리
455337qwerasdfzxclBali Sculptures (APIO15_sculpture)C++14
71 / 100
1090 ms1356 KiB
#include <bits/stdc++.h> typedef long long ll; using namespace std; int a[2020]; bool dp[2020][2020]; int main(){ int n, l, r; scanf("%d %d %d", &n, &l, &r); for (int i=1;i<=n;i++) scanf("%d", a+i); ll cur = 0, ans = 0; for (int i=60;i>=0;i--){ for (int j=0;j<=n;j++) fill(dp[j], dp[j]+n+1, 0); cur |= 1LL<<i; ll cur2 = 0; for (int j=1;j<=n;j++){ cur2 += a[j]; if ((cur2&cur)==(ans&cur2)) dp[j][1] = 1; for (int k=2;k<=j;k++){ ll cur3 = 0; for (int l=j;l>k-1;l--){ cur3 += a[l]; if (dp[l-1][k-1] && (cur3&cur)==(ans&cur3)) dp[j][k] = 1; } } } bool flag = 1; for (int j=l;j<=r;j++) if (dp[n][j]) flag = 0; if (flag) ans |= 1LL<<i; } printf("%lld\n", ans); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

sculpture.cpp: In function 'int main()':
sculpture.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%d %d %d", &n, &l, &r);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
sculpture.cpp:11:33: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     for (int i=1;i<=n;i++) scanf("%d", a+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...