# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
308991 | giorgigagua2006 | Exercise Deadlines (CCO20_day1problem2) | 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>
using namespace std;
long long f[12312],n=12312,p,k;
priority_queue<long long>q;
void upd(int i, int value)
{
while(i<n)
{
f[i]+=value;
i+=(i & -i);
}
}
int sum(int i)
{
int s=0;
while(i)
{
s+=f[i];
i-=(i & -i);
}
return s;
}
long long i,j,mx,ans;
long long d[223123];
vector<long long>v[213213];
int main()
{
for(i=1;i<=n;i++)
{
cin>>d[i];
v[d[i]].push_back(i);
}
for(i=n;i>0;i--)
{
for(j=0;j<v[i].size();j++)
q.push(v[i][j]);
if(q.size()==0)
{
cout<<-1;
return 0;
}
mx=q.top();
q.pop();
upd(n-mx+1,-1);
ans+=get(n-mx+1);
}
cout<<ans;
}
Compilation message (stderr)
Main.cpp: In function 'int main()': Main.cpp:37:12: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int, std::allocator<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare] 37 | for(j=0;j<v[i].size();j++) | ~^~~~~~~~~~~~ Main.cpp:47:24: error: no matching function for call to 'get(long long int)' 47 | ans+=get(n-mx+1); | ^ In file included from /usr/include/c++/9/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from Main.cpp:1: /usr/include/c++/9/utility:219:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(std::pair<_Tp1, _Tp2>&)' 219 | get(std::pair<_Tp1, _Tp2>& __in) noexcept | ^~~ /usr/include/c++/9/utility:219:5: note: template argument deduction/substitution failed: Main.cpp:47:24: note: mismatched types 'std::pair<_Tp1, _Tp2>' and 'long long int' 47 | ans+=get(n-mx+1); | ^ In file included from /usr/include/c++/9/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from Main.cpp:1: /usr/include/c++/9/utility:224:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(std::pair<_Tp1, _Tp2>&&)' 224 | get(std::pair<_Tp1, _Tp2>&& __in) noexcept | ^~~ /usr/include/c++/9/utility:224:5: note: template argument deduction/substitution failed: Main.cpp:47:24: note: mismatched types 'std::pair<_Tp1, _Tp2>' and 'long long int' 47 | ans+=get(n-mx+1); | ^ In file included from /usr/include/c++/9/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from Main.cpp:1: /usr/include/c++/9/utility:229:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(const std::pair<_Tp1, _Tp2>&)' 229 | get(const std::pair<_Tp1, _Tp2>& __in) noexcept | ^~~ /usr/include/c++/9/utility:229:5: note: template argument deduction/substitution failed: Main.cpp:47:24: note: mismatched types 'const std::pair<_Tp1, _Tp2>' and 'long long int' 47 | ans+=get(n-mx+1); | ^ In file included from /usr/include/c++/9/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from Main.cpp:1: /usr/include/c++/9/utility:234:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(const std::pair<_Tp1, _Tp2>&&)' 234 | get(const std::pair<_Tp1, _Tp2>&& __in) noexcept | ^~~ /usr/include/c++/9/utility:234:5: note: template argument deduction/substitution failed: Main.cpp:47:24: note: mismatched types 'const std::pair<_Tp1, _Tp2>' and 'long long int' 47 | ans+=get(n-mx+1); | ^ In file included from /usr/include/c++/9/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from Main.cpp:1: /usr/include/c++/9/utility:243:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp& std::get(std::pair<_T1, _T2>&)' 243 | get(pair<_Tp, _Up>& __p) noexcept | ^~~ /usr/include/c++/9/utility:243:5: note: template argument deduction/substitution failed: Main.cpp:47:24: note: mismatched types 'std::pair<_T1, _T2>' and 'long long int' 47 | ans+=get(n-mx+1); | ^ In file included from /usr/include/c++/9/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from Main.cpp:1: /usr/include/c++/9/utility:248:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp& std::get(const std::pair<_T1, _T2>&)' 248 | get(const pair<_Tp, _Up>& __p) noexcept | ^~~ /usr/include/c++/9/utility:248:5: note: template argument deduction/substitution failed: Main.cpp:47:24: note: mismatched types 'const std::pair<_T1, _T2>' and 'long long int' 47 | ans+=get(n-mx+1); | ^ In file included from /usr/include/c++/9/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from Main.cpp:1: /usr/include/c++/9/utility:253:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp&& std::get(std::pair<_T1, _T2>&&)' 253 | get(pair<_Tp, _Up>&& __p) noexcept | ^~~ /usr/include/c++/9/utility:253:5: note: template argument deduction/substitution failed: Main.cpp:47:24: note: mismatched types 'std::pair<_T1, _T2>' and 'long long int' 47 | ans+=get(n-mx+1); | ^ In file included from /usr/include/c++/9/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from Main.cpp:1: /usr/include/c++/9/utility:258:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp&& std::get(const std::pair<_T1, _T2>&&)' 258 | get(const pair<_Tp, _Up>&& __p) noexcept | ^~~ /usr/include/c++/9/utility:258:5: note: template argument deduction/substitution failed: Main.cpp:47:24: note: mismatched types 'const std::pair<_T1, _T2>' and 'long long int' 47 | ans+=get(n-mx+1); | ^ In file included from /usr/include/c++/9/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from Main.cpp:1: /usr/include/c++/9/utility:263:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp& std::get(std::pair<_Up, _Tp>&)' 263 | get(pair<_Up, _Tp>& __p) noexcept | ^~~ /usr/include/c++/9/utility:263:5: note: template argument deduction/substitution failed: Main.cpp:47:24: note: mismatched types 'std::pair<_Up, _Tp>' and 'long long int' 47 | ans+=get(n-mx+1); | ^ In file included from /usr/include/c++/9/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from Main.cpp:1: /usr/include/c++/9/utility:268:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp& std::get(const std::pair<_Up, _Tp>&)' 268 | get(const pair<_Up, _Tp>& __p) noexcept | ^~~ /usr/include/c++/9/utility:268:5: note: template argument deduction/substitution failed: Main.cpp:47:24: note: mismatched types 'const std::pair<_Up, _Tp>' and 'long long int' 47 | ans+=get(n-mx+1); | ^ In file included from /usr/include/c++/9/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from Main.cpp:1: /usr/include/c++/9/utility:273:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp&& std::get(std::pair<_Up, _Tp>&&)' 273 | get(pair<_Up, _Tp>&& __p) noexcept | ^~~ /usr/include/c++/9/utility:273:5: note: template argument deduction/substitution failed: Main.cpp:47:24: note: mismatched types 'std::pair<_Up, _Tp>' and 'long long int' 47 | ans+=get(n-mx+1); | ^ In file included from /usr/include/c++/9/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from Main.cpp:1: /usr/include/c++/9/utility:278:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp&& std::get(const std::pair<_Up, _Tp>&&)' 278 | get(const pair<_Up, _Tp>&& __p) noexcept | ^~~ /usr/include/c++/9/utility:278:5: note: template argument deduction/substitution failed: Main.cpp:47:24: note: mismatched types 'const std::pair<_Up, _Tp>' and 'long long int' 47 | ans+=get(n-mx+1); | ^ In file included from /usr/include/c++/9/tuple:39, from /usr/include/c++/9/functional:54, from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/9/algorithm:71, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from Main.cpp:1: /usr/include/c++/9/array:307:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp& std::get(std::array<_Tp, _Nm>&)' 307 | get(array<_Tp, _Nm>& __arr) noexcept | ^~~ /usr/include/c++/9/array:307:5: note: template argument deduction/substitution failed: Main.cpp:47:24: note: mismatched types 'std::array<_Tp, _Nm>' and 'long long int' 47 | ans+=get(n-mx+1); | ^ In file included from /usr/include/c++/9/tuple:39, from /usr/include/c++/9/functional:54, from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/9/algorithm:71, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from Main.cpp:1: /usr/include/c++/9/array:316:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp&& std::get(std::array<_Tp, _Nm>&&)' 316 | get(array<_Tp, _Nm>&& __arr) noexcept | ^~~ /usr/include/c++/9/array:316:5: note: template argument deduction/substitution failed: Main.cpp:47:24: note: mismatched types 'std::array<_Tp, _Nm>' and 'long long int' 47 | ans+=get(n-mx+1); | ^ In file included from /usr/include/c++/9/tuple:39, from /usr/include/c++/9/functional:54, from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/9/algorithm:71, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from Main.cpp:1: /usr/include/c++/9/array:324:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp& std::get(const std::array<_Tp, _Nm>&)' 324 | get(const array<_Tp, _Nm>& __arr) noexcept | ^~~ /usr/include/c++/9/array:324:5: note: template argument deduction/substitution failed: Main.cpp:47:24: note: mismatched types 'const std::array<_Tp, _Nm>' and 'long long int' 47 | ans+=get(n-mx+1); | ^ In file included from /usr/include/c++/9/tuple:39, from /usr/include/c++/9/functional:54, from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/9/algorithm:71, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from Main.cpp:1: /usr/include/c++/9/array:333:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp&& std::get(const std::array<_Tp, _Nm>&&)' 333 | get(const array<_Tp, _Nm>&& __arr) noexcept | ^~~ /usr/include/c++/9/array:333:5: note: template argument deduction/substitution failed: Main.cpp:47:24: note: mismatched types 'const std::array<_Tp, _Nm>' and 'long long int' 47 | ans+=get(n-mx+1); | ^ In file included from /usr/include/c++/9/functional:54, from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/9/algorithm:71, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from Main.cpp:1: /usr/include/c++/9/tuple:1320:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(std::tuple<_Elements ...>&)' 1320 | get(tuple<_Elements...>& __t) noexcept | ^~~ /usr/include/c++/9/tuple:1320:5: note: template argument deduction/substitution failed: Main.cpp:47:24: note: mismatched types 'std::tuple<_Elements ...>' and 'long long int' 47 | ans+=get(n-mx+1); | ^ In file included from /usr/include/c++/9/functional:54, from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/9/algorithm:71, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from Main.cpp:1: /usr/include/c++/9/tuple:1326:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(const std::tuple<_Elements ...>&)' 1326 | get(const tuple<_Elements...>& __t) noexcept | ^~~ /usr/include/c++/9/tuple:1326:5: note: template argument deduction/substitution failed: Main.cpp:47:24: note: mismatched types 'const std::tuple<_Elements ...>' and 'long long int' 47 | ans+=get(n-mx+1); | ^ In file included from /usr/include/c++/9/functional:54, from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/9/algorithm:71, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from Main.cpp:1: /usr/include/c++/9/tuple:1332:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(std::tuple<_Elements ...>&&)' 1332 | get(tuple<_Elements...>&& __t) noexcept | ^~~ /usr/include/c++/9/tuple:1332:5: note: template argument deduction/substitution failed: Main.cpp:47:24: note: mismatched types 'std::tuple<_Elements ...>' and 'long long int' 47 | ans+=get(n-mx+1); | ^ In file included from /usr/include/c++/9/functional:54, from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/9/algorithm:71, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from Main.cpp:1: /usr/include/c++/9/tuple:1341:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(const std::tuple<_Elements ...>&&)' 1341 | get(const tuple<_Elements...>&& __t) noexcept | ^~~ /usr/include/c++/9/tuple:1341:5: note: template argument deduction/substitution failed: Main.cpp:47:24: note: mismatched types 'const std::tuple<_Elements ...>' and 'long long int' 47 | ans+=get(n-mx+1); | ^ In file included from /usr/include/c++/9/functional:54, from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/9/algorithm:71, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from Main.cpp:1: /usr/include/c++/9/tuple:1364:5: note: candidate: 'template<class _Tp, class ... _Types> constexpr _Tp& std::get(std::tuple<_Elements ...>&)' 1364 | get(tuple<_Types...>& __t) noexcept | ^~~ /usr/include/c++/9/tuple:1364:5: note: template argument deduction/substitution failed: Main.cpp:47:24: note: mismatched types 'std::tuple<_Elements ...>' and 'long long int' 47 | ans+=get(n-mx+1); | ^ In file included from /usr/include/c++/9/functional:54, from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/9/algorithm:71, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from Main.cpp:1: /usr/include/c++/9/tuple:1370:5: note: candidate: 'template<class _Tp, class ... _Types> constexpr _Tp&& std::get(std::tuple<_Elements ...>&&)' 1370 | get(tuple<_Types...>&& __t) noexcept | ^~~ /usr/include/c++/9/tuple:1370:5: note: template argument deduction/substitution failed: Main.cpp:47:24: note: mismatched types 'std::tuple<_Elements ...>' and 'long long int' 47 | ans+=get(n-mx+1); | ^ In file included from /usr/include/c++/9/functional:54, from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/9/algorithm:71, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from Main.cpp:1: /usr/include/c++/9/tuple:1376:5: note: candidate: 'template<class _Tp, class ... _Types> constexpr const _Tp& std::get(const std::tuple<_Elements ...>&)' 1376 | get(const tuple<_Types...>& __t) noexcept | ^~~ /usr/include/c++/9/tuple:1376:5: note: template argument deduction/substitution failed: Main.cpp:47:24: note: mismatched types 'const std::tuple<_Elements ...>' and 'long long int' 47 | ans+=get(n-mx+1); | ^ In file included from /usr/include/c++/9/functional:54, from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/9/algorithm:71, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from Main.cpp:1: /usr/include/c++/9/tuple:1383:5: note: candidate: 'template<class _Tp, class ... _Types> constexpr const _Tp&& std::get(const std::tuple<_Elements ...>&&)' 1383 | get(const tuple<_Types...>&& __t) noexcept | ^~~ /usr/include/c++/9/tuple:1383:5: note: template argument deduction/substitution failed: Main.cpp:47:24: note: mismatched types 'const std::tuple<_Elements ...>' and 'long long int' 47 | ans+=get(n-mx+1); | ^ In file included from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:133, from Main.cpp:1: /usr/include/c++/9/variant:1583:5: note: candidate: 'template<long unsigned int _Np, class ... _Types> constexpr std::variant_alternative_t<_Np, std::variant<_Types ...> >& std::get(std::variant<_Types ...>&)' 1583 | get(variant<_Types...>& __v) | ^~~ /usr/include/c++/9/variant:1583:5: note: template argument deduction/substitution failed: Main.cpp:47:24: note: mismatched types 'std::variant<_Types ...>' and 'long long int' 47 |