제출 #715445

#제출 시각아이디문제언어결과실행 시간메모리
715445MDSProBigger segments (IZhO19_segments)C++17
27 / 100
1575 ms404 KiB
// MDSPro // #pragma GCC optimize("Ofast") // #pragma GCC optimize ("unroll-loops") // #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx") #include "bits/stdc++.h" #ifdef LOCAL #include "debug.h" #else #define debug(x...) 42 #endif #define all(x) (x).begin(),(x).end() using namespace std; using ll = long long; using ld = long double; const ld PI = 3.141592653589793; const int MOD = 1e9+7; const int INF = 1e9; const ll INFLL = 4e18; const double EPS = 1e-9; const int MAXN = 1000*1007; void solve(int NT){ int n; cin >> n; vector<int> a(n); for(int i = 0; i < n; ++i) cin >> a[i]; int ans; vector dp(n+1,INFLL); dp[0] = 0; for(int i = 1; i <= n; ++i){ vector old = dp; dp.assign(n+1,INFLL); debug(old); for(int j = 1; j <= n; ++j){ ll sum = 0; for(int k = j; k >= 1; --k){ sum += a[k-1]; if(sum >= old[k-1]) dp[j] = min(dp[j],sum); } debug(i,j,sum); } debug(dp); if(dp[n] == INFLL) break; ans = i; } cout << ans; } // #define TESTCASES int main() { cin.tie(0)->sync_with_stdio(0); #ifdef LOCAL freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); freopen("error.txt","w",stderr); #endif int t = 1; #ifdef TESTCASES cin >> t; #endif for(int i = 1; i <= t; ++i){ solve(i); cout << "\n"; } }

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

segments.cpp: In function 'void solve(int)':
segments.cpp:10:25: warning: statement has no effect [-Wunused-value]
   10 |     #define debug(x...) 42
      |                         ^~
segments.cpp:34:9: note: in expansion of macro 'debug'
   34 |         debug(old);
      |         ^~~~~
segments.cpp:10:25: warning: statement has no effect [-Wunused-value]
   10 |     #define debug(x...) 42
      |                         ^~
segments.cpp:41:13: note: in expansion of macro 'debug'
   41 |             debug(i,j,sum);
      |             ^~~~~
segments.cpp:10:25: warning: statement has no effect [-Wunused-value]
   10 |     #define debug(x...) 42
      |                         ^~
segments.cpp:43:9: note: in expansion of macro 'debug'
   43 |         debug(dp);
      |         ^~~~~
segments.cpp:48:13: warning: 'ans' may be used uninitialized in this function [-Wmaybe-uninitialized]
   48 |     cout << ans;
      |             ^~~
#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...