제출 #1058396

#제출 시각아이디문제언어결과실행 시간메모리
1058396Ignut추월 (IOI23_overtaking)C++17
65 / 100
3574 ms59052 KiB
/* Ignut started: 14.08.2024 now: 14.08.2024 ████████████████████████████████████████████████████████████████████ ████████████████████████████████ ████████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████ ██████████████████ ██████████████████ ██████ ██████ ██████████████ ██████████████ ██████ ██████ ██ ████████████ ████████████ ██ ██████ ██████ ████ ██████████ ██████████ ████ ██████ ██████ ████ ██████████ ██████████ ████ ██████ ██████ ████ ██████████ ██████████ ██████ ██████ ██████ ██████ ██████████ ██████████ ██████ ██████ ██████ ██████ ████████ ████████ ██████ ██████ ██████ ██████ ██████ ██████ ██████ ██████ ██████ ████ ████ ████ ████ ██████ ██████ ██████████ ████ ██████████ ██████ ██████ ██ ██████ ████████ ██████ ██ ██████ ██████ ██████ ████████ ██████ ██████ ██████ ██ ██ ██████ ██████████████████████ ████ ████ ██████████████████████ ████████████████████████ ██ ██ ████████████████████████ ██████████████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ████████████████████████████████████████████████████████████████████ */ #include <bits/stdc++.h> using namespace std; using ll = long long; int l; int n, m; vector<ll> t; vector<int> w; vector<int> s; int x; // <time, speed, next_time> vector<vector<tuple<ll, int, ll>>> vec; void init(int L, int N, vector<ll> T, vector<int> W, int X, int M, vector<int> S) { l = L; n = N; m = M; w = W; s = S; x = X; t = T; // <tm, speed> vector<pair<ll, int>> v; for (int i = 0; i < n; i ++) if (w[i] > x) v.push_back({t[i], w[i]}); sort(v.begin(), v.end()); for (int i = 1; i < m; i ++) { vector<pair<ll, int>> next; vector<tuple<ll, int, ll>> add; ll maxTime = 0; for (auto [tm, sp] : v) { ll e = tm + 1ll * (s[i] - s[i - 1]) * sp; next.push_back({max(e, maxTime), sp}); maxTime = max(e, maxTime); add.push_back({tm, sp, maxTime}); } vec.push_back(add); v = next; sort(v.begin(), v.end()); } } ll arrival_time(ll Y) { ll tm = Y, sp = x; int pos = vec[0].size() - 1; for (int i = 1; i < m; i ++) { // int lo = 0, hi = int(vec[0].size()) - 1; // while (lo < hi) { // int mid = lo + (hi - lo + 1) / 2; // if (get<0>(vec[i - 1][mid]) < tm) // lo = mid; // else // hi = mid - 1; // } while (pos > 0 && get<0>(vec[i - 1][pos]) >= tm) pos --; int lo = pos; // cout << lo << " : " << pos << '\n'; ll mx = tm + 1ll * (s[i] - s[i - 1]) * sp; if (lo < vec[i - 1].size() && get<0>(vec[i - 1][lo]) < tm) { mx = max(mx, get<2>(vec[i - 1][lo])); } tm = mx; } // cout << '\n'; return tm; }

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

overtaking.cpp: In function 'll arrival_time(ll)':
overtaking.cpp:83:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::tuple<long long int, int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   83 |         if (lo < vec[i - 1].size() && get<0>(vec[i - 1][lo]) < tm) {
      |             ~~~^~~~~~~~~~~~~~~~~~~
#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...