# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
820056 |
2023-08-10T18:33:23 Z |
tolbi |
Scales (IOI15_scales) |
C++17 |
|
0 ms |
0 KB |
#pragma optimize("Bismillahirrahmanirrahim");
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█■█
//█─█─█▄─█▄─█─█─█─█
//Allahuekber
//ahmet23 orz...
//FatihSultanMehmedHan
//YavuzSultanSelimHan
//AbdulhamidHan
//Sani buyuk Osman Pasa Plevneden cikmam diyor
#define author tolbi
#include <bits/stdc++.h>
using namespace std;
template<typename T> istream& operator>>(istream& is, vector<T> &v){for (auto &it : v) is>>it;return is;}
template<typename T, size_t Y> istream& operator>>(istream& is, array<T,Y> &v){for (auto &it : v) is>>it;return is;}
template<typename T> ostream& operator<<(ostream& os, vector<T> &v){for (auto &it : v) os<<it<<" ";return os;}
template<typename T, size_t Y> ostream& operator<<(ostream& os, array<T,Y> &v){for (auto &it : v) os<<it<<" ";return os;}
template<typename X, typename Y> istream& operator>>(istream& is, pair<X,Y> &pr){return is<<pr.first<<" "<<pr.second;}
template<typename X, typename Y> ostream& operator<<(ostream& os, pair<X,Y> &pr){return os>>pr.first>>pr.second;}
#define deci(x) int x;cin>>x;
#define decstr(x) string x;cin>>x;
#define vint(x) vector<int> x
#define cinarr(x) for (auto &it : x) cin>>it;
#define coutarr(x) for (auto &it : x) cout<<it<<" ";cout<<endl;
#define sortarr(x) sort(x.begin(), x.end())
#define sortrarr(x) sort(x.rbegin(), x.rend())
#define rev(x) reverse(x.begin(), x.end())
#define endl '\n'
#define tol(bi) (1LL<<((int)(bi)))
typedef long long ll;
const int MOD = 1e9+7;
mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count());
#include "boxes.h"
long long delivery(int n, int k, int l, int _arr[]) {
vector<ll> arr1;
vector<ll> arr2;
for (int i = 0; i < n; ++i)
{
if (_arr[i]>0){
arr1.push_back(_arr[i]);
}
if (_arr[n-i-1]>0){
arr2.push_back(l-_arr[n-i-1]);
}
}
n=arr1.size();
if (n==0) return 0;
vector<ll> dp1(n,0);
vector<ll> dp2(n,0);
ll crr = 0;
int crk = 0;
for (int i = 0; i < n; i++){
if (crk==k){
crr+=min(arr1[i-1],l-arr1[i-1])*2;
crk=0;
}
crk++;
ll hueh = 0;
if (i) hueh = arr1[i-1];
hueh=arr1[i]-hueh;
crr+=min(hueh,l-hueh);
dp1[i]=crr+min(arr1[i],l-arr1[i]);
}
swap(arr1,arr2);
crr = 0;
crk = 0;
for (int i = 0; i < n; i++){
if (crk==k){
crr+=min(arr1[i-1],l-arr1[i-1])*2;
crk=0;
}
crk++;
ll hueh = 0;
if (i) hueh = arr1[i-1];
hueh=arr1[i]-hueh;
crr+=min(hueh,l-hueh);
dp2[i]=crr+min(arr1[i],l-arr1[i]);
}
swap(arr1,arr2);
ll ans = min(dp1[n-1],dp2[n-1]);
for (int i = 0; i < n-1; i++){
int a = i;
int b = n-2-i;
crr=dp1[a]+dp2[b];
ans=min(ans,crr);
}
return ans;
}
Compilation message
scales.cpp:1: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
1 | #pragma optimize("Bismillahirrahmanirrahim");
|
scales.cpp:33:10: fatal error: boxes.h: No such file or directory
33 | #include "boxes.h"
| ^~~~~~~~~
compilation terminated.