Submission #1042847

#TimeUsernameProblemLanguageResultExecution timeMemory
1042847ZicrusRoller Coaster Railroad (IOI16_railroad)C++17
0 / 100
2061 ms8020 KiB
#include <bits/stdc++.h> #include "railroad.h" using namespace std; typedef long long ll; ll plan_roller_coaster(vector<int> s, vector<int> t) { ll n = s.size(); map<ll, ll> m; for (int i = 0; i < 10000; i++) { m[s[i]] = t[i]; } ll cur = (*m.begin()).second; m.erase(m.begin()); ll res = 0; while (!m.empty()) { auto iter = lower_bound(m.begin(), m.end(), pair<const ll, ll>(cur, 0)); if (iter == m.end()) return 1; cur = (*iter).second; m[(*iter).first] = -1000; } return 0; }

Compilation message (stderr)

railroad.cpp: In function 'll plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:8:8: warning: unused variable 'n' [-Wunused-variable]
    8 |     ll n = s.size();
      |        ^
railroad.cpp:17:8: warning: unused variable 'res' [-Wunused-variable]
   17 |     ll res = 0;
      |        ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...