제출 #848330

#제출 시각아이디문제언어결과실행 시간메모리
848330math_rabbit_1028추월 (IOI23_overtaking)C++17
0 / 100
53 ms2548 KiB
#include "overtaking.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; int l, n, x, m; vector<ll> t; vector<int> w, s; void init(int L, int N, vector<ll> T, vector<int> W, int X, int M, vector<int> S) { l = L; n = N; t = T; w = W; x = X; m = M; s = S; return; } ll est[1010][1010], arr[1010][1010]; ll arrival_time(ll Y) { for (int i = 0; i < n; i++) arr[0][i] = t[i]; arr[0][n] = Y; for (int j = 1; j < m; j++) { for (int i = 0; i < n; i++) est[j][i] = arr[j - 1][i] + (ll)w[i] * (s[j] - s[j - 1]); est[j][n] = arr[j - 1][n] + (ll)x * (s[j] - s[j - 1]); vector<pll> tlist; for (int i = 0; i <= n; i++) tlist.push_back({arr[j - 1][i], i}); sort(tlist.begin(), tlist.end()); ll last = 0, p = 0; for (int i = 0; i <= n; i++) { arr[j][tlist[i].second] = max(last, est[j][tlist[i].second]); last = max(last, est[j][tlist[i].second]); } } return arr[m - 1][n]; }

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

overtaking.cpp: In function 'll arrival_time(ll)':
overtaking.cpp:31:22: warning: unused variable 'p' [-Wunused-variable]
   31 |         ll last = 0, p = 0;
      |                      ^
#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...