제출 #41318

#제출 시각아이디문제언어결과실행 시간메모리
41318IvanC거래 (IZhO13_trading)C++14
100 / 100
239 ms65536 KiB
#include <bits/stdc++.h> using namespace std; typedef pair<int,int> ii; typedef tuple<int,int,int> trinca; priority_queue<ii> pq; vector<trinca> sweep; int N,M,ptr; int main(){ scanf("%d %d",&N,&M); for(int i = 1;i<=M;i++){ int l,r,x; scanf("%d %d %d",&l,&r,&x); sweep.push_back(make_tuple(l,x - l,r)); } sort(sweep.begin(),sweep.end()); for(int i = 1;i<=N;i++){ while(ptr < M && get<0>(sweep[ptr]) <= i ){ ii novo = ii(get<1>(sweep[ptr]),get<2>(sweep[ptr])); pq.push(novo); ptr++; } while(!pq.empty() && pq.top().second < i ){ pq.pop(); } if(!pq.empty()){ printf("%d ",pq.top().first + i); } else{ printf("0 "); } } printf("\n"); return 0; }

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

trading.cpp: In function 'int main()':
trading.cpp:9:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d",&N,&M);
                      ^
trading.cpp:12:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d %d",&l,&r,&x);
                             ^
#Verdict Execution timeMemoryGrader output
Fetching results...