Submission
Status:
[PPPPTSSSSSSSSSSSSSSS]
Subtask/Task Score:
{0/100}
Score: 0
User: letdown
Problemset: ฮีโร่และมอนสเตอร์
Language: cpp
Time: 1.094 second
Submitted On: 2026-03-12 11:43:10
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
cin.tie(NULL)->sync_with_stdio(0);
int n, m, p, c;
cin >> n >> m;
int h[n], ans[n];
multiset<pair<int, int>> ms;
for (int i = 0; i < n; i++) cin >> h[i];
for (int i = 0; i < m; i++) {
cin >> p >> c;
ms.insert({p, c});
}
// for (auto i : ms) cout << i.first << "," << i.second << " ";
for (int i = 0; i < n; i++) {
ans[i] = 0;
for (auto j : ms) {
if (j.first <= h[i]) {
ans[i] += j.second;
}
}
}
for (auto i : ans) cout << i << "\n";
}