QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#368928#8516. LED MatrixPetroTarnavskyi#WA 1ms3776kbC++201.2kb2024-03-27 18:13:412024-03-27 18:13:43

Judging History

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

  • [2024-03-27 18:13:43]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3776kb
  • [2024-03-27 18:13:41]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second 

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int n;
	cin >> n;
	
	VI a(n), u(n), b(n), w(n);
	FOR (i, 0, n)
	{
		cin >> a[i] >> u[i] >> b[i] >> w[i];
	}
	LL ta = 0, tb = 0;
	FOR (i, 0, n)
	{
		ta += a[i] * u[i];
		tb += b[i] * w[i];
	}
	VI idx(n);
	iota(ALL(idx), 0);
	sort(ALL(idx), [&](int i, int j)
	{
		return a[i] - b[i] < a[j] - b[j];
	});
	db tta = 0, ttb = 0;
	FOR (i, 0, n)
	{
		ttb += b[i] * (u[i] + w[i]);
	}
	int j = 0;
	while (ttb > tb || (j < SZ(idx) && a[idx[j]] - b[idx[j]] < 0))
	{
		int i = idx[j];
		
		db x = 0;
		if (a[i] - b[i] < 0)
			x = min(db(u[i] + w[i]), db(ta - tta) / a[i]);
		else
			x = max(db(0), db(ttb - tb) / b[i]);
		tta += x * a[i];
		ttb -= x * b[i];
		j++;
	}
	cout << fixed << setprecision(15) << tta + ttb << '\n';
	
	return 0;
}

詳細信息

Test #1:

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

input:

6 6 6
****** --*---
****** -**---
****** ******
****** ******
****** -**---
*****- --*---

output:

0.000000000000000

result:

wrong answer 1st words differ - expected: 'N', found: '0.000000000000000'