답안 #291726

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
291726 2020-09-05T17:38:14 Z SOIVIEONE Shortcut (IOI16_shortcut) C++14
0 / 100
1 ms 256 KB
#include "shortcut.h"
#include<bits/stdc++.h>
#define ll long long
#define pb push_back

using namespace std;

const int N = 1e3 + 5;
ll sum[N];
vector<ll> dn;


ll get_min_way(int l, int r, int tl, int tr, ll add){
    ll nans = abs(sum[l] - sum[tl]) + add + abs(sum[tr] - sum[r]) + dn[l] + dn[r];
    return nans;
}

long long find_shortcut(int n, vector<int> l, vector<int> d, int c)
{
    for(auto& e : d)
        dn.pb(e);
    for(int i = 1; i < n; i++){
        sum[i] = sum[i - 1] + (ll)l[i - 1];
    }
    ll mmax = 1e18, nmax, now;
    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            if(sum[j] - sum[i] <= c)
                continue;
            nmax = 0;
            //cout << "add edge at range: " << i + 1 << ' ' << j + 1 << endl;
            for(int l = 0; l < n; l++){
                for(int r = l + 1; r < n; r++){
                    now = sum[r] - sum[l] + d[l] + d[r];
                    now = min(now, get_min_way(l, r, i, j, c));
                    nmax = max(nmax, now);
                }
            }
            mmax = min(mmax, nmax);
        }
    }
    return mmax;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB n = 4, 80 is a correct answer
2 Correct 1 ms 256 KB n = 9, 110 is a correct answer
3 Correct 0 ms 256 KB n = 4, 21 is a correct answer
4 Incorrect 0 ms 256 KB n = 3, incorrect answer: jury 4 vs contestant 1000000000000000000
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB n = 4, 80 is a correct answer
2 Correct 1 ms 256 KB n = 9, 110 is a correct answer
3 Correct 0 ms 256 KB n = 4, 21 is a correct answer
4 Incorrect 0 ms 256 KB n = 3, incorrect answer: jury 4 vs contestant 1000000000000000000
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB n = 4, 80 is a correct answer
2 Correct 1 ms 256 KB n = 9, 110 is a correct answer
3 Correct 0 ms 256 KB n = 4, 21 is a correct answer
4 Incorrect 0 ms 256 KB n = 3, incorrect answer: jury 4 vs contestant 1000000000000000000
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB n = 4, 80 is a correct answer
2 Correct 1 ms 256 KB n = 9, 110 is a correct answer
3 Correct 0 ms 256 KB n = 4, 21 is a correct answer
4 Incorrect 0 ms 256 KB n = 3, incorrect answer: jury 4 vs contestant 1000000000000000000
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB n = 4, 80 is a correct answer
2 Correct 1 ms 256 KB n = 9, 110 is a correct answer
3 Correct 0 ms 256 KB n = 4, 21 is a correct answer
4 Incorrect 0 ms 256 KB n = 3, incorrect answer: jury 4 vs contestant 1000000000000000000
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB n = 4, 80 is a correct answer
2 Correct 1 ms 256 KB n = 9, 110 is a correct answer
3 Correct 0 ms 256 KB n = 4, 21 is a correct answer
4 Incorrect 0 ms 256 KB n = 3, incorrect answer: jury 4 vs contestant 1000000000000000000
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB n = 4, 80 is a correct answer
2 Correct 1 ms 256 KB n = 9, 110 is a correct answer
3 Correct 0 ms 256 KB n = 4, 21 is a correct answer
4 Incorrect 0 ms 256 KB n = 3, incorrect answer: jury 4 vs contestant 1000000000000000000
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB n = 4, 80 is a correct answer
2 Correct 1 ms 256 KB n = 9, 110 is a correct answer
3 Correct 0 ms 256 KB n = 4, 21 is a correct answer
4 Incorrect 0 ms 256 KB n = 3, incorrect answer: jury 4 vs contestant 1000000000000000000