제출 #885901

#제출 시각아이디문제언어결과실행 시간메모리
885901dimashhhBigger segments (IZhO19_segments)C++17
37 / 100
1540 ms5200 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 1,MOD = 998244353; typedef long long ll; #pragma GCC optimize("Ofast","O3","unroll-loops") #pragma GCC target("avx2") int n,a[N]; ll dp[N],mn[N]; void test(){ cin >> n; for(int i = 1;i <= n;i++){ cin >> a[i]; } for(int i = 1;i <=n;i++){ ll cur = 0; for(int j = i;j >= 1;j--){ cur += a[j]; if(mn[j - 1] <= cur){ if(dp[j - 1] + 1 > dp[i]){ dp[i] = dp[j - 1] +1; mn[i] = cur; } } } } cout << dp[n]; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); int T = 1; // cin >> T; test(); }

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

segments.cpp: In function 'int main()':
segments.cpp:34:9: warning: unused variable 'T' [-Wunused-variable]
   34 |     int T = 1;
      |         ^
#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...