QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#293317 | #7122. Overtaking | Insert_Username_Here | 0 | 1ms | 4140kb | C++20 | 1.8kb | 2023-12-29 03:52:57 | 2024-04-28 08:16:16 |
Judging History
answer
#include <bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
// cope counter = 2254
// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
ll n, l, x;
vector<pair<ll, ll>> kms[1001];
vector<pair<ll, pair<ll, ll>>> ans;
map<ll, pair<ll, ll>> bk;
void init(int L, int N, vector<ll> t, vector<int> w, int X, int m, vector<int> S) {
n = N, l = L, x = X;
vector<ll> s;
for(ll i : S) s.push_back(i);
vector<pair<pair<ll, ll>, ll>> kk;
ll smax;
for(ll i = 0; i < m - 1; i++) {
kk.clear();
for(ll j = 0; j < n; j++) kk.push_back(mp(mp(t[j], w[j] - x), j));
sort(kk.begin(), kk.end());
smax = -1e18;
for(auto j : kk) {
smax = max(smax, j.f.f + j.f.s * (s[i + 1] - s[i]));
kms[i + 1].push_back(mp(j.f.f, smax));
t[j.s] = smax;
}
}
map<ll, pair<ll, ll>>::iterator it;
ll l, r;
for(ll i = 1; i < m; i++) {
sort(kms[i].begin(), kms[i].end(), greater<pair<ll, ll>>());
cout << i << "\n";
for(auto j : kms[i]) cout << j.f << " " << j.s << "\n";
for(auto j : kms[i]) {
if(j.f < j.s) {
l = j.f + 1, r = j.s;
it = bk.upper_bound(r);
if(it != bk.end()) r = min(r, it->s.f - 1);
while(it != bk.begin() && (--it)->f >= j.f + 1) {
l = min(l, it->s.f);
bk.erase(it);
it = bk.upper_bound(r);
}
cout << j.s << " " << l << " " << r << "\n";
if(l <= r) bk[j.s] = mp(l, r);
}
}
cout << "\n";
}
for(auto i : bk) ans.push_back(mp(i.s.f, mp(i.s.s, i.f)));
}
ll arrival_time(ll y) {
vector<pair<ll, pair<ll, ll>>>::iterator it = upper_bound(ans.begin(), ans.end(), mp(y, mp((ll)(1e18), (ll)(1e18))));
if(it == ans.begin()) return y + x * l;
it--;
if(it->s.f >= y) return it->s.s + x * l;
return y + x * l;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 4140kb
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:
1 100000 100076 100076 100001 100076 2 100076 100102 100102 100077 100102 3 100102 100178 100178 100103 100178 4 100178 100184 100184 100179 100184 5 100184 100210 100210 100185 100210 6 100210 100234 100234 100211 100234 7 100234 100238 100238 100235 100238 8 100238 100244 100244 100239 1002...
result:
wrong answer secret mismatch
Subtask #2:
score: 0
Wrong Answer
Test #12:
score: 0
Wrong Answer
time: 0ms
memory: 3852kb
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:
1 811331273 944044184 754044184 944044184 754044052 756044052 754044023 756044023 754044023 756044023 754043872 756043872 754043355 756043355 754042768 756042768 752042033 756042033 750041583 756041583 744041170 756041170 744040571 756040571 744039766 756039766 628481593 756039191 566039191 75603919...
result:
wrong answer secret mismatch
Subtask #3:
score: 0
Skipped
Dependency #1:
0%
Subtask #4:
score: 0
Skipped
Dependency #1:
0%
Subtask #5:
score: 0
Skipped
Dependency #1:
0%