QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#131581#4676. Amalgamated ArtichokesPetroTarnavskyi#Compile Error//C++171.2kb2023-07-27 17:57:252023-07-27 17:57:26

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-27 17:57:26]
  • 评测
  • [2023-07-27 17:57:25]
  • 提交

answer

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

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

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



int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	double p[4];
	cin >> n;
	FOR(i, 0, 4) {
		cin >> p[i];
	}
	vector<LL> fact(n + 1);
	vector<double> pw[4];
	FOR(i, 0, 4) {
		pw[i].resize(n + 1);
		pw[i][0] = 1;
		FOR(j, 1, n + 1) {
			pw[i][j] = pw[i][j - 1] * p[i];
		}
	}
	fact[0] = 1;
	FOR(i, 1, n + 1) {
		fact[i] = fact[i - 1] * i;
	}
	map<double, LL> mp;
	FOR(c0, 0, n + 1) {
		FOR(c1, 0, n + 1 - c0) {
			FOR(c2, 0, n + 1 - c0 - c1) {
				mp[pw[0][c0] * pw[1][c1] * pw[2][c2] * pw[3][n - c0 - c1 - c2]] = fact[n] / (fact[c0] * fact[c1] * fact[c2] * fact[c3]);
			}
		}
	}
	double ans = 0;
	while (true) {
		auto [val, cnt] = *mp.begin();
		mp.erase(mp.begin());
		if (cnt > 1) {
			mp[2 * val] += cnt / 2;
		}
		if (cnt % 2 == 1) {
		}
	}
	return 0;
}


Details

answer.code: In function ‘int main()’:
answer.code:47:148: error: ‘c3’ was not declared in this scope; did you mean ‘c2’?
   47 |                                 mp[pw[0][c0] * pw[1][c1] * pw[2][c2] * pw[3][n - c0 - c1 - c2]] = fact[n] / (fact[c0] * fact[c1] * fact[c2] * fact[c3]);
      |                                                                                                                                                    ^~
      |                                                                                                                                                    c2