QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#511024#3403. Crossing RiversPetroTarnavskyi#WA 0ms3532kbC++201.3kb2024-08-09 15:17:472024-08-09 15:17:47

Judging History

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

  • [2024-08-09 15:17:47]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3532kb
  • [2024-08-09 15:17:47]
  • 提交

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 t, n, b;

void solve()
{
	vector<pair<db, int>> allFiles(t);
	for (auto& [s, p] : allFiles)
	{
		cin >> s >> p;
		p = 100 - p;
	}
	sort(ALL(allFiles));
	vector<db> curFiles;
	int ptr = 0;
	while (ptr < min(n, t))
	{
		auto [s, p] = allFiles[ptr++];
		curFiles.PB(p / 100.0 * s);
	}
	db ans = 0;
	while (!curFiles.empty())
	{
		auto it = min_element(ALL(curFiles));
		db mn = *it;
		curFiles.erase(it);
		ans += mn / b * SZ(curFiles);
		for (db& x : curFiles)
			x -= mn;
		if (ptr < t)
		{
			auto [s, p] = allFiles[ptr++];
			curFiles.PB(p / 100.0 * s);
		}
	}
	cout << ans << "\n" << "\n";
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(2);
	for (int tc = 1; ; tc++)
	{
		cin >> t >> n >> b;
		if (t == 0)
			return 0;
		cout << "Case " << tc << ": ";
		solve();
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3532kb

input:

0 811
8 860
37 20 15
73 29 22
124 42 2
169 86 25
289 18 9
325 176 28
551 68 13
717 24 16
4 573
203 64 8
272 35 19
386 37 30
457 115 18
6 609
70 37 30
110 96 16
229 79 9
329 126 16
468 76 26
575 27 23
2 717
172 89 19
690 15 17
9 993
0 40 11
71 1 22
144 7 17
198 45 9
260 46 27
324 139 12
652 25 16
765...

output:


result:

wrong answer 1st lines differ - expected: 'Case 1: 811.000', found: ''