QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#328112#8046. Rock-Paper-Scissors PyramidPetroTarnavskyi#Compile Error//C++201.4kb2024-02-15 17:20:142024-02-15 17:20:14

Judging History

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

  • [2024-02-15 17:20:14]
  • 评测
  • [2024-02-15 17:20:14]
  • 提交

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;

const db EPS = 1e-9;
const db INF = 1e47;

vector<pair<db, LL>> compress(vector<pair<db, LL>> vec)
{
	sort(ALL(vec));
	vector<pair<db, LL>> res;
	for (auto [p, c] : vec)
	{
		if (res.empty() || abs(res.back().F - p) > EPS)
		{
			res.PB({p, c});
		}
		else
		{
			res.back().S += c;
		}
	}
	return res;
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	vector<pair<db, LL>> vec(n);
	for (auto& [p, c] : vec)
		cin >> p >> c;
	vec = compress(vec);
	vector<LL> sx[2];
	vector<db> sxx[2];
	FOR(j, 0, 2)
	{
		sx[j].resize(n + 1);
		sxx[j].resize(n + 1);
		FOR(i, 0, n)
		{
			auto& [p, c] = vec[i];
			sx[j][i + 1] = sx[j][i] + c;
			db x = abs(1 - p) < EPS ? INF : 1 / (1 - p);
			sxx[j][i + 1] = sx[j][i] * x;
			p = 1 - p;
		}
		reverse(ALL(vec));
	}
	reverse(ALL(sx[1]));
	reverse(ALL(sxx[1]));
	FOR(k, 0, 2)
	{
		FOR(j, 0, n + 1)
		{
			int i = lower_bound(sxx[0].begin(), sxx[0].begin() + i, sxx[1][j]);
		}
	}
	return 0;
}

Details

answer.code: In function ‘int main()’:
answer.code:72:44: error: cannot convert ‘__gnu_cxx::__normal_iterator<double*, std::vector<double> >’ to ‘int’ in initialization
   72 |                         int i = lower_bound(sxx[0].begin(), sxx[0].begin() + i, sxx[1][j]);
      |                                 ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                            |
      |                                            __gnu_cxx::__normal_iterator<double*, std::vector<double> >