Submission #162573

# Submission time Handle Problem Language Result Execution time Memory
162573 2019-11-08T19:45:47 Z brcode Shortcut (IOI16_shortcut) C++14
0 / 100
2 ms 376 KB
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 2e5+5;
long long pref[MAXN];
long long dist(long long x,long long y){
    if(x>y){
        swap(x,y);
    }
    if(x==y){
        return 0;
    }
    long long res = 0;
    if(x){
        res = pref[x-1];
    }
    return res+pref[y-1];
}
long long find_shortcut(int n, vector<int> l, vector<int> d, int c){
    pref[0] = l[0];
    for(long long i=1;i<n;i++){
        pref[i] = pref[i-1]+l[i];
    }
    long long ans = 1e17;
    for(long long i=0;i<n;i++){
        for(long long j=i+1;j<n;j++){
            long long tempans = 0;
            for(long long x=0;x<n;x++){

                for(long long y=x+1;y<n;y++){
                    long long hold = min(dist(x,y),min(dist(x,i)+c+dist(y,j),dist(x,j)+c+dist(y,i)));
                    tempans = max(tempans,hold+d[x]+d[y]);

                }
            }
            ans = min(ans,tempans);
        }
    }
    return ans;
}


# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB n = 4, 80 is a correct answer
2 Incorrect 2 ms 376 KB n = 9, incorrect answer: jury 110 vs contestant 170
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB n = 4, 80 is a correct answer
2 Incorrect 2 ms 376 KB n = 9, incorrect answer: jury 110 vs contestant 170
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB n = 4, 80 is a correct answer
2 Incorrect 2 ms 376 KB n = 9, incorrect answer: jury 110 vs contestant 170
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB n = 4, 80 is a correct answer
2 Incorrect 2 ms 376 KB n = 9, incorrect answer: jury 110 vs contestant 170
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB n = 4, 80 is a correct answer
2 Incorrect 2 ms 376 KB n = 9, incorrect answer: jury 110 vs contestant 170
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB n = 4, 80 is a correct answer
2 Incorrect 2 ms 376 KB n = 9, incorrect answer: jury 110 vs contestant 170
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB n = 4, 80 is a correct answer
2 Incorrect 2 ms 376 KB n = 9, incorrect answer: jury 110 vs contestant 170
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB n = 4, 80 is a correct answer
2 Incorrect 2 ms 376 KB n = 9, incorrect answer: jury 110 vs contestant 170
3 Halted 0 ms 0 KB -