제출 #107893

#제출 시각아이디문제언어결과실행 시간메모리
107893patrikpavic2Bali Sculptures (APIO15_sculpture)C++17
50 / 100
686 ms23288 KiB
#include <cstdio> #include <cstring> #include <ctime> #include <cstdlib> #include <algorithm> #include <vector> #include <set> #include <map> #include <queue> #include <deque> #define X first #define Y second #define PB push_back using namespace std; typedef long long ll; typedef pair < int, int > pii; typedef vector < int > vi; typedef set < int > si; const int N = 2050; const int M = 1e6 + 500; const int INF = 0x3f3f3f3f; const int MOD = 1e9 + 7; const int LOG = 18; const int OFF = (1 << LOG); const double EPS = 1e-9; const double PI = 3.1415926535; ll sum[N][N], ans = 0; int dp[N], A, B, x[N], n; bool check(int k){ for(int i = 0;i < n;i++){ dp[i] = INF; for(int j = -1;j < i;j++){ if((sum[j + 1][i] & (~ans)) < (1LL << k)) dp[i] = min(1 + (j >= 0 ? dp[j] : 0), dp[i]); } } return dp[n - 1] <= B; } int main(){ scanf("%d%d%d", &n, &A, &B); for(int i = 0;i < n;i++) scanf("%d", x + i); for(int i = 0;i < n;i++){ ll cur = 0; for(int j = i;j < n;j++){ cur += (ll)x[j]; sum[i][j] = cur; } } for(int i = 45; i >= 0;i--) if(!check(i)) ans |= (1LL << i); printf("%lld\n", ans); return 0; }

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

sculpture.cpp: In function 'int main()':
sculpture.cpp:47:10: 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:49:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", x + 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...