제출 #799842

#제출 시각아이디문제언어결과실행 시간메모리
799842tolbi철로 (IOI14_rail)C++17
100 / 100
85 ms98524 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;} 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;} ostream& operator<<(ostream& os, bool bl){return os<<(int32_t)bl;} #define endl '\n' #define deci(x) int x;cin>>x; #define decstr(x) string x;cin>>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 tol(bi) (1ll<<((int)(bi))) typedef long long ll; #include "rail.h" const ll INF = LONG_LONG_MAX; const ll MOD = 1e9+9; mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count()); int dst[5000][5000]; int dist(int a, int b){ if (a==b){ return dst[a][b]=0; } 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 pl[], int type[]) { for (int i = 0; i < 5000; i++){ for (int j = 0; j < 5000; j++){ dst[i][j]=-1; } dst[i][i]=0; } vector<int> arr(n-1); iota(arr.begin(), arr.end(), 1); sort(arr.begin(), arr.end(), [&](int a, int b){ return dist(0,a)<dist(0,b); }); vector<int> leftte; vector<int> rightta; int right = arr[0]; type[0]=1; type[right]=2; pl[0]=__first; pl[right]=pl[0]+dist(0,right); for (int i = 1; i < arr.size(); i++){ int k = arr[i]; if (dist(0,k)==dist(0,right)+dist(k,right) && dist(k,right)<dist(0,right)){ type[k]=1; pl[k]=pl[right]-dist(k,right); continue; } if (dist(0,k)==dist(0,right)+dist(k,right)){ leftte.push_back(k); } else { rightta.push_back(k); } } int D = right; int left = 0; set<int> st; st.insert(pl[right]); for (int i = 0; i < rightta.size(); i++){ int k = rightta[i]; int tot = pl[right]-pl[left]+dist(right,k); if ((tot-dist(left,k))%2==0 && st.find(pl[right]-(tot-dist(left,k))/2)!=st.end()){ type[k]=1; pl[k]=pl[right]-dist(right,k); } else { type[k]=2; pl[k]=pl[left]+dist(left,k); st.insert(pl[k]); right=k; } } st.clear(); st.insert(pl[left]); right=D; for (int i = 0; i < leftte.size(); i++){ int k = leftte[i]; int tot = pl[right]-pl[left]+dist(left,k); if ((tot-dist(right,k))%2==0 && st.find(pl[left]+(tot-dist(right,k))/2)!=st.end()){ type[k]=2; pl[k]=pl[left]+dist(left, k); } else { type[k]=1; pl[k]=pl[right]-dist(right,k); st.insert(pl[k]); left=k; } } }

컴파일 시 표준 에러 (stderr) 메시지

rail.cpp:1: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    1 | #pragma optimize("Bismillahirrahmanirrahim")
      | 
rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:62:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   62 |  for (int i = 1; i < arr.size(); i++){
      |                  ~~^~~~~~~~~~~~
rail.cpp:80:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   80 |  for (int i = 0; i < rightta.size(); i++){
      |                  ~~^~~~~~~~~~~~~~~~
rail.cpp:97:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   97 |  for (int i = 0; i < leftte.size(); i++){
      |                  ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...