제출 #168169

#제출 시각아이디문제언어결과실행 시간메모리
168169achibasadzishvili거래 (IZhO13_trading)C++14
100 / 100
470 ms55868 KiB
#include<bits/stdc++.h> #define ll long long #define f first #define s second #define pb push_back #define mp make_pair using namespace std; ll n,m,num[500005],L[500005],R[500005]; vector<pair<ll,ll> >v[500005]; vector<ll>er[500005]; multiset<pair<ll,ll> >st; int main(){ ios::sync_with_stdio(false); cin >> n >> m; for(int i=1; i<=m; i++){ ll x; cin >> L[i] >> R[i] >> x; num[i] = x; v[L[i]].pb(mp(x , i)); er[R[i] + 1].pb(i); } for(int i=1; i<=n; i++){ for(int j=0; j<v[i].size(); j++) st.insert(mp(-v[i][j].f - n + i , v[i][j].s)); for(int j=0; j<er[i].size(); j++) st.erase(st.find(mp(-num[er[i][j]] - n + L[er[i][j]] , er[i][j]))); if(st.size() == 0)cout << "0 "; else cout << num[(*st.begin()).s] + i - L[(*st.begin()).s] << " "; } return 0; }

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

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