QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#293544 | #7122. Overtaking | danielkou5855 | Compile Error | / | / | C++17 | 2.0kb | 2023-12-29 12:08:08 | 2024-04-28 08:24:06 |
Judging History
你现在查看的是最新测评结果
- [2024-04-28 08:24:06]
- 管理员手动重测本题所有提交记录
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-12-29 12:08:09]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-12-29 12:08:08]
- 提交
answer
// Source: https://usaco.guide/general/io
#include <bits/stdc++.h>
#define ll long long
#define all(x) x.begin(), x.end()
#define sz(x) (ll) x.size()
using namespace std;
ll Lcpy, Ncpy, Xcpy;
vector<pair<ll, ll>> mmap[1001];
vector<pair<ll, pair<ll, ll>>> ans;
map<ll, pair<ll, ll>> map2;
void init(int L, int N, vector<ll> T, vector<ll> W, int X, int M, vector<ll> S) {
Lcpy = L; Ncpy = N; Xcpy = X;
// for (int i = 0; i < N; i++) {
// W[i] -= X;
// }
vector<pair<pair<ll, ll>, ll>> smax;
ll smin;
for (int i = 0; i < M - 1; i++) {
smax.clear();
for (int j = 0; j < N; j++) {
smax.push_back({{T[j], W[j] - X}, j});
}
sort(smax.begin(), smax.end());
smin = -1e18;
for (int j = 0; j < sz(smax); j++) {
smin = max(smin, smax[j].first.first + smax[j].first.second * (S[i + 1] - S[i]));
mmap[i + 1].push_back({smax[j].first.first, smin});
T[smax[j].second] = smin;
}
}
map<ll, pair<ll, ll>>::iterator tmp;
ll l, r;
for (ll i = 1; i < M; i++) {
sort(mmap[i].begin(), mmap[i].end(), greater<pair<ll, ll>>());
for (int j = 0; j < sz(mmap[i]); j++) {
if (mmap[i][j].first < mmap[i][j].second) {
l = mmap[i][j].first + 1, r = mmap[i][j].second;
tmp = map2.upper_bound(r);
if (tmp != map2.end()) {
r = min(r, tmp->second.first - 1);
}
while (tmp != map2.begin() && (prev(tmp))->first >= mmap[i][j].first + 1) {
l = min(l, tmp->second.first);
map2.erase(tmp); tmp = map2.upper_bound(mmap[i][j].second);
}
if (l <= r) {
map2[mmap[i][j].second] = {l, r};
}
}
}
}
for (auto i : map2) {
ans.push_back({i.second.first, {i.second.second, i.first}});
}
}
ll arrival_time(ll Y) {
auto ret = upper_bound(all(ans), make_pair(Y, make_pair((ll) 1e18, (ll) 1e18)));
if (ret == ans.begin()) {
return Y + Xcpy * Lcpy;
}
ret = prev(ret);
if (ret->second.first >= Y) {
return ret->second.second + Xcpy * Lcpy;
} else {
return Y + Xcpy * Lcpy;
}
}
Details
/usr/bin/ld: /tmp/ccLts5ds.o: in function `main': implementer.cpp:(.text.startup+0x46d): undefined reference to `init(int, int, std::vector<long long, std::allocator<long long> >, std::vector<int, std::allocator<int> >, int, int, std::vector<int, std::allocator<int> >)' collect2: error: ld returned 1 exit status