제출 #894586

#제출 시각아이디문제언어결과실행 시간메모리
894586AndreyTrading (IZhO13_trading)C++14
100 / 100
141 ms26552 KiB
#include <bits/stdc++.h>
using namespace std;

vector<pair<int,int>> haha[500002];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,q,l,r,a;
    cin >> n >> q;
    for(int i = 0; i < q; i++) {
        cin >> l >> r >> a;
        haha[l].push_back({a-l,r});
    }
    priority_queue<pair<int,int>> idk;
    for(int i = 1; i <= n; i++) {
        for(int j = 0; j < haha[i].size(); j++) {
            idk.push(haha[i][j]);
        }
        while(!idk.empty() && idk.top().second < i) {
            idk.pop();
        }
        if(idk.empty()) {
            cout << 0 << " ";
        }
        else {
            cout << idk.top().first+i << " ";
        }
    }
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

trading.cpp: In function 'int main()':
trading.cpp:19:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |         for(int j = 0; j < haha[i].size(); j++) {
      |                        ~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...