Submission #618061

#TimeUsernameProblemLanguageResultExecution timeMemory
618061Dremix10Shortcut (IOI16_shortcut)C++17
31 / 100
2045 ms2260 KiB
#include "shortcut.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pi; typedef pair<ll,ll> pl; #ifdef dremix #define p(x) cerr<<#x<<" = "<<x<<endl; #define p2(x,y) cerr<<#x<<" , "<<#y<<" = "<<x<<" , "<<y<<endl; #define pp(x) cerr<<#x<<" = ("<<x.F<<" - "<<x.S<<")"<<endl; #define pv(x) cerr<<#x<<" = {";for(auto u : x)cerr<<u<<", ";cerr<<"}"<<endl; #define ppv(x) cerr<<#x<<" = {";for(auto u : x)cerr<<u.F<<"-"<<u.S<<", ";cerr<<"}"<<endl; #else #define p(x) {} #define p2(x,y) {} #define pp(x) {} #define pv(x) {} #define ppv(x) {} #endif #define endl '\n' #define all(x) (x).begin(),(x).end() #define F first #define S second const int N = 1e6+5; const int MOD = 1e9+7; const ll INF = 1e18+5; long long find_shortcut(int n, std::vector<int> l, std::vector<int> d, int c) { ll dist[n][n]; int i,j,k,o; for(i=0;i<n;i++){ ll sum = 0; dist[i][i] = 0; for(j=i+1;j<n;j++){ sum += l[j-1]; dist[i][j] = sum; dist[j][i] = sum; } } ll ans = INF; for(i=0;i<n;i++){ for(j=i+1;j<n;j++){ ll maxi = 0; for(k=0;k<n;k++){ for(o=k+1;o<n;o++){ ll mini = dist[k][o]; ll temp = dist[k][i] + c + dist[j][o]; maxi = max(maxi,min(mini,temp) + d[k] + d[o]); } } ans = min(ans,maxi); } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...