Submission #783948

#TimeUsernameProblemLanguageResultExecution timeMemory
783948tolbiRail (IOI14_rail)C++17
30 / 100
80 ms98568 KiB
#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; if (N==1) return; vector<pair<int,int>> arr; for (int i = 1; i < N; i++){ arr.push_back({dist(0,i),i}); } sortarr(arr); int node = arr[0].second; location[node]=location[0]+dist(0,node); stype[node]=2; pair<int,int> nod2 = {dist(0,node),0}; for (int i = 0; i < N; ++i) { if (i==node) continue; nod2=min(nod2,{dist(i,node),i}); } int orta = nod2.second; location[orta]=location[node]-dist(node,orta); stype[orta]=1; pair<int,int> mava = {location[node],node}; pair<int,int> miva = {location[orta],orta}; for (int i = 0; i < N; i++){ if (i==orta || i==node) continue; if (dist(node,i)==dist(i,orta)+dist(orta,node)){ stype[i]=2; location[i]=location[orta]+dist(orta,i); } if (dist(orta,i)==dist(i,node)+dist(node,orta)){ stype[i]=1; location[i]=location[node]-dist(node,i); } if (stype[i]==2){ mava=max(mava,{location[i],i}); } if (stype[i]==1){ miva=min(miva,{location[i],i}); } } for (int i = 0; i < N; ++i) { if (stype[i]!=0) continue; if (dist(i,mava.second)<dist(i,miva.second)){ stype[i]=1; location[i]=mava.first-dist(i,mava.second); } else { stype[i]=2; location[i]=miva.first+dist(i,miva.second); } } }

Compilation message (stderr)

rail.cpp:1: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    1 | #pragma optimize("Bismillahirrahmanirrahim")
      |
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...