QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#293542#7122. Overtakingdanielkou58550 1ms3900kbC++172.0kb2023-12-29 12:07:072024-04-28 08:24:00

Judging History

你现在查看的是最新测评结果

  • [2024-04-28 08:24:00]
  • 管理员手动重测本题所有提交记录
  • 测评结果:0
  • 用时:1ms
  • 内存:3900kb
  • [2023-12-29 12:07:07]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:4080kb
  • [2023-12-29 12:07:07]
  • 提交

answer

// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>

#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()

#define ll long long

using namespace std;

int 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<int> W, int X, int M, vector<int> 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 (int 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

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 9
Accepted
time: 1ms
memory: 3824kb

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: 0
Wrong Answer
time: 1ms
memory: 3900kb

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
17524979888
2725125476
7289189204
16978470764
12408050336
19092484652
2463991988
15627602084
21749064116
18577188500
17922985160
19443940232
5353811312
21717105476
9560215724
9763080512
5943313400
21845272676
11969624768
7745734580
2725125476
19322793500
790940303...

result:

wrong answer 3rd lines differ - on the 1st token, expected: '12100095744014512', found: '17524979888'

Subtask #2:

score: 0
Runtime Error

Test #12:

score: 0
Runtime Error

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:


result:


Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%

Subtask #5:

score: 0
Skipped

Dependency #1:

0%