QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#314502#836. Farm of MonstersKazdaleCompile Error//C++14712b2024-01-25 19:08:192024-01-25 19:08:19

Judging History

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

  • [2024-01-25 19:08:19]
  • 评测
  • [2024-01-25 19:08:19]
  • 提交

answer

#include <iostream>
#include <queue>
#defien int long long
using namespace std;
constexpr int MAXN(1000007);
int n, a, b, sum;
struct node{ int a, b; }x[MAXN];
priority_queue <int> q;
inline void read(int &temp) { cin >> temp; }
inline int ceil(int x, int y) { return (x / y) + (x % y != 0); }
signed main() {
	ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
	read(n), read(a), read(b);
	for (int i(1), t; i <= n; ++i)  read(t), x[i].a = ceil((t - 1) % b + 1, a), x[i].b = ceil(t, b);
	for (int i(1); i <= n; ++i) {
		q.push(x[i].a + 1), sum += x[i].b - x[i].a - 1;
		while (sum < -1) {
			sum += q.top();
			q.pop();
		}
	}
	cout << (int)q.size() << endl;
	return 0;
}

Details

answer.code:3:2: error: invalid preprocessing directive #defien; did you mean #define?
    3 | #defien int long long
      |  ^~~~~~
      |  define