제출 #102770

#제출 시각아이디문제언어결과실행 시간메모리
102770naoai철로 (IOI14_rail)C++14
30 / 100
3039 ms254840 KiB
#include "rail.h" #include <bits/stdc++.h> using namespace std; const int nmax = 5000; bool fix[nmax + 1]; int v[nmax + 1], tip[nmax + 1]; int mn[nmax + 1]; vector<pair<int, int>> d[nmax + 1]; void findLocation(int N, int first, int location[], int stype[]) { for (int i = 0; i < N; ++ i) for (int j = i + 1; j < N; ++ j) { int x = getDistance(i, j); d[i].push_back({x, j}); d[j].push_back({x, i}); } for (int i = 0; i < N; ++ i) sort(d[i].begin(), d[i].end()); v[0] = first; tip[0] = 1; fix[0] = 1; for (int step = 0; step < N - 1; ++ step) { int x, y, e = 1 << 30; x = y = -1; for (int i = 0; i < N; ++ i) { if (fix[i] == 1) { while (mn[i] < d[i].size() && fix[d[i][mn[i]].second] == 1) ++ mn[i]; if (mn[i] < d[i].size() && d[i][mn[i]].first < e) { x = i; y = d[i][mn[i]].second; e = d[i][mn[i]].first; } } } if (tip[x] == 1) { v[y] = v[x] + e; tip[y] = 2; } else { v[y] = v[x] - e; tip[y] = 1; } fix[y] = 1; } for (int i = 0; i < N; ++ i) { location[i] = v[i]; stype[i] = tip[i]; } }

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

rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:34:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 while (mn[i] < d[i].size() && fix[d[i][mn[i]].second] == 1)
                        ~~~~~~^~~~~~~~~~~~~
rail.cpp:37:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 if (mn[i] < d[i].size() && d[i][mn[i]].first < e) {
                     ~~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...