답안 #173530

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
173530 2020-01-04T13:36:27 Z mosiashvililuka Bigger segments (IZhO19_segments) C++14
0 / 100
2 ms 376 KB
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,f[500009],pas;
pair <long long, long long> dp[500009];
int main(){
    ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    cin>>a;
    for(b=1; b<=a; b++) cin>>f[b];
    for(b=2; b<=a; b++) f[b]+=f[b-1];
    for(b=1; b<=a; b++){
        dp[b].first=1;dp[b].second=f[b];
        for(c=b-1; c>=1; c--){
            if(dp[c].second>f[b]-f[c]) continue;
            if(dp[c].first+1>dp[b].first){
                dp[b].first=dp[c].first+1;
                dp[b].second=dp[c].second;
            }else{
                if(dp[c].first+1==dp[b].first&&dp[c].second<dp[b].second) dp[b].second=dp[c].second;
            }
        }
        if(pas<dp[b].first) pas=dp[b].first;
    }
    cout<<pas;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Incorrect 2 ms 376 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Incorrect 2 ms 376 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Incorrect 2 ms 376 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Incorrect 2 ms 376 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Incorrect 2 ms 376 KB Output isn't correct
7 Halted 0 ms 0 KB -