Submission #47578

#TimeUsernameProblemLanguageResultExecution timeMemory
47578dqhungdlTrading (IZhO13_trading)C++17
100 / 100
437 ms30212 KiB
#include <bits/stdc++.h> using namespace std; int n,T; vector<int> g1[300005],g2[300005]; multiset<int> s; int main() { ios_base::sync_with_stdio(false); //freopen("TEST.INP","r",stdin); //freopen("TEST.OUT","w",stdout); cin>>n>>T; int l,r,x; while(T--) { cin>>l>>r>>x; g1[l].push_back(x-l); g2[r].push_back(x-l); } for(int i=1;i<=n;i++) { for(int j=0;j<g1[i].size();j++) s.insert(g1[i][j]); if(s.size()==0) cout<<0<<' '; else cout<<*s.rbegin()+i<<' '; for(int j=0;j<g2[i].size();j++) s.erase(s.find(g2[i][j])); } }

Compilation message (stderr)

trading.cpp: In function 'int main()':
trading.cpp:23:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j=0;j<g1[i].size();j++)
               ~^~~~~~~~~~~~~
trading.cpp:29:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j=0;j<g2[i].size();j++)
               ~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...