/ SeriousOJ /

Record Detail

Compile Error

In file included from /usr/include/c++/13/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from foo.cc:1:
/usr/include/c++/13/bits/stl_algo.h: In instantiation of 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/13/bits/stl_algo.h:1859:25:   required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
/usr/include/c++/13/bits/stl_algo.h:1950:31:   required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
/usr/include/c++/13/bits/stl_algo.h:4861:18:   required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = long long int]'
foo.cc:15:10:   required from here
/usr/include/c++/13/bits/stl_algo.h:1822:17: error: no type named 'value_type' in 'struct std::iterator_traits<long long int>'
 1822 |                 __val = _GLIBCXX_MOVE(*__i);
      |                 ^~~~~
/usr/include/c++/13/bits/stl_algo.h:1824:15: error: invalid type argument of unary '*' (have 'long long int')
 1824 |               *__first = _GLIBCXX_MOVE(__val);
      |               ^~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:1822:17: error: no type named 'value_type' in 'struct std::iterator_traits<long long int>'
 1822 |                 __val = _GLIBCXX_MOVE(*__i);
      |                 ^~~~~
In file included from /usr/include/c++/13/bits/stl_algobase.h:71,
                 from /usr/include/c++/13/algorithm:60:
/usr/include/c++/13/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_less_iter::operator()(_Iterator1, _Iterator2) const [with _Iterator1 = long long int; _Iterator2 = long long int]':
/usr/include/c++/13/bits/stl_algo.h:1819:14:   required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
/usr/include/c++/13/bits/stl_algo.h:1859:25:   required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
/usr/include/c++/13/bits/stl_algo.h:1950:31:   required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
/usr/include/c++/13/bits/stl_algo.h:4861:18:   required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = long long int]'
foo.cc:15:10:   required from here
/usr/include/c++/13/bits/predefined_ops.h:45:16: error: invalid type argument of unary '*' (have 'long long int')
   45 |       { return *__it1 < *__it2; }
      |                ^~~~~~
/usr/include/c++/13/bits/predefined_ops.h:45:25: error: invalid type argument of unary '*' (have 'long long int')
   45 |       { return *__it1 < *__it2; }
      |                         ^~~~~~
In file included from /usr/include/c++/13/bits/stl_algo.h:61:
/usr/include/c++/13/bits/stl_heap.h: In instantiation of 'void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/13/bits/stl_algo.h:1635:23:   required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
/usr/include/c++/13/bits/stl_algo.h:1910:25:   required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
/usr/include/c++/13/bits/stl_algo.h:1926:27:   required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = long long int; _Size = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
/usr/include/c++/13/bits/stl_algo.h:1947:25:   required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
/usr/include/c++/13/bits/stl_algo.h:4861:18:   required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = long long int]'
foo.cc:15:10:   required from here
/usr/include/c++/13/bits/stl_heap.h:344:11: error: no type named 'value_type' in 'struct std::iterator_traits<long long int>'
  344 |           _ValueType;
      |           ^~~~~~~~~~
/usr/include/c++/13/bits/stl_heap.h:346:11: error: no type named 'difference_type' in 'struct std::iterator_traits<long long int>'
  346 |           _DistanceType;
      |           ^~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_heap.h: In instantiation of 'void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/13/bits/stl_algo.h:1638:19:   required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
/usr/include/c++/13/bits/stl_algo.h:1910:25:   required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
/usr/include/c++/13/bits/stl_algo.h:1926:27:   required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = long long int; _Size = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
/usr/include/c++/13/bits/stl_algo.h:1947:25:   required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
/usr/include/c++/13/bits/stl_algo.h:4861:18:   required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = long long int]'
foo.cc:15:10:   required from here
/usr/include/c++/13/bits/stl_heap.h:258:9: error: no type named 'value_type' in 'struct std::iterator_traits<long long int>'
  258 |         _ValueType;
      |         ^~~~~~~~~~
/usr/include/c++/13/bits/stl_heap.h:260:9: error: no type named 'difference_type' in 'struct std::iterator_traits<long long int>'
  260 |         _DistanceType;
      |         ^~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_heap.h:263:7: error: invalid type argument of unary '*' (have 'long long int')
  263 |       *__result = _GLIBCXX_MOVE(*__first);
      |       ^~~~~~~~~
In file included from /usr/include/c++/13/bits/stl_pair.h:61,
                 from /usr/include/c++/13/bits/stl_algobase.h:64:
/usr/include/c++/13/bits/stl_heap.h:263:19: error: invalid type argument of unary '*' (have 'long long int')
  263 |       *__result = _GLIBCXX_MOVE(*__first);
      |                   ^~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h: In instantiation of 'void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = long long int; _ForwardIterator2 = long long int]':
/usr/include/c++/13/bits/stl_algo.h:91:20:   required from 'void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
/usr/include/c++/13/bits/stl_algo.h:1897:34:   required from '_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
/usr/include/c++/13/bits/stl_algo.h:1931:38:   required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = long long int; _Size = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
/usr/include/c++/13/bits/stl_algo.h:1947:25:   required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
/usr/include/c++/13/bits/stl_algo.h:4861:18:   required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = long long int]'
foo.cc:15:10:   required from here
/usr/include/c++/13/bits/stl_algobase.h:185:12: error: invalid type argument of unary '*' (have 'long long int')
  185 |       swap(*__a, *__b);
      |            ^~~~
/usr/include/c++/13/bits/stl_algobase.h:185:18: error: invalid type argument of unary '*' (have 'long long int')
  185 |       swap(*__a, *__b);
      |                  ^~~~

Code

#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){

   ll T; cin>>T;
   while(T--){
      ll N,K; cin>>N>>K;
      ll arr[N];
      ll sum=0;
      ll n=sizeof(arr)/sizeof(arr[0]);
      for(ll i=0;i<N;i++){
         cin>>arr[i];
      }
     sort(arr[K],arr[K+1]);
      for(ll i=0;i<K;i++){
         sum+=arr[i];

      }
    cout<<sum<<endl;
    sum=0;

   }
   return 0;
}

Information

Submit By
Type
Submission
Problem
P1149 Swap and Minimize
Contest
LU IUJPC : Sylhet Division 2024
Language
C++17 (G++ 13.2.0)
Submit At
2024-12-09 07:28:59
Judged At
2024-12-09 07:28:59
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes