답안 #704906

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
704906 2023-03-03T06:38:39 Z piOOE Super Dango Maker (JOI22_dango3) C++17
컴파일 오류
0 ms 0 KB
#include "dango3.h"

#include <bits/stdc++.h>

using namespace std;

mt19937 rnd(228);

void Solve(int n, int m) {
    const int N = n * m;

    vector<int> ord(N);
    iota(ord.begin(), ord.end(), 1);

    shuffle(ord.begin(), ord.end(), rnd);

    set<int> st;
    
    while (!ord.empty()) {

        for (int x: ord) {
            st.insert(x);

            if (Query(vector(st.begin(), st.end())) == 1) {
                vector<int> stick{x};
                vector<int> consider(st.begin(), st.end());
                consider.erase(find(consider.begin(), consider.end(), x));

                set<int> save;

                for (int y: consider) {
                    st.erase(y);

                    if (stick.size() < n && Query(vector(st.begin(), st.end())) == 0) {
                        stick.push_back(y);
                        st.insert(y);
                    } else {
                        save.insert(y);
                    }
                }

                Answer(stick);
                
                vector<int> nxt;
                
                for (int z : ord) {
                    if (!st.count(z)) {
                        nxt.push_back(z);
                    }
                }
                
                swap(ord, nxt);
                shuffle(ord.begin(), ord.end());
            }
        }
    }
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:34:38: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   34 |                     if (stick.size() < n && Query(vector(st.begin(), st.end())) == 0) {
      |                         ~~~~~~~~~~~~~^~~
dango3.cpp:53:47: error: no matching function for call to 'shuffle(std::vector<int>::iterator, std::vector<int>::iterator)'
   53 |                 shuffle(ord.begin(), ord.end());
      |                                               ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from dango3.cpp:3:
/usr/include/c++/10/bits/stl_algo.h:3748:5: note: candidate: 'template<class _RAIter, class _UGenerator> void std::shuffle(_RAIter, _RAIter, _UGenerator&&)'
 3748 |     shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~~~~
/usr/include/c++/10/bits/stl_algo.h:3748:5: note:   template argument deduction/substitution failed:
dango3.cpp:53:47: note:   candidate expects 3 arguments, 2 provided
   53 |                 shuffle(ord.begin(), ord.end());
      |                                               ^