제출 #89111

#제출 시각아이디문제언어결과실행 시간메모리
89111nika거래 (IZhO13_trading)C++14
0 / 100
482 ms66172 KiB
#include <bits/stdc++.h> using namespace std; const int N = 300*1000+5; vector<pair<int,int> > op[N]; vector<pair<int,int> > cl[N]; int a[N]; int main(){ int n,m; scanf("%d%d",&n,&m); vector<pair<pair<int,int>,int > > v; for(int i = 0;i<m;i++){ int l,r,x; scanf("%d%d%d",&l,&r,&x); op[l].push_back({x,i}); cl[r].push_back({x,i}); v.push_back({{l,r},x}); } set<pair<int,int> > ms; for(int i = 1;i<=n;i++){ for(int j = 0;j<op[i].size();j++){ int id = op[i][j].first-i; ms.insert({id,op[i][j].second}); } if(ms.size() == 0) continue; set<pair<int,int> >::iterator it = (--ms.end()); pair<int,int> now = *it; a[i] = v[now.second].second+(i-v[now.second].first.first); // printf("%d ",a[i]); for(int j = 0;j<cl[i].size();j++){ int id = cl[i][j].first-v[cl[i][j].second].first.first; ms.erase({id,cl[i][j].second}); } } for(int i = 1;i<=n;i++) printf("%d ",a[i]); printf("\n"); return 0; }

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

trading.cpp: In function 'int main()':
trading.cpp:20:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j = 0;j<op[i].size();j++){
                       ~^~~~~~~~~~~~~
trading.cpp:29:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j = 0;j<cl[i].size();j++){
                       ~^~~~~~~~~~~~~
trading.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&m);
     ~~~~~^~~~~~~~~~~~~~
trading.cpp:13:14: 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...