Submission #1066923

#TimeUsernameProblemLanguageResultExecution timeMemory
1066923MunkhErdeneA Plus B (IOI23_aplusb)C++17
Compilation error
0 ms0 KiB
#include "aplusb.h" #define ll long long using namespace std; #define no cout<<"NO"<<endl #define yes cout<<"YES"<<endl const ll mod=998244353; vector<int> smallest_sums(int n, std::vector<int>arr1, std::vector<int>arr2){ sort(arr1, arr1+n); sort(arr2, arr2+n); int g=0; int h=0; vector <int> result(100'000); for(int i=0 ; i<n ; i++){ result[i]=arr1[g]+arr2[h]; if(arr1[g+1]+arr2[h]>arr1[g]+arr2[h+1]){ h++; } else{ g++; } } return result; }

Compilation message (stderr)

aplusb.cpp: In function 'std::vector<int> smallest_sums(int, std::vector<int>, std::vector<int>)':
aplusb.cpp:8:17: error: no match for 'operator+' (operand types are 'std::vector<int>' and 'int')
    8 |  sort(arr1, arr1+n);
      |             ~~~~^~
      |             |    |
      |             |    int
      |             std::vector<int>
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/vector:60,
                 from aplusb.h:1,
                 from aplusb.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:508:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename std::reverse_iterator<_Iterator>::difference_type, const std::reverse_iterator<_Iterator>&)'
  508 |     operator+(typename reverse_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:508:5: note:   template argument deduction/substitution failed:
aplusb.cpp:8:18: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
    8 |  sort(arr1, arr1+n);
      |                  ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/vector:60,
                 from aplusb.h:1,
                 from aplusb.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1540:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename std::move_iterator<_IteratorL>::difference_type, const std::move_iterator<_IteratorL>&)'
 1540 |     operator+(typename move_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1540:5: note:   template argument deduction/substitution failed:
aplusb.cpp:8:18: note:   mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
    8 |  sort(arr1, arr1+n);
      |                  ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/vector:60,
                 from aplusb.h:1,
                 from aplusb.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1185:5: note: candidate: 'template<class _Iterator, class _Container> __gnu_cxx::__normal_iterator<_Iterator, _Container> __gnu_cxx::operator+(typename __gnu_cxx::__normal_iterator<_Iterator, _Container>::difference_type, const __gnu_cxx::__normal_iterator<_Iterator, _Container>&)'
 1185 |     operator+(typename __normal_iterator<_Iterator, _Container>::difference_type
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1185:5: note:   template argument deduction/substitution failed:
aplusb.cpp:8:18: note:   mismatched types 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' and 'int'
    8 |  sort(arr1, arr1+n);
      |                  ^
aplusb.cpp:8:2: error: 'sort' was not declared in this scope; did you mean 'short'?
    8 |  sort(arr1, arr1+n);
      |  ^~~~
      |  short
aplusb.cpp:9:20: error: no match for 'operator+' (operand types are 'std::vector<int>' and 'int')
    9 |     sort(arr2, arr2+n);
      |                ~~~~^~
      |                |    |
      |                |    int
      |                std::vector<int>
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/vector:60,
                 from aplusb.h:1,
                 from aplusb.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:508:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename std::reverse_iterator<_Iterator>::difference_type, const std::reverse_iterator<_Iterator>&)'
  508 |     operator+(typename reverse_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:508:5: note:   template argument deduction/substitution failed:
aplusb.cpp:9:21: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
    9 |     sort(arr2, arr2+n);
      |                     ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/vector:60,
                 from aplusb.h:1,
                 from aplusb.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1540:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename std::move_iterator<_IteratorL>::difference_type, const std::move_iterator<_IteratorL>&)'
 1540 |     operator+(typename move_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1540:5: note:   template argument deduction/substitution failed:
aplusb.cpp:9:21: note:   mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
    9 |     sort(arr2, arr2+n);
      |                     ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/vector:60,
                 from aplusb.h:1,
                 from aplusb.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1185:5: note: candidate: 'template<class _Iterator, class _Container> __gnu_cxx::__normal_iterator<_Iterator, _Container> __gnu_cxx::operator+(typename __gnu_cxx::__normal_iterator<_Iterator, _Container>::difference_type, const __gnu_cxx::__normal_iterator<_Iterator, _Container>&)'
 1185 |     operator+(typename __normal_iterator<_Iterator, _Container>::difference_type
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1185:5: note:   template argument deduction/substitution failed:
aplusb.cpp:9:21: note:   mismatched types 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' and 'int'
    9 |     sort(arr2, arr2+n);
      |                     ^