This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 X, typename Y> ostream& operator<<(ostream& os, pair<X,Y> pr){return os<<pr.first<<" "<<pr.second;}
ostream& operator<<(ostream& os, bool bl){return os<<(int32_t)bl;}
template<typename X> ostream& operator<<(ostream& os, vector<X> v){for(auto &it : v) os<<it<<" ";return os;}
template<typename X, size_t Y> ostream& operator<<(ostream& os, array<X,Y> v){for(auto &it : v) os<<it<<" ";return os;}
#define deci(x) int x;cin>>x;
#define endl '\n'
#define decstr(x) string x;cin>>x;
#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 tol(bi) (1LL<<((int)(bi)))
typedef long long ll;
const ll INF = LONG_LONG_MAX;
const int MOD = 1e9+7;
mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count());
#include "rail.h"
vector<vector<int>> dst;
int dist(int a, int b){
if (dst[a][b]==-1){
dst[a][b]=dst[b][a]=getDistance(a,b);
}
return dst[a][b];
}
void findLocation(int N, int first, int location[], int stype[])
{
dst.resize(N,vector<int>(N,-1));
location[0]=first;
stype[0]=1;
int rr = location[0];
int rv = 0;
for (int i = 1; i < N; i++){
for (int j = 1; j < N; j++){
if (i==j) continue;
if (dist(0,j)==dist(i,j)+dist(i,0)){
stype[i]=2;
stype[j]=1;
location[i]=location[0]+dist(0,i);
location[j]=location[i]-dist(i,j);
if (location[j]<rr){
rr=location[j];
rv=j;
}
}
}
}
for (int i = 0; i < N; ++i)
{
if (stype[i]!=0) continue;
location[i]=location[rv]+dist(i,rv);
stype[i]=2;
}
}
Compilation message (stderr)
rail.cpp:1: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
1 | #pragma optimize("Bismillahirrahmanirrahim")
|
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |