Submission

Status:

[PPPPTSSSSSSSSSSSSSSS]

Subtask/Task Score:

{0/100}

Score: 0

User: Neozaawwman1

Problemset: ฮีโร่และมอนสเตอร์

Language: cpp

Time: 1.096 second

Submitted On: 2026-03-10 18:38:34

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int N,M;
ll hero[200005];
pair<ll,ll> monster[800005];
int main(){
    ios_base::sync_with_stdio(0),cin.tie(0);
    cin>>N>>M;
    for(int i=0; i<N; i++){
        cin>>hero[i];
    }
    for(int i=0; i<M; i++){
        ll a,b;cin>>a>>b;
        monster[i]={a,b};
    }
    for(int i=0; i<N; i++){
        ll ct=0;
        for(int j=0; j<M; j++){
            if(hero[i]>=monster[j].first){
                ct+=monster[j].second;
            }
        }
        cout<<ct<<'\n';
    }
    return 0;
}