답안 #71913

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
71913 2018-08-25T20:47:44 Z XmtosX Shortcut (IOI16_shortcut) C++17
0 / 100
4 ms 612 KB
#include <bits/stdc++.h>
#include "shortcut.h"
using namespace std;
const int N=502;
long long dis[N][N],mx[N][N],mx1[N][N];
long long find_shortcut(int n, vector<int> l, vector<int> d, int c)
{
    if (n>500)
        return 0;
    for (int i=0;i<n;i++)
        mx[i][i]=mx1[i][i]=d[i];
    for (int i=0;i<n;i++)
    {
        for (int j=i+1;j<n;j++)
        {
            dis[i][j]=dis[i][j-1]+l[j-1];
            mx[i][j]=max(mx[i][j-1],dis[i][j]+d[j]);
        }
    }
    for (int i=0;i<n;i++)
    {
        for (int j=i-1;j>=0;j--)
        {
            mx1[j][i]=max(mx1[j+1][i],dis[j][i]+d[j]);
        }
    }
    long long ans=1e18;
    for (int i=0;i<n;i++)
    {
        for (int j=i+1;j<n;j++)
        {
            long long maxx=0;
            for (int q=0;q<n;q++)
            {
                long long cur=0;
                if (q<=j)
                    cur= d[q]+mx[j][n-1]+(min(dis[q][j],dis[i][q]+c));
                if (q>=i)
                    cur= max(cur,d[q]+mx1[0][i]+min(dis[i][q],dis[q][j]+c));
               
                maxx=max(maxx,cur);
            }
            ans=min(ans,maxx);
        }
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB n = 4, 80 is a correct answer
2 Correct 2 ms 612 KB n = 9, 110 is a correct answer
3 Incorrect 4 ms 612 KB n = 4, incorrect answer: jury 21 vs contestant 14
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB n = 4, 80 is a correct answer
2 Correct 2 ms 612 KB n = 9, 110 is a correct answer
3 Incorrect 4 ms 612 KB n = 4, incorrect answer: jury 21 vs contestant 14
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB n = 4, 80 is a correct answer
2 Correct 2 ms 612 KB n = 9, 110 is a correct answer
3 Incorrect 4 ms 612 KB n = 4, incorrect answer: jury 21 vs contestant 14
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB n = 4, 80 is a correct answer
2 Correct 2 ms 612 KB n = 9, 110 is a correct answer
3 Incorrect 4 ms 612 KB n = 4, incorrect answer: jury 21 vs contestant 14
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB n = 4, 80 is a correct answer
2 Correct 2 ms 612 KB n = 9, 110 is a correct answer
3 Incorrect 4 ms 612 KB n = 4, incorrect answer: jury 21 vs contestant 14
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB n = 4, 80 is a correct answer
2 Correct 2 ms 612 KB n = 9, 110 is a correct answer
3 Incorrect 4 ms 612 KB n = 4, incorrect answer: jury 21 vs contestant 14
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB n = 4, 80 is a correct answer
2 Correct 2 ms 612 KB n = 9, 110 is a correct answer
3 Incorrect 4 ms 612 KB n = 4, incorrect answer: jury 21 vs contestant 14
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB n = 4, 80 is a correct answer
2 Correct 2 ms 612 KB n = 9, 110 is a correct answer
3 Incorrect 4 ms 612 KB n = 4, incorrect answer: jury 21 vs contestant 14
4 Halted 0 ms 0 KB -