QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#293370 | #7122. Overtaking | training4usaco | 0 | 1ms | 10004kb | C++17 | 3.6kb | 2023-12-29 05:54:43 | 2024-04-28 08:18:51 |
Judging History
answer
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
typedef long long ll;
#define pll pair<ll, ll>
#define pil pair<int, ll>
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
const int MAXN = 1e3 + 5;
const ll INF = 1e9 + 7;
ll tot, tot2; // tot number of things with less, num of checkpoints
ll shift;
pil bus[MAXN]; // speed, time
ll times[MAXN][MAXN];
ll ans[2 * MAXN * MAXN];
ll boundaries[2 * MAXN * MAXN];
set<ll> checkpoints;
struct Point {
ll t1, t2;
int i;
Point(){}
Point(ll t1, ll t2, int i) : t1(t1), t2(t2), i(i){}
bool operator<(const Point &other) const {
if(t1 == other.t1) {
if(t2 == other.t2) return i < other.i;
return t2 < other.t2;
}
return t1 < other.t1;
}
};
Point points[MAXN];
struct Segment {
ll l, r, t;
Segment(){}
Segment(ll l, ll r, ll t) : l(l), r(r), t(t){}
};
vector<Segment> segments[MAXN];
void init(int l, int n, vector<ll> t, vector<int> w, int x, int m, vector<int> s) {
shift = l * x;
tot = 0;
for(int i = 0; i < n; ++i) {
if(w[i] > x) bus[tot++] = {w[i], t[i]};
}
sort(bus, bus + tot);
for(int i = 0; i < tot; ++i) times[0][i] = bus[i].ss;
for(int i = 1; i < m; ++i) {
int dists = s[i] - s[i - 1];
for(int j = 0; j < tot; ++j) points[j] = Point(times[i - 1][j], times[i - 1][j] + dists * bus[j].ff, j);
sort(points, points + tot);
ll mx = 0; int idx = 0;
for(int j = 0; j < tot; ++j) {
while(points[idx].t1 < points[j].t1) {
mx = max(mx, points[idx].t2); ++idx;
}
times[i][points[j].i] = max(mx, points[j].t2) - dists * x;
}
vector<pll> curtime;
for(int j = 0; j < tot; ++j) curtime.push_back({times[i - 1][j], times[i][j]});
sort(all(curtime));
for(int j = 1; j < tot; ++j) curtime[j].ss = max(curtime[j].ss, curtime[j - 1].ss);
for(int j = 0; j < tot; ++j) {
ll lbound = curtime[j].ff + 1;
ll rbound;
if(j == tot - 1) rbound = curtime[j].ss;
else rbound = min(curtime[j + 1].ff, curtime[j].ss);
if(lbound <= rbound) segments[i].push_back(Segment(lbound, rbound, curtime[j].ss));
checkpoints.insert(lbound); checkpoints.insert(rbound + 1);
}
}
tot2 = 0;
for(auto checkpoint : checkpoints) {
ans[tot2] = checkpoint;
boundaries[tot2++] = checkpoint;
}
for(int i = 1; i < m; ++i) {
vector<pair<pll, ll>> prs;
for(auto [l, r, val] : segments[i]) {
ll lbound = lower_bound(ans, ans + tot2, l) - ans;
ll rbound = upper_bound(ans, ans + tot2, r) - ans;
if(lbound < rbound) prs.push_back({{lbound, rbound}, val});
}
for(auto [pr, v] : prs) {
for(int j = pr.ff; j < pr.ss; ++j) ans[j] = v;
}
}
}
ll arrival_time(ll y) {
ll pos = upper_bound(boundaries, boundaries + tot2, y) - boundaries - 1;
if(pos == -1 || boundaries[pos] == ans[pos]) {
return y + shift;
}
return ans[pos] + shift;
}
//signed main() {
// int l, n, x, m;
//
// cin >> l >> n;
// vector<ll> t(n);
// vector<int> w(n);
// for(int i = 0; i < n; ++i) cin >> t[i];
// for(int i = 0; i < n; ++i) cin >> w[i];
// cin >> x >> m;
// vector<int> s(m);
// for(int i = 0; i < m; ++i) cin >> s[i];
//
// init(l, n, t, w, x, m, s);
// cout << arrival_time(0) << " " << arrival_time(50) << endl;
//}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 9
Accepted
time: 0ms
memory: 9984kb
input:
XwWPuInrOjpekAwGKojzwKw3yVDtdkGS 2500 1 78 100 1000 100000 80 0 38 51 89 92 105 117 119 122 126 142 179 259 355 385 410 419 443 483 496 551 671 691 698 709 762 778 818 860 888 897 909 930 938 946 951 955 995 1045 1091 1164 1187 1215 1243 1264 1301 1363 1409 1416 1448 1504 1518 1535 1555 1562 1597 16...
output:
mGlgT4yvr1qPbquFwkxRVh9hMn0Mrxoz OK 299664 298224 299166 298008 295102 298070 297182 298650 298312 296396 296524 298070 295838 296910 296892 297374 298684 295184 295710 299062 296382 298684 298110 298008 299530 298766 295966 299062 296794 298998 299738 296418 298588 296876 295102 299860 295710 29577...
result:
ok
Test #2:
score: -9
Wrong Answer
time: 0ms
memory: 10004kb
input:
XwWPuInrOjpekAwGKojzwKw3yVDtdkGS 80000001 1 151251000 400 1000 10000 151251252 0 563193 647572 715146 1130358 1138744 1557704 2110181 2300143 2420378 2557533 2614949 2657752 2838017 2861875 3146425 3202178 3240281 3248583 3280296 3310987 3401711 3683587 3943976 4135364 4214616 4277932 4503844 476465...
output:
mGlgT4yvr1qPbquFwkxRVh9hMn0Mrxoz OK 17546320612 3325888992 7331374616 17097732388 12466277816 19074582320 3325888992 15767497720 21748231508 18557355092 17918018240 19436323532 5358436124 21624265400 9567548276 9754275236 6081553400 21840734912 12026269940 7725274556 3325888992 19313167604 789745557...
result:
wrong answer 3rd lines differ - on the 1st token, expected: '12100095744014512', found: '17546320612'
Subtask #2:
score: 0
Wrong Answer
Test #12:
score: 10
Accepted
time: 1ms
memory: 8032kb
input:
XwWPuInrOjpekAwGKojzwKw3yVDtdkGS 2000000 100 100 2 1000 566035866 424023571 564031634 266012245 266012901 566037245 106005324 106003684 266012594 424028440 424019007 106005224 564034079 424024371 424024546 566039191 424016814 424029581 82000890 754044052 566036512 424018510 424017279 424019925 42401...
output:
mGlgT4yvr1qPbquFwkxRVh9hMn0Mrxoz OK 768035150 768029581 1144044184 308008207 768029581 768029581 956039191 768029581 956041170 768029581 768029581 308008207 956039191 308008207 768029581 768029891 1144044184 418008550 768029581 468009953 308008207 1144044184 768035150 768029581 468010817 768029581 6...
result:
ok
Test #13:
score: -10
Wrong Answer
time: 1ms
memory: 8100kb
input:
XwWPuInrOjpekAwGKojzwKw3yVDtdkGS 10000000 400 1011 2 1000 173387969125 200337983261 77920310897 77652037350 182097978669 118267907350 174157972712 57062023028 118267909308 107247901578 174157973485 146027951049 53742020545 118267912197 174167974422 207927989121 137207921414 143227933063 77992040344 ...
output:
mGlgT4yvr1qPbquFwkxRVh9hMn0Mrxoz OK 119633459805 175698041718 202078053200 147558019271 184278044394 26402066385 138847988265 184278044758 55272085953 48322076681 48322078614 147558019271 34712071812 79797150244 108777970377 202078053200 86533925103 127627982513 54047206071 104222315544 202078049826...
result:
wrong answer 3rd lines differ - on the 1st token, expected: '128387906425', found: '119633459805'
Subtask #3:
score: 0
Skipped
Dependency #1:
0%
Subtask #4:
score: 0
Skipped
Dependency #1:
0%
Subtask #5:
score: 0
Skipped
Dependency #1:
0%