# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1042470 | abczz | Chorus (JOI23_chorus) | C++17 | 7053 ms | 7100 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <array>
#include <cmath>
#define ll long long
#define ld long double
using namespace std;
ll n, k, l, r, mid, dp[1000000];
ll tot[1000000];
vector <ll> A, B, nxA, ps;
string S, T;
ll C(ll l, ll r) {
if (nxA[l] > r) return 0;
ll nx = max(l, nxA[l]), cnt = r-nx+1, cnt2 = max(0LL, l-nxA[l]);
return ps[r]-(nx ? ps[nx-1] : 0)-cnt*B[l]-cnt*(cnt-1)/2-(r-l+1)*cnt2;
}
void solve() {
dp[0] = C(0, 0) + mid, tot[0] = 1;
for (int i=1; i<n; ++i) {
dp[i] = C(0, i) + mid, tot[i] = 1;
for (int j=0; j<i; ++j) {
if (dp[i] > dp[j] + C(j+1, i) + mid || ((dp[i] == dp[j] + C(j+1, i) + mid) && tot[j]+1 > tot[i])) {
dp[i] = dp[j] + C(j+1, i) + mid;
# | 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... |