제출 #755614

#제출 시각아이디문제언어결과실행 시간메모리
755614gvancak거래 (IZhO13_trading)C++11
컴파일 에러
0 ms0 KiB
#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; }

컴파일 시 표준 에러 (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> _Tp* std::end(_Tp (&)[_Nm])'
  100 |     end(_Tp (&__arr)[_Nm])
      |     ^~~
/usr/include/c++/10/bits/range_access.h:81:5: note:                 'template<class _Container> 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> 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> _Tp* std::end(_Tp (&)[_Nm])'
  100 |     end(_Tp (&__arr)[_Nm])
      |     ^~~
/usr/include/c++/10/bits/range_access.h:81:5: note:                 'template<class _Container> 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> 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> _Tp* std::end(_Tp (&)[_Nm])'
  100 |     end(_Tp (&__arr)[_Nm])
      |     ^~~
/usr/include/c++/10/bits/range_access.h:81:5: note:                 'template<class _Container> 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> 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];
      |                        ^~~