Submission #964691

#TimeUsernameProblemLanguageResultExecution timeMemory
964691pccTrading (IZhO13_trading)C++17
100 / 100
197 ms29676 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pll pair<ll,ll> #define pii pair<int,int> #define fs first #define sc second #define tlll tuple<ll,ll,ll> const int mxn = 3e5+10; ll N,M; vector<pii> op[mxn]; multiset<int> st; int ans[mxn]; int main(){ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin>>N>>M; for(int i = 0;i<M;i++){ int a,b,c; cin>>a>>b>>c; op[a].push_back(pii(c-a,1)); op[b+1].push_back(pii(c-a,-1)); } for(int i = 1;i<=N;i++){ for(auto &j:op[i]){ if(j.sc>0)st.insert(j.fs); else st.erase(st.find(j.fs)); } if(st.empty())ans[i] = 0; else ans[i] = *st.rbegin()+i; } for(int i = 1;i<=N;i++)cout<<ans[i]<<' ';cout<<'\n'; return 0; }

Compilation message (stderr)

trading.cpp: In function 'int main()':
trading.cpp:34:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   34 |  for(int i = 1;i<=N;i++)cout<<ans[i]<<' ';cout<<'\n';
      |  ^~~
trading.cpp:34:43: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   34 |  for(int i = 1;i<=N;i++)cout<<ans[i]<<' ';cout<<'\n';
      |                                           ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...