# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
417395 | doowey | Cigle (COI21_cigle) | C++14 | 249 ms | 67420 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const int N = 5010;
int dp[N][N];
int D[N];
int main(){
fastIO;
int n;
cin >> n;
for(int i = 1; i <= n; i ++ ){
cin >> D[i];
}
int pp;
int cum;
int cur;
int outp = 0;
int dpe;
int val;
int cur_v;
int total;
for(int cut = 2; cut <= n; cut ++ ){
for(int ash = 2; ash <= cut - 1; ash ++ ){
dp[ash][cut - 1] = max(dp[ash][cut - 1], dp[ash-1][cut-1]);
}
cur = 0;
cum = 0;
pp = cut;
dpe = cut - 1;
total = 0;
cur_v = 0;
for(int go = cut; go <= n; go ++ ){
dp[cut][go] = dp[dpe][cut - 1] + cur_v;
if(go == n)
outp = max(outp, dp[cut][go]);
cur += D[go];
while(pp > 1 && cum < cur){
pp --;
cum += D[pp];
}
if(cum == cur){
total ++ ;
if(pp - 1 >= dpe){
cur_v ++ ;
}
else{
if(pp - 1 >= 1 && dp[pp - 1][cut - 1] + total >= dp[dpe][cut - 1] + cur_v){
cur_v = total;
dpe = pp - 1;
}
}
}
}
}
cout << outp << "\n";
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |