제출 #588212

#제출 시각아이디문제언어결과실행 시간메모리
588212FatihSolak철로 (IOI14_rail)C++17
8 / 100
72 ms7372 KiB
#include "rail.h" #include <bits/stdc++.h> #define N 5005 using namespace std; int d[N][N]; int get(int i,int j){ if(i > j)swap(i,j); if(i == j)return 0; if(d[i][j]) return d[i][j]; return d[i][j] = getDistance(i,j); } void findLocation(int n, int first, int location[], int stype[]) { for(int i = 0;i<n;i++){ location[i] = -1; stype[i] = -1; } location[0] = first; stype[0] = 1; if(n == 1)return; vector<pair<int,int>> v; for(int i = 0;i<n;i++){ if(i == 0)continue; v.push_back({get(0,i),i}); } sort(v.begin(),v.end()); int last = v[0].second; int x = last; set<int> points = {location[last]}; location[v[0].second] = get(0,v[0].second) + first; stype[v[0].second] = 2; for(int i = 1;i<v.size();i++){ if(get(0,v[i].second) > 2*get(0,x) && get(0,v[i].second) > get(x,v[i].second) + get(0,x) - 2) continue; int nwpoint = location[last] - get(last, v[i].second); int rval = *points.lower_bound(nwpoint); if(2*rval - nwpoint + first == get(0,v[i].second)){ location[v[i].second] = nwpoint; stype[v[i].second] = 1; } else{ location[v[i].second] = get(0,v[i].second) + first; stype[v[i].second] = 2; last = v[i].second; points.insert(location[last]); } } // for(int i = 0;i<n;i++){ // cout << location[i] << " " << stype[i] << endl; // } // cout << endl; }

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

rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:33:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |     for(int i = 1;i<v.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...