제출 #1223292

#제출 시각아이디문제언어결과실행 시간메모리
1223292minggaBali Sculptures (APIO15_sculpture)C++17
71 / 100
15 ms660 KiB
#include "bits/stdc++.h" using namespace std; #define ln "\n" #define pb push_back #define fi first #define se second #define all(x) (x).begin(), (x).end() #define sz(x) ((int)(x).size()) #define ll long long const int mod = 1e9 + 7; const int inf = 2e9; const int N = 2005; int n, A, B, a[N], dp[N][N]; ll ps[N]; int ans[N]; namespace sub4 { bool check() { return n <= 100; } bool dp[N][N]; void solve() { ll ans = 0; for(int t = 37; t >= 0; t--) { dp[0][0] = 1; for(int i = 1; i <= n; i++) for(int j = 1; j <= n; j++) dp[i][j] = 0; for(int i = 1; i <= n; i++) { for(int j = 1; j <= i; j++) { for(int k = i - 1; k >= 0; k--) { ll summ = ps[i] - ps[k]; if(((summ >> t) & (ans >> t)) == (summ >> t)) { dp[i][j] = dp[i][j] || dp[k][j - 1]; } } } } bool ok = 0; for(int i = A; i <= B; i++) { if(dp[n][i]) { ok = 1; break; } } if(!ok) ans += (1ll << t); } cout << ans << ln; } } namespace sub5 { int dp[N][N]; void solve() { for(int t = 41; t >= 0; t--) { } } } signed main() { cin.tie(0) -> sync_with_stdio(0); #define task "" if(fopen(task ".INP", "r")) { freopen(task ".INP", "r", stdin); freopen(task ".OUT", "w", stdout); } cin >> n >> A >> B; for(int i = 1; i <= n; i++) cin >> a[i], ps[i] = ps[i - 1] + 1ll * a[i]; if(sub4::check()) sub4::solve(); else sub5::solve(); cerr << "\nTime: " << clock() * 1000 / CLOCKS_PER_SEC; }

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

sculpture.cpp: In function 'int main()':
sculpture.cpp:67:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   67 |                 freopen(task ".INP", "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
sculpture.cpp:68:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   68 |                 freopen(task ".OUT", "w", stdout);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
#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...