Submission #946613

#TimeUsernameProblemLanguageResultExecution timeMemory
946613Zena_HossamTrading (IZhO13_trading)C++14
100 / 100
185 ms33156 KiB
#include <bits/stdc++.h> using namespace std; #define fi ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); //#define ll double #define ll long long //#define ll1 int #define F first #define S second #define sz size() #define all(s) s.begin(),s.end() #define all1(s) s.rbegin(),s.rend() int main() { //freopen("stdin.in","r",stdin);freopen("stdout.out","w",stdout); ll T=1; fi //cin>>T;ll oo=0; while(T--) { ll n,m; cin>>n>>m; ll a[m+5]= {},b[m+5]= {},c[m+5]={}; vector<pair<ll,ll>>s[n+5],v[n+5]; for(ll i=0; i<m; i++) { ll x,b1,c1; cin>>x>>b1>>c1;a[i]=x,b[i]=b1,c[i]=c1; s[x].push_back({c1,i}); }priority_queue<pair<ll,ll>>q;q.push({-1e18,0}); for(ll i=1; i<=n; i++) { for(ll j=0;j<s[i].sz;j++){ q.push({s[i][j].first-i-1,s[i][j].second}); } while(q.size()>1){//cout<<q.size()<<" "<<b[q.top().second]<<"\n"; if(b[q.top().second]>=i) break; q.pop(); } if(q.top().first==-1e18)cout<<0<<" "; else cout<<q.top().first+i+1<<" "; } } }

Compilation message (stderr)

trading.cpp: In function 'int main()':
trading.cpp:32:25: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |             for(ll j=0;j<s[i].sz;j++){
      |                         ^
#Verdict Execution timeMemoryGrader output
Fetching results...