QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#293532#7122. Overtakingdanielkou5855Compile Error//C++172.0kb2023-12-29 12:01:102024-04-28 08:23:40

Judging History

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

  • [2024-04-28 08:23:40]
  • 管理员手动重测本题所有提交记录
  • [2023-12-29 12:01:11]
  • 评测
  • [2023-12-29 12:01:10]
  • 提交

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.forst + smax[j].first.second * (S[i + 1] - S[i]));
			mmap[i + 1].push_back({smax[j].first.first, smin});
			T[j.s] = 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;
				
				it = map2.upper_bound(r);

				if (it != map.end()) {
					r = min(r, it->second.first - 1);
				}

				while (it != map.begin() && (prev(it))->first >= mmap[i][j].first + 1) {
					l = min(l, it->second.first);

					map.erase(it); it = map2.upper_bound(mmap[i][j].second);
				}

				if (l <= r) {
					bk[j.s] = {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), mp(y, mp((ll)(1e18), (ll)(1e18))));

	if (ret == ans.begin()) {
		return Y + Xcpy * Lcpy;
	}

	ret = prev(ret);
	
	if (it->second.first >= Y) {
		return it->second.second + Xcpy * Lcpy;
	} else {
		return Y + Xcpy * Lcpy;
	}
}

Details

answer.code: In function ‘void init(int, int, std::vector<long long int>, std::vector<int>, int, int, std::vector<int>)’:
answer.code:39:56: error: ‘struct std::pair<long long int, long long int>’ has no member named ‘forst’; did you mean ‘first’?
   39 |                         smin = max(smin, smax[j].first.forst + smax[j].first.second * (S[i + 1] - S[i]));
      |                                                        ^~~~~
      |                                                        first
answer.code:41:29: error: request for member ‘s’ in ‘j’, which is of non-class type ‘int’
   41 |                         T[j.s] = smin;
      |                             ^
answer.code:55:33: error: ‘it’ was not declared in this scope; did you mean ‘i’?
   55 |                                 it = map2.upper_bound(r);
      |                                 ^~
      |                                 i
answer.code:57:46: error: missing template arguments before ‘.’ token
   57 |                                 if (it != map.end()) {
      |                                              ^
answer.code:61:49: error: missing template arguments before ‘.’ token
   61 |                                 while (it != map.begin() && (prev(it))->first >= mmap[i][j].first + 1) {
      |                                                 ^
answer.code:64:44: error: expected unqualified-id before ‘.’ token
   64 |                                         map.erase(it); it = map2.upper_bound(mmap[i][j].second);
      |                                            ^
answer.code:68:41: error: ‘bk’ was not declared in this scope
   68 |                                         bk[j.s] = {l, r};
      |                                         ^~
answer.code:68:46: error: request for member ‘s’ in ‘j’, which is of non-class type ‘int’
   68 |                                         bk[j.s] = {l, r};
      |                                              ^
answer.code: In function ‘long long int arrival_time(long long int)’:
answer.code:80:45: error: ‘y’ was not declared in this scope
   80 |         auto ret = upper_bound(all(ans), mp(y, mp((ll)(1e18), (ll)(1e18))));
      |                                             ^
answer.code:80:48: error: ‘mp’ was not declared in this scope
   80 |         auto ret = upper_bound(all(ans), mp(y, mp((ll)(1e18), (ll)(1e18))));
      |                                                ^~
answer.code:80:42: error: ‘mp’ was not declared in this scope
   80 |         auto ret = upper_bound(all(ans), mp(y, mp((ll)(1e18), (ll)(1e18))));
      |                                          ^~
answer.code:88:13: error: ‘it’ was not declared in this scope; did you mean ‘int’?
   88 |         if (it->second.first >= Y) {
      |             ^~
      |             int