답안 #992710

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
992710 2024-06-05T05:22:20 Z yellowtoad Super Dango Maker (JOI22_dango3) C++17
컴파일 오류
0 ms 0 KB
#include "dango3.h"
#include <iostream>
#include <vector>
using namespace std;

namespace {

vector<int> cur, tmp, ans, v, q;
bool b[10010];

}  // namespace

void Solve(int n, int m) {
  for (int i = 1; i <= n*m; i++) cur.push_back(i);
  for (int _ = 1; _ <= m; _++) {
    v.clear();
    for (int i = 0; i < cur.size(); i += m) {
      while (1) {
        q = v;
        /*for (int j = 0; j < v.size(); j++) cout << v[j] << " ";
        cout << " v" << endl;*/
        for (int j = i+m; j < cur.size(); j++) if (!b[cur[j]]) q.push_back(cur[j]);
        /*for (int j = 0; j < q.size(); j++) cout << q[j] << " ";
        cout << " gay" << endl;*/
        if (Query(q)) break;
        tmp.clear();
        for (int j = i; j < i+m; j++) if (!b[cur[j]]) tmp.push_back(cur[j]);
        int l = 0, r = (int)tmp.size()-1;
        while (l < r) {
          int mid = (l+r)/2;
          q = v;
          for (int j = mid+1; j < tmp.size(); j++) q.push_back(tmp[j]);
          for (int j = i+m; j < cur.size(); j++) if (!b[cur[j]]) q.push_back(cur[j]);
          if (Query(q)) l = mid+1;
          else r = mid-1;
        }
        b[tmp[l]] = 1;
        v.push_back(tmp[l]);
      }
    }
    tmp.clear();
    for (int i = 0; i < cur.size(); i++) if (!b[cur[i]]) tmp.push_back(cur[i]);
    if (v > n) cout << 1/0 << endl;
    Answer(v);
    cur = tmp;
  }
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:17:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |     for (int i = 0; i < cur.size(); i += m) {
      |                     ~~^~~~~~~~~~~~
dango3.cpp:22:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |         for (int j = i+m; j < cur.size(); j++) if (!b[cur[j]]) q.push_back(cur[j]);
      |                           ~~^~~~~~~~~~~~
dango3.cpp:32:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |           for (int j = mid+1; j < tmp.size(); j++) q.push_back(tmp[j]);
      |                               ~~^~~~~~~~~~~~
dango3.cpp:33:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |           for (int j = i+m; j < cur.size(); j++) if (!b[cur[j]]) q.push_back(cur[j]);
      |                             ~~^~~~~~~~~~~~
dango3.cpp:42:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |     for (int i = 0; i < cur.size(); i++) if (!b[cur[i]]) tmp.push_back(cur[i]);
      |                     ~~^~~~~~~~~~~~
dango3.cpp:43:11: error: no match for 'operator>' (operand types are 'std::vector<int>' and 'int')
   43 |     if (v > n) cout << 1/0 << endl;
      |         ~ ^ ~
      |         |   |
      |         |   int
      |         std::vector<int>
In file included from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/vector:60,
                 from dango3.h:1,
                 from dango3.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:502:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)'
  502 |     operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_pair.h:502:5: note:   template argument deduction/substitution failed:
dango3.cpp:43:13: note:   'std::vector<int>' is not derived from 'const std::pair<_T1, _T2>'
   43 |     if (v > n) cout << 1/0 << endl;
      |             ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/vector:60,
                 from dango3.h:1,
                 from dango3.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:378:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)'
  378 |     operator>(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:378:5: note:   template argument deduction/substitution failed:
dango3.cpp:43:13: note:   'std::vector<int>' is not derived from 'const std::reverse_iterator<_Iterator>'
   43 |     if (v > n) cout << 1/0 << endl;
      |             ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/vector:60,
                 from dango3.h:1,
                 from dango3.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:416:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)'
  416 |     operator>(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:416:5: note:   template argument deduction/substitution failed:
dango3.cpp:43:13: note:   'std::vector<int>' is not derived from 'const std::reverse_iterator<_Iterator>'
   43 |     if (v > n) cout << 1/0 << endl;
      |             ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/vector:60,
                 from dango3.h:1,
                 from dango3.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1469:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&)'
 1469 |     operator>(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1469:5: note:   template argument deduction/substitution failed:
dango3.cpp:43:13: note:   'std::vector<int>' is not derived from 'const std::move_iterator<_IteratorL>'
   43 |     if (v > n) cout << 1/0 << endl;
      |             ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/vector:60,
                 from dango3.h:1,
                 from dango3.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1519:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorL>&)'
 1519 |     operator>(const move_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1519:5: note:   template argument deduction/substitution failed:
dango3.cpp:43:13: note:   'std::vector<int>' is not derived from 'const std::move_iterator<_IteratorL>'
   43 |     if (v > n) cout << 1/0 << endl;
      |             ^
In file included from /usr/include/c++/10/vector:67,
                 from dango3.h:1,
                 from dango3.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1943:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator>(const std::vector<_Tp, _Alloc>&, const std::vector<_Tp, _Alloc>&)'
 1943 |     operator>(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1943:5: note:   template argument deduction/substitution failed:
dango3.cpp:43:13: note:   mismatched types 'const std::vector<_Tp, _Alloc>' and 'int'
   43 |     if (v > n) cout << 1/0 << endl;
      |             ^
In file included from /usr/include/c++/10/bits/basic_string.h:48,
                 from /usr/include/c++/10/string:55,
                 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/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from dango3.cpp:2:
/usr/include/c++/10/string_view:563:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(std::basic_string_view<_CharT, _Traits>, std::basic_string_view<_CharT, _Traits>)'
  563 |     operator> (basic_string_view<_CharT, _Traits> __x,
      |     ^~~~~~~~
/usr/include/c++/10/string_view:563:5: note:   template argument deduction/substitution failed:
dango3.cpp:43:13: note:   'std::vector<int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
   43 |     if (v > n) cout << 1/0 << endl;
      |             ^
In file included from /usr/include/c++/10/bits/basic_string.h:48,
                 from /usr/include/c++/10/string:55,
                 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/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from dango3.cpp:2:
/usr/include/c++/10/string_view:569:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(std::basic_string_view<_CharT, _Traits>, std::__type_identity_t<std::basic_string_view<_CharT, _Traits> >)'
  569 |     operator> (basic_string_view<_CharT, _Traits> __x,
      |     ^~~~~~~~
/usr/include/c++/10/string_view:569:5: note:   template argument deduction/substitution failed:
dango3.cpp:43:13: note:   'std::vector<int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
   43 |     if (v > n) cout << 1/0 << endl;
      |             ^
In file included from /usr/include/c++/10/bits/basic_string.h:48,
                 from /usr/include/c++/10/string:55,
                 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/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from dango3.cpp:2:
/usr/include/c++/10/string_view:576:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(std::__type_identity_t<std::basic_string_view<_CharT, _Traits> >, std::basic_string_view<_CharT, _Traits>)'
  576 |     operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
      |     ^~~~~~~~
/usr/include/c++/10/string_view:576:5: note:   template argument deduction/substitution failed:
dango3.cpp:43:13: note:   mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
   43 |     if (v > n) cout << 1/0 << endl;
      |             ^
In file included from /usr/include/c++/10/string:55,
                 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/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from dango3.cpp:2:
/usr/include/c++/10/bits/basic_string.h:6305:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 6305 |     operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6305:5: note:   template argument deduction/substitution failed:
dango3.cpp:43:13: note:   'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   43 |     if (v > n) cout << 1/0 << endl;
      |             ^
In file included from /usr/include/c++/10/string:55,
                 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/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from dango3.cpp:2:
/usr/include/c++/10/bits/basic_string.h:6318:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
 6318 |     operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6318:5: note:   template argument deduction/substitution failed:
dango3.cpp:43:13: note:   'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   43 |     if (v > n) cout << 1/0 << endl;
      |             ^
In file included from /usr/include/c++/10/string:55,
                 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/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from dango3.cpp:2:
/usr/include/c++/10/bits/basic_string.h:6330:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 6330 |     operator>(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6330:5: note:   template argument deduction/substitution failed:
dango3.cpp:43:13: note:   mismatched types 'const _CharT*' and 'std::vector<int>'
   43 |     if (v > n) cout << 1/0 << endl;
      |             ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/vector:60,
                 from dango3.h:1,
                 from dango3.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1111:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator>(const __gnu_cxx::__normal_iterator<_IteratorL, _Container>&, const __gnu_cxx::__normal_iterator<_IteratorR, _Container>&)'
 1111 |     operator>(const __normal_iterator<_IteratorL, _Container>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1111:5: note:   template argument deduction/substitution failed:
dango3.cpp:43:13: note:   'std::vector<int>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
   43 |     if (v > n) cout << 1/0 << endl;
      |             ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/vector:60,
                 from dango3.h:1,
                 from dango3.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1119:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator>(const __gnu_cxx::__normal_iterator<_Iterator, _Container>&, const __gnu_cxx::__normal_iterator<_Iterator, _Container>&)'
 1119 |     operator>(const __normal_iterator<_Iterator, _Container>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1119:5: note:   template argument deduction/substitution failed:
dango3.cpp:43:13: note:   'std::vector<int>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
   43 |     if (v > n) cout << 1/0 << endl;
      |             ^
dango3.cpp:43:25: warning: division by zero [-Wdiv-by-zero]
   43 |     if (v > n) cout << 1/0 << endl;
      |                        ~^~