제출 #609553

#제출 시각아이디문제언어결과실행 시간메모리
609553PlurmBali Sculptures (APIO15_sculpture)C++11
50 / 100
466 ms4428 KiB
#include <bits/stdc++.h> using namespace std; int y[2048]; int dp[2048]; bool check[2048][2048]; int main() { int n, a, b; scanf("%d%d%d", &n, &a, &b); for (int i = 1; i <= n; i++) { scanf("%d", y + i); } long long oldmask = 0ll; for (long long bit = 60; bit >= 0; bit--) { long long mask = oldmask | ((1ll << bit) - 1ll); for (int i = 1; i <= n; i++) { long long sum = 0ll; for (int j = i; j <= n; j++) { sum += y[j]; check[i][j] = (sum | mask) == mask; } } for (int i = 1; i <= n; i++) { if (check[1][i]) dp[i] = 1; else dp[i] = 1e9; for (int j = 1; j < i; j++) { if (check[j + 1][i]) { dp[i] = min(dp[j] + 1, dp[i]); } } } if (dp[n] > b) { oldmask |= 1ll << bit; } } printf("%lld\n", oldmask); return 0; }

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

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