Submission #827583

#TimeUsernameProblemLanguageResultExecution timeMemory
827583caganyanmazRoller Coaster Railroad (IOI16_railroad)C++14
0 / 100
76 ms11716 KiB
#include <bits/stdc++.h> #define mp(x...) array<int, 2>({x}) #define pb push_back #define int int64_t #include "railroad.h" using namespace std; #ifdef DEBUGGING #include "../debug.h" #else #define debug(x...) void(42) #endif long long plan_roller_coaster(vector<int32_t> s, vector<int32_t> t) { int n = s.size(); vector<array<int, 2>> vals; for (int i = 0; i < n; i++) { vals.pb({s[i], +1}); vals.pb({t[i], -1}); } sort(vals.begin(), vals.end()); int pf = vals[0][1] - 1; int res = 0; for (int i = 1; i < vals.size(); i++) { if (pf > 0) res += pf * (vals[i][0] - vals[i-1][0]); debug(pf, vals[i-1][0], vals[i][0], res); pf += vals[i][1]; } return res; }

Compilation message (stderr)

railroad.cpp: In function 'long long int plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:27:20: warning: comparison of integer expressions of different signedness: 'int64_t' {aka 'long int'} and 'std::vector<std::array<long int, 2> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |  for (int i = 1; i < vals.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...