QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#465832 | #3872. Gym Badges | jdkjrejvm | Compile Error | / | / | C11 | 1.2kb | 2024-07-07 10:47:52 | 2024-07-07 10:47:53 |
Judging History
This is the latest submission verdict.
- [2024-07-07 10:47:53]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-07-07 10:47:52]
- Submitted
answer
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
const int N = 500010;
int X[N], L[N];
class FastScanner {
public:
FastScanner() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
}
int nextInt() {
int x;
cin >> x;
return x;
}
};
int main() {
FastScanner f;
int n = f.nextInt();
priority_queue<int> q;
vector<array<int, 3>> tr;
for (int i = 1; i <= n; ++i) X[i] = f.nextInt();
for (int i = 1; i <= n; ++i) L[i] = f.nextInt();
for (int i = 1; i <= n; ++i) tr.push_back({X[i] + L[i], X[i], L[i]});
sort(tr.begin(), tr.end());
long long sum = 0, ans = 0;
for (int i = 1; i <= n; ++i) {
auto &c = tr[i - 1];
int X1 = c[1], L1 = c[2];
if (sum <= L1) {
sum += X1;
q.push(X1);
++ans;
} else {
if (!q.empty() && q.top() > X1) {
sum -= q.top();
q.pop();
sum += X1;
q.push(X1);
}
}
}
cout << ans << "\n";
return 0;
}
详细
answer.code:1:10: fatal error: iostream: No such file or directory #include <iostream> ^~~~~~~~~~ compilation terminated.