Submission #720613

#TimeUsernameProblemLanguageResultExecution timeMemory
720613n1kRoller Coaster Railroad (IOI16_railroad)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define ll long long #define vt vector #define pb push_back #define ar array #define all(x) (x).begin(), (x).end() #define sz(x) (x).size() using namespace std; /* 1. simplify 2. add new elements 3. brute force solution 4. optimize 5. start implementing */ // --- templates --- // --- code --- ll plan_roller_coaster(int n, vt<int> s, vt<int> t){ set<ar<int, 2>> a; for(int i = 0; i < n; i++){ a.insert({t[i], s[i]}); } /* pick largest exit speed search for largest exit <= entry speed */ //auto [exit, entry] = *(--a.end()); auto arr = *(--a.end()); int exit = arr[0], entry = arr[1]; a.erase(--a.end()); while (sz(a)){ auto it = a.lower_bound({entry + 1}); if(it == a.begin()){ return 1; } it--; arr = *it; exit = arr[0], entry = arr[1]; a.erase(it); } return 0; }

Compilation message (stderr)

railroad.cpp: In function 'long long int plan_roller_coaster(int, std::vector<int>, std::vector<int>)':
railroad.cpp:35:6: warning: variable 'exit' set but not used [-Wunused-but-set-variable]
   35 |  int exit = arr[0], entry = arr[1];
      |      ^~~~
/usr/bin/ld: /tmp/ccnmorQ5.o: in function `main':
grader.cpp:(.text.startup+0xf4): undefined reference to `plan_roller_coaster(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status