제출 #85788

#제출 시각아이디문제언어결과실행 시간메모리
85788Vardanyan거래 (IZhO13_trading)C++14
100 / 100
492 ms54832 KiB
//#pragma GCC optimize "-O3" #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:21:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j = 0;j<op[i].size();j++){
                       ~^~~~~~~~~~~~~
trading.cpp:30:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j = 0;j<cl[i].size();j++){
                       ~^~~~~~~~~~~~~
trading.cpp:10: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:14: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...