제출 #827525

#제출 시각아이디문제언어결과실행 시간메모리
827525caganyanmazRoller Coaster Railroad (IOI16_railroad)C++14
0 / 100
82 ms15648 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++) { debug(pf, vals[i-1][0], vals[i][0]); if ((pf == 0 && vals[i-1][0] != vals[0][0] && vals[i][0] != vals.back()[0]) || pf > 0) res += max<int>(pf, 1) * (vals[i][0] - vals[i-1][0]); pf += vals[i][1]; } return res; }

컴파일 시 표준 에러 (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...