Submission
Status:
[PP-SSSSSSSSSSSSSSSSS]
Score: 0
User: Pera
Problemset: ฮีโร่และมอนสเตอร์
Language: cpp
Time: 0.002 second
Submitted On: 2025-03-26 15:23:44
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
int heroes, monsters; cin >> heroes >> monsters;
vector<int> power(heroes);
for (int i = 0; i < heroes; ++i) {
cin >> power[i];
}
vector<pair<int, int>> hp(monsters);
for (int i = 0; i < monsters; ++i) {
cin >> hp[i].first >> hp[i].second;
}
vector<int> result;
for (int i = 0; i < heroes; ++i) {
int medals{0};
for (int j = 0; j < monsters; ++j) {
if (power[i] >= hp[j].first) {
medals += hp[j].second;
}
}
result.push_back(medals);
}
for (int m : result) {
cout << m << '\n';
}
}