제출 #530764

#제출 시각아이디문제언어결과실행 시간메모리
530764CyanmondRoller Coaster Railroad (IOI16_railroad)C++17
0 / 100
131 ms13692 KiB
#include <bits/stdc++.h> using i64 = long long; template <typename T> using Vec = std::vector<T>; constexpr int inf = 1100000000; constexpr i64 inf64 = 2000000000000000000; template <typename T> bool setmin(T &a, const T v) { if (a > v) { a = v; return true; } return false; } long long plan_roller_coaster(std::vector<int> S, std::vector<int> T) { const int N = (int)S.size(); std::vector<int> order(N); std::iota(order.begin(), order.end(), 0); const int min_id = *std::min_element(order.begin(), order.end(), [&](const int a, const int b) { if (S[a] != S[b]) return S[a] < S[b]; else return T[a] < T[b]; }); std::multiset<std::pair<int, int>> set; for (int i = 0; i < N; ++i) if (i != min_id) set.insert({S[i], T[i]}); bool answer = true; int now_t = T[min_id]; assert((int)set.size() == N - 1); int cnt = 0; while (not set.empty()) { ++cnt; auto itr = set.lower_bound({now_t, 0}); if (itr != set.end()) { now_t = itr->second; set.erase(itr); } else { answer = false; break; } } // subtask 3 return 1; }

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

railroad.cpp: In function 'long long int plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:31:10: warning: variable 'answer' set but not used [-Wunused-but-set-variable]
   31 |     bool answer = true;
      |          ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...