제출 #1053081

#제출 시각아이디문제언어결과실행 시간메모리
1053081user736482거래 (IZhO13_trading)C++17
100 / 100
104 ms14660 KiB
#include<bits/stdc++.h> using namespace std; int n,m,l,r,x; vector<pair<int,pair<int,int>>>v; int odp[300007]; set<pair<int,int>,greater<pair<int,int>>>s; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin>>n>>m; for(int i=0;i<m;i++){ cin>>l>>r>>x; v.push_back({l,{x,r}}); } sort(v.begin(),v.end()); int point=0; for(int i=1;i<=n;i++){ //return 0; while(point<v.size() && v[point].first==i){ s.insert({v[point].second.first-i,v[point].second.second}); point++; } //return 0; if(s.empty()) s.insert({-i,i}); while((*s.begin()).second<i){ s.erase(s.begin()); if(s.empty()) s.insert({-i,i}); } odp[i]=(*s.begin()).first+i; cout<<odp[i]<<" "; } return 0; }

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

trading.cpp: In function 'int main()':
trading.cpp:19:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, std::pair<int, int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |         while(point<v.size() && v[point].first==i){
      |               ~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...