Submission #1014700

#TimeUsernameProblemLanguageResultExecution timeMemory
1014700t_hollRail (IOI14_rail)C++14
0 / 100
45 ms604 KiB
#include <bits/stdc++.h> #include "rail.h" using namespace std; void findLocation(int N, int first, int location[], int stype[]) { vector<pair<int, int>> locations_sorted; for (int i = 0; i < N; i ++) locations_sorted.push_back({ location[i], i }); sort(locations_sorted.begin(), locations_sorted.end()); vector<int> etype(N, -1); etype[0] = 1; int last = 0; for (const auto & lct : locations_sorted) { if (lct.first <= location[0]) continue ; int exp = lct.first - location[0]; int dst = getDistance(0, lct.second); if (dst != exp) continue ; etype[lct.second] = 2; last = lct.second; } int nlast = 0; for (int i = locations_sorted.size() - 1; i >= 0; i --) { const auto &lct = locations_sorted[i]; if (lct.first >= location[last]) continue ; int exp = location[last] - lct.first; int dst = getDistance(last, lct.second); if (dst != exp) continue ; etype[lct.second] = 1; nlast = i; } for (int i = 0; i < locations_sorted.size(); i ++) { const auto &lct = locations_sorted[i]; int exp = lct.first - location[nlast]; if (exp <= 0) continue; int dst = getDistance(lct.first, nlast); if (dst != exp) continue ; etype[lct.second] = 2; nlast = i; } for (int i = 0; i < N; i ++) stype[i] = etype[i]; }

Compilation message (stderr)

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