QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#293539#7122. Overtakingdanielkou5855Compile Error//C++172.1kb2023-12-29 12:05:262024-04-28 08:23:56

Judging History

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

  • [2024-04-28 08:23:56]
  • 管理员手动重测本题所有提交记录
  • [2023-12-29 12:05:27]
  • 评测
  • [2023-12-29 12:05:26]
  • 提交

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;
	}
}

signed main() {
	cin.tie(0) -> sync_with_stdio(false);

	
}

詳細信息

/usr/bin/ld: /tmp/cchlckKl.o: in function `main':
answer.code:(.text.startup+0x0): multiple definition of `main'; /tmp/ccealbJk.o:implementer.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status