QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#215056#6547. Bansheeucup-team1766#Compile Error//C++231.4kb2023-10-15 02:45:342023-10-15 02:45:34

Judging History

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

  • [2023-10-15 02:45:34]
  • 评测
  • [2023-10-15 02:45:34]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

struct building {
	long long l;
	int t;
};

void run() {
	int n, m; cin >> n >> m;
	vector<building> b(n);
	long long sum = 0;
	for (int i = 0; i < n; i++) {
		long long x;
		int h, s;
		cin >> b[i].l >> x >> h >> s;
		b[i].l = max(0ll, b[i].l - 6);
		b[i].t = (h+s+23)/24;
		sum += b[i].t;
	}

	auto can = [&](double limit) {
		int extra = 0;
		long long pos = 0;
		int banshees = m;
		for (int i = 0; i < n; i++) {
			limit -= (b2[i].l - pos) / 5.25;
			pos = b2[i].l;
			long long damage = limit/.89;
			int total = b2[i].t;
			int sac = total/damage;
			banshees -= sac;
			total -= extra; extra = 0;
			total -= sac*damage;

			if (total > 0) {
				double limit2 = limit;
				long long pos2 = pos;
				limit2 -= total*.89;
				banshees -= 1;
				while (limit2 >= .89) {
					i++;
					if (i == n) break;
					limit2 -= (b2[i].l - pos2) / 5.25;
					pos2 = b2[i].l;
					damage = min((int)(limit2/.89), b2[i].t);
					extra = damage;
					limit2 -= damage*.89;
				}
				i--;
			}
			if (banshees < 0) {
				return false;
			}
		}
		return true;
	};

	double low = b[n-1].l/5.25 + sum*.89/m;
       	double high = sum*.89 + b[n-1].l/5.25 + 2;
	while (high - low >= 1e-5) {
		double mid = (low+high)/2;
		//cout << low << ' ' << high << endl;
		if (can(mid)) {
			high = mid;
		} else {
			low = mid + 1e-5;
		}
	}

	cout << fixed << setprecision(13) << low << '\n';
}

int main() {
	int t; cin >> t;
	while (t--) run();
}

Details

answer.code: In lambda function:
answer.code:27:35: error: ‘b2’ was not declared in this scope; did you mean ‘b’?
   27 |                         limit -= (b2[i].l - pos) / 5.25;
      |                                   ^~
      |                                   b