제출 #497386

#제출 시각아이디문제언어결과실행 시간메모리
497386vinnipuh01Bigger segments (IZhO19_segments)C++17
13 / 100
1580 ms332 KiB
#include <iostream> #include <bits/stdc++.h> #include <cmath> #include <algorithm> #include <vector> #include <deque> #include <set> #include <stack> #include <string> #include <map> #include <queue> #define int long long using namespace std; const long long oo = 1000000000000000000; long long sum, ans = 0, mx = 0, mn = 1000000000, num, pos; /* ViHHiPuh (( `'-""``""-'` )) )-__-_.._-__-( / --- (o _ o) --- \ \ .-* ( .0. ) *-. / _'-. ,_ '=' _, .-'_ / `;#'#'# - #'#'#;` \ \_)) -----'#'----- ((_/ # --------- # '# ------- ------ #' /..-'# ------- #'-.\ _\...-\'# -- #'/-.../_ ((____)- '#' -(____)) cout << fixed << setprecision(6) << x; ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); freopen ( "sum.in", "r", stdin ) */ int n; int a[ 500001 ]; void f( int o = 1, int sum = 0, int col = 0 ) { if ( o == n + 1 ) { mx = max( mx, col + 0ll ); return; } int num = 0; for ( int i = o; i <= n; i ++ ) { num += a[ i ]; if ( num >= sum ) { f( i + 1, num, col + 1 ); } } } main () { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for ( int i = 1; i <= n; i ++ ) { cin >> a[ i ]; } f(); cout << mx; }

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

segments.cpp:63:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   63 | main () {
      | ^~~~
#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...