Submission #783938

#TimeUsernameProblemLanguageResultExecution timeMemory
783938tolbiRail (IOI14_rail)C++17
30 / 100
399 ms98528 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; 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...