QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#293540#7122. Overtakingdanielkou58550 1ms3856kbC++172.0kb2023-12-29 12:05:462024-04-28 08:23:56

Judging History

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

  • [2024-04-28 08:23:56]
  • 管理员手动重测本题所有提交记录
  • 测评结果:0
  • 用时:1ms
  • 内存:3856kb
  • [2023-12-29 12:05:47]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3728kb
  • [2023-12-29 12:05:46]
  • 提交

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

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
299632
298224
299162
297964
295102
298066
297104
298618
298242
296390
296472
298054
295828
296910
296888
297368
298654
295180
295604
299062
296354
298684
298110
297916
299516
298706
295962
299062
296784
298984
299736
296414
298580
296874
295078
299850
295590
29576...

result:

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

Subtask #2:

score: 0
Wrong Answer

Test #12:

score: 0
Wrong Answer
time: 1ms
memory: 3856kb

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
764551708
625005433
954136298
306500697
624768640
624669498
766301295
625136434
947580853
625100943
624760284
306475062
766644615
306776294
625698807
737888912
955288081
326658949
624965258
416149655
306877619
954101982
765386432
624737296
463254712
624909072
4668...

result:

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

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%

Subtask #5:

score: 0
Skipped

Dependency #1:

0%