# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1095421 | Kerim | Bigger segments (IZhO19_segments) | C++17 | 1546 ms | 2516 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "bits/stdc++.h"
#define ll long long
using namespace std;
const int N = 2e5+4;
ll a[N], b[N], par[N];
int main(){
// freopen("file.in", "r", stdin);
int n;
scanf("%d", &n);
for(int i = 1; i <= n; ++i){
int x;
scanf("%d", &x);
par[i] = par[i-1]+x;
}
a[1] = par[1];
b[1] = 1;
for(int i = 2; i <= n; ++i){
int who, mx = 0;
for(int j = i; j >= 1; --j)
if(par[i] >= a[j-1]+par[j-1] and b[j-1]+1 > mx){
mx = b[j-1]+1;
who = j;
}
b[i] = b[who-1] + 1;
a[i] = par[i]-par[who-1];
}
printf("%lld\n", b[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... |