제출 #965976

#제출 시각아이디문제언어결과실행 시간메모리
965976vjudge1거래 (IZhO13_trading)C++17
100 / 100
125 ms23084 KiB
#include <bits/stdc++.h> using namespace std; const int maxn = 300005; int n, q; vector<pair<int, int>> vc[maxn]; int ans[maxn]; int main(){ cin.tie(nullptr)->sync_with_stdio(false); cin >> n >> q; for (int i = 1; i <= q; ++i){ int l, r, val; cin >> l >> r >> val; vc[l].push_back({r, val - l}); } priority_queue<pair<int, int>> pq; for (int i = 1; i <= n; ++i){ while (!pq.empty() && pq.top().second < i) pq.pop(); for (int j = 0; j < vc[i].size(); ++j) pq.push({vc[i][j].second, vc[i][j].first}); if (!pq.empty()) ans[i] = pq.top().first + i; else ans[i] = 0; cout << ans[i] << ' '; } return 0; }

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

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