Submission #1042359

#TimeUsernameProblemLanguageResultExecution timeMemory
1042359baldwinhuang1Roller Coaster Railroad (IOI16_railroad)C++14
0 / 100
31 ms14140 KiB
#include <bits/stdc++.h> using namespace std; long long plan_roller_coaster(vector<int> s, vector<int> t) { vector< pair<int, int> > st; for (int i = 0; i < s.size(); i++) { st.push_back({s[i], t[i]}); // cout << s[i] << '-' << t[i] << '\n'; } sort(st.begin(), st.end(), [](pair<int, int> i, pair<int, int> j){return i.second <= j.first;}); bool state = true; for (int i = 0; i < (st.size() - 1); i++) { if (st[i].second > st[i + 1].first) { state = false; } } // for (auto &i: st) { // cout << i.first << '-' << i.second << ' '; // } // cout << '\n'; return state; }

Compilation message (stderr)

railroad.cpp: In function 'long long int plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:8:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |     for (int i = 0; i < s.size(); i++) {
      |                     ~~^~~~~~~~~~
railroad.cpp:17: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]
   17 |     for (int i = 0; i < (st.size() - 1); 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...