Submission #712992

#TimeUsernameProblemLanguageResultExecution timeMemory
712992mseebacherBoxes with souvenirs (IOI15_boxes)C++17
15 / 100
2071 ms280 KiB
//#include <bits/stdc++.h> #include <stdio.h> #include <stdlib.h> #include <iostream> #include <string> #include <vector> #include <cmath> #include <cstring> #include <algorithm> #include <iomanip> #include <map> #include <set> #include <stack> #include <queue> #include <functional> #include <iostream> #include <fstream> #include <string> using namespace std; #define mp make_pair #define f first #define s second #define pb push_back typedef long long ll; typedef long double lld; typedef unsigned long long ull; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<pii> vpi; typedef vector<pll> vpl; const lld pi = 3.14159265358979323846; ll calc(int n,int k,int l,int pos[]){ int av = k; ll cost = 0; for(int i = 0;i<n;i++){ if(av == 0){ cost += min(pos[i-1],l-pos[i-1]); cost += min(pos[i],l-pos[i]); av = k-1; }else{ if(i == 0) cost += min(pos[i],l-pos[i]); else cost += min(abs(pos[i]-pos[i-1]),l+min(pos[i],pos[i-1])-max(pos[i],pos[i-1])); av--; } } return cost+min(pos[n-1],l-pos[n-1]); } ll delivery(int n,int k,int l,int pos[]){ ll ans = 1e18; do{ ans = min(ans,calc(n,k,l,pos)); }while(next_permutation(pos,pos+n)); 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...