제출 #1009910

#제출 시각아이디문제언어결과실행 시간메모리
1009910boris_mihov추월 (IOI23_overtaking)C++17
0 / 100
1 ms348 KiB
#include "overtaking.h" #include <algorithm> #include <iostream> #include <numeric> #include <cassert> #include <vector> typedef long long llong; const int MAXN = 1000 + 10; const int MAXQ = 5000 + 10; int n, m, l, x; std::vector <int> s; std::vector <std::pair <llong,int>> buses; std::vector <std::pair <llong,llong>> t[MAXN]; void init(int L, int N, std::vector <long long> T, std::vector <int> W, int X, int M, std::vector <int> S) { n = N; m = M; s = S; x = X; for (int i = 0 ; i < n ; ++i) { buses.push_back({T[i], W[i]}); } for (int i = 0 ; i + 1 < m ; ++i) { t[i].push_back({-1, 0}); std::vector <std::pair <llong,int>> newBuses; std::sort(buses.begin(), buses.end()); for (const auto &[time, w] : buses) { llong arrive = 1LL * (s[i + 1] - s[i]) * w + time; if (arrive > t[i].back().second) { t[i].push_back({time, arrive}); } newBuses.push_back({t[i].back().second, w}); } buses = newBuses; } } long long arrival_time(llong time) { for (int i = 0 ; i + 1 < m ; ++i) { int l = 0, r = t[i].size(), mid; while (l < r - 1) { mid = l + r >> 1; if (t[i][mid].first < time) l = mid; else r = mid; } time = std::max(time + x * (s[i + 1] - s[i]), t[i][l].second); } return time; }

컴파일 시 표준 에러 (stderr) 메시지

overtaking.cpp: In function 'long long int arrival_time(llong)':
overtaking.cpp:56:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   56 |             mid = l + r >> 1;
      |                   ~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...