제출 #45004

#제출 시각아이디문제언어결과실행 시간메모리
45004RezwanArefin01Bali Sculptures (APIO15_sculpture)C++17
37 / 100
3 ms1020 KiB
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> ii; int n, A, B, a[2001], f[2010]; ll C[2001][2001]; bool dp[110][110]; int main(int argc, char const *argv[]) { scanf("%d %d %d", &n, &A, &B); for(int i = 1; i <= n; i++) scanf("%d", &a[i]); for(int i = 1; i <= n; i++) { C[i][i] = a[i]; for(int j = i + 1; j <= n; j++) C[i][j] = C[i][j - 1] + a[j]; } ll mask = (1ll << 36) - 1; #define nyc(a, b) ((a & b) == a) if(A == 1) { for(int b = 35; b >= 0; b--) { mask ^= 1ll << b; f[0] = 0; for(int i = 1; i <= n; i++) { f[i] = n + 1; for(int j = 0; j < i; j++) if(nyc(C[j + 1][i], mask)) f[i] = min(f[i], f[j] + 1); } if(f[n] > B) mask ^= 1ll << b; } } else { for(int b = 35; b >= 0; b--) { mask ^= 1ll << b; for(int i = 1; i <= n; i++) dp[1][i] = nyc(C[1][i], mask); for(int k = 2; k <= B; k++) { for(int i = 1; i <= n; i++) { dp[k][i] = 0; for(int j = 1; j < i; j++) dp[k][i] |= (dp[k - 1][j] & nyc(C[j + 1][i], mask)); } } bool f = 0; for(int i = A; i <= B; i++) if(dp[i][n]) f = 1; if(!f) mask ^= 1ll << b; } } printf("%d\n", mask); }

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

sculpture.cpp: In function 'int main(int, const char**)':
sculpture.cpp:52:24: warning: format '%d' expects argument of type 'int', but argument 2 has type 'll {aka long long int}' [-Wformat=]
  }  printf("%d\n", mask);
                        ^
sculpture.cpp:14: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:16:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   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...