제출 #792675

#제출 시각아이디문제언어결과실행 시간메모리
792675caganyanmaz철로 (IOI14_rail)C++14
56 / 100
358 ms648 KiB
#include <bits/stdc++.h> #include "rail.h" using namespace std; int n; int f; int* v; int* t; constexpr static int MXSIZE = 5000; constexpr static int MXDIST = 1e6; bitset<MXSIZE> found; int data[MXSIZE][2]; // minindex, mindist void findLocation(int N, int first, int location[], int stype[]) { n = N; f = first; v = location; t = stype; v[0] = f; t[0] = 1; for (int i = 1; i < n; i++) data[i][1] = MXDIST; vector<int> s(1, 0); found[0] = true; while (s.size() < n) { for (int i = 0; i < n; i++) { if(found[i]) continue; int dist = getDistance(s.back(), i); if (dist < data[i][1]) { data[i][0] = s.back(); data[i][1] = dist; } } int mn = -1; for (int i = 0; i < n; i++) if (!found[i] && (mn == -1 || data[i][1] < data[mn][1])) mn = i; if (t[data[mn][0]] == 1) { v[mn] = v[data[mn][0]] + data[mn][1]; t[mn] = 2; } else { v[mn] = v[data[mn][0]] - data[mn][1]; t[mn] = 1; } found[mn] = true; s.push_back(mn); } }

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

rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:26:25: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   26 |         while (s.size() < n)
      |                ~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...