답안 #611809

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
611809 2022-07-29T07:44:52 Z PiejanVDC Shortcut (IOI16_shortcut) C++17
0 / 100
1 ms 212 KB
#include "shortcut.h"
#include <bits/stdc++.h>
using namespace std;
 
long long find_shortcut(int n, vector<int>l, vector<int>d, int c) {
    long long le[n], re[n], lee[n], ree[n];
    lee[0] = ree[n-1] = 0;
    re[n-1] = d[n-1];
    le[0] = d[0];
    for(int i = 1 ; i < n ; i++) {
        le[i] = max(le[i-1]+(long long)l[i-1], (long long)d[i]), lee[i] = le[i-1]+l[i-1];
    }
    for(int j = n-2 ; j >= 0 ; j--) {
        re[j] = max(re[j+1] + (long long)l[j], (long long)d[j]), ree[j] = re[j+1] + l[j];
    }

    long long mn = lee[n-1]+d[n-1];

    for(int i = 0 ; i < n ; i++) {
        for(int j = i+1 ; j < n ; j++) {
            long long x = 0;
            //cout << i << ' ' << j << '\n';
            x = max(x, le[i]+re[j]+c);
            x = max(x, lee[i]+d[i]);
            x = max(x, ree[j]+d[j]);
            for(int k = i+1 ; k < j ; k++) {
                //cout << i << ' ' << j << ' ' << k << '\n';
                x = max(x, lee[k]+d[k]);
                x = max(x, ree[k]+d[k]);
                //cout << lee[k] << ' ' << ree[k] << '\n'; 
                x = max(x, le[i]+re[j]+c);
                //cout << mn << '\n';
            }
            mn = min(mn, x);
            //cout << mn << '\n';
        }
    }
    return mn;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB n = 4, 80 is a correct answer
2 Incorrect 1 ms 212 KB n = 9, incorrect answer: jury 110 vs contestant 100
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB n = 4, 80 is a correct answer
2 Incorrect 1 ms 212 KB n = 9, incorrect answer: jury 110 vs contestant 100
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB n = 4, 80 is a correct answer
2 Incorrect 1 ms 212 KB n = 9, incorrect answer: jury 110 vs contestant 100
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB n = 4, 80 is a correct answer
2 Incorrect 1 ms 212 KB n = 9, incorrect answer: jury 110 vs contestant 100
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB n = 4, 80 is a correct answer
2 Incorrect 1 ms 212 KB n = 9, incorrect answer: jury 110 vs contestant 100
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB n = 4, 80 is a correct answer
2 Incorrect 1 ms 212 KB n = 9, incorrect answer: jury 110 vs contestant 100
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB n = 4, 80 is a correct answer
2 Incorrect 1 ms 212 KB n = 9, incorrect answer: jury 110 vs contestant 100
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB n = 4, 80 is a correct answer
2 Incorrect 1 ms 212 KB n = 9, incorrect answer: jury 110 vs contestant 100
3 Halted 0 ms 0 KB -