# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
755616 | gvancak | Trading (IZhO13_trading) | C++17 | Compilation error | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define ll long long
#define s second
#define f first
using namespace std;
ll n,a[300005],sum,x,l,r,k,ans,t,ans1,y,u,m;
bool ok;
vector <ll> st[300005],end[300005];
multiset <ll> s;
int main(){
ios :: sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin>>n>>m;
for (int o=1; o<=m; o++){
cin>>l>>r>>x;
st[l].push_back(x-l+1);
end[r].push_back(x-l+1);
}
for (int i=1; i<=n; i++){
for (int j=0; j<st[i].size(); j++){
s.insert(st[i][j]);
}
if (s.size()==0) {
cout<<0<<" ";
continue;
}
set <ll> ::iterator it = s.end();
it--;
cout<<(*it)+i-1<<" ";
for (int j=0; j<end[i].size(); j++){
s.erase(s.find(end[i][j]));
}
}
cout<<endl;
}
Compilation message (stderr)
trading.cpp: In function 'int main()': trading.cpp:18:3: error: reference to 'end' is ambiguous 18 | end[r].push_back(x-l+1); | ^~~ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95, from trading.cpp:1: /usr/include/c++/10/valarray:1244:5: note: candidates are: 'template<class _Tp> const _Tp* std::end(const std::valarray<_Tp>&)' 1244 | end(const valarray<_Tp>& __va) | ^~~ /usr/include/c++/10/valarray:1234:5: note: 'template<class _Tp> _Tp* std::end(std::valarray<_Tp>&)' 1234 | end(valarray<_Tp>& __va) | ^~~ In file included from /usr/include/c++/10/string:54, from /usr/include/c++/10/bits/locale_classes.h:40, from /usr/include/c++/10/bits/ios_base.h:41, from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from trading.cpp:1: /usr/include/c++/10/bits/range_access.h:100:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])' 100 | end(_Tp (&__arr)[_Nm]) | ^~~ /usr/include/c++/10/bits/range_access.h:81:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)' 81 | end(const _Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/10/bits/range_access.h:71:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)' 71 | end(_Container& __cont) -> decltype(__cont.end()) | ^~~ In file included from /usr/include/c++/10/bits/range_access.h:36, from /usr/include/c++/10/string:54, from /usr/include/c++/10/bits/locale_classes.h:40, from /usr/include/c++/10/bits/ios_base.h:41, from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from trading.cpp:1: /usr/include/c++/10/initializer_list:101:5: note: 'template<class _Tp> constexpr const _Tp* std::end(std::initializer_list<_Tp>)' 101 | end(initializer_list<_Tp> __ils) noexcept | ^~~ trading.cpp:8:24: note: 'std::vector<long long int> end [300005]' 8 | vector <ll> st[300005],end[300005]; | ^~~ trading.cpp:22:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare] 22 | for (int j=0; j<st[i].size(); j++){ | ~^~~~~~~~~~~~~ trading.cpp:32:19: error: reference to 'end' is ambiguous 32 | for (int j=0; j<end[i].size(); j++){ | ^~~ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95, from trading.cpp:1: /usr/include/c++/10/valarray:1244:5: note: candidates are: 'template<class _Tp> const _Tp* std::end(const std::valarray<_Tp>&)' 1244 | end(const valarray<_Tp>& __va) | ^~~ /usr/include/c++/10/valarray:1234:5: note: 'template<class _Tp> _Tp* std::end(std::valarray<_Tp>&)' 1234 | end(valarray<_Tp>& __va) | ^~~ In file included from /usr/include/c++/10/string:54, from /usr/include/c++/10/bits/locale_classes.h:40, from /usr/include/c++/10/bits/ios_base.h:41, from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from trading.cpp:1: /usr/include/c++/10/bits/range_access.h:100:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])' 100 | end(_Tp (&__arr)[_Nm]) | ^~~ /usr/include/c++/10/bits/range_access.h:81:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)' 81 | end(const _Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/10/bits/range_access.h:71:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)' 71 | end(_Container& __cont) -> decltype(__cont.end()) | ^~~ In file included from /usr/include/c++/10/bits/range_access.h:36, from /usr/include/c++/10/string:54, from /usr/include/c++/10/bits/locale_classes.h:40, from /usr/include/c++/10/bits/ios_base.h:41, from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from trading.cpp:1: /usr/include/c++/10/initializer_list:101:5: note: 'template<class _Tp> constexpr const _Tp* std::end(std::initializer_list<_Tp>)' 101 | end(initializer_list<_Tp> __ils) noexcept | ^~~ trading.cpp:8:24: note: 'std::vector<long long int> end [300005]' 8 | vector <ll> st[300005],end[300005]; | ^~~ trading.cpp:33:19: error: reference to 'end' is ambiguous 33 | s.erase(s.find(end[i][j])); | ^~~ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95, from trading.cpp:1: /usr/include/c++/10/valarray:1244:5: note: candidates are: 'template<class _Tp> const _Tp* std::end(const std::valarray<_Tp>&)' 1244 | end(const valarray<_Tp>& __va) | ^~~ /usr/include/c++/10/valarray:1234:5: note: 'template<class _Tp> _Tp* std::end(std::valarray<_Tp>&)' 1234 | end(valarray<_Tp>& __va) | ^~~ In file included from /usr/include/c++/10/string:54, from /usr/include/c++/10/bits/locale_classes.h:40, from /usr/include/c++/10/bits/ios_base.h:41, from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from trading.cpp:1: /usr/include/c++/10/bits/range_access.h:100:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])' 100 | end(_Tp (&__arr)[_Nm]) | ^~~ /usr/include/c++/10/bits/range_access.h:81:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)' 81 | end(const _Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/10/bits/range_access.h:71:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)' 71 | end(_Container& __cont) -> decltype(__cont.end()) | ^~~ In file included from /usr/include/c++/10/bits/range_access.h:36, from /usr/include/c++/10/string:54, from /usr/include/c++/10/bits/locale_classes.h:40, from /usr/include/c++/10/bits/ios_base.h:41, from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from trading.cpp:1: /usr/include/c++/10/initializer_list:101:5: note: 'template<class _Tp> constexpr const _Tp* std::end(std::initializer_list<_Tp>)' 101 | end(initializer_list<_Tp> __ils) noexcept | ^~~ trading.cpp:8:24: note: 'std::vector<long long int> end [300005]' 8 | vector <ll> st[300005],end[300005]; | ^~~