Submission #1020472

#TimeUsernameProblemLanguageResultExecution timeMemory
1020472vjudge1Detecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
// #pragma once #include <bits/stdc++.h> using namespace std; typedef long long ll; std::vector<int> find_subset(int l, int u, std::vector<int> w){ int mn = 1111, cnt = 0; for(int x: w){ if(x < mn){ mn = x; cnt = 0; } cnt += mn == x; } for(int i = 1; i <= w.size(); i++){ int cal = max(0, (i - cnt)); if(mn * i + cal < l){ cal = l - mn * i; } if(cal <= min(i, w.size() - cnt) && mn * i + cal <= u){ int x = i - cal, y = cal; vector<int> ans; for(int i = 0; i < w.size(); i++){ if(w[i] == mn && x){ x--; ans.push_back(i); } else if(w[i] == mn + 1 && y){ y--; ans.push_back(i); } } return ans; } } return {}; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:16:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |  for(int i = 1; i <= w.size(); i++){
      |                 ~~^~~~~~~~~~~
molecules.cpp:21:34: error: no matching function for call to 'min(int&, std::vector<int>::size_type)'
   21 |   if(cal <= min(i, w.size() - cnt) && mn * i + cal <= u){
      |                                  ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from molecules.cpp:3:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
molecules.cpp:21:34: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::vector<int>::size_type' {aka 'long unsigned int'})
   21 |   if(cal <= min(i, w.size() - cnt) && mn * i + cal <= u){
      |                                  ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from molecules.cpp:3:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
molecules.cpp:21:34: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::vector<int>::size_type' {aka 'long unsigned int'})
   21 |   if(cal <= min(i, w.size() - cnt) && mn * i + cal <= u){
      |                                  ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from molecules.cpp:3:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
molecules.cpp:21:34: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   21 |   if(cal <= min(i, w.size() - cnt) && mn * i + cal <= u){
      |                                  ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from molecules.cpp:3:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
molecules.cpp:21:34: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   21 |   if(cal <= min(i, w.size() - cnt) && mn * i + cal <= u){
      |                                  ^
molecules.cpp:24:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |    for(int i = 0; i < w.size(); i++){
      |                   ~~^~~~~~~~~~