답안 #704909

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
704909 2023-03-03T06:40:03 Z piOOE Super Dango Maker (JOI22_dango3) C++17
22 / 100
1351 ms 928 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(), rnd);
                st.clear();
                break;
            }
        }
    }
}

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) {
      |                         ~~~~~~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 340 KB Output is correct
2 Correct 21 ms 340 KB Output is correct
3 Correct 20 ms 428 KB Output is correct
4 Correct 20 ms 424 KB Output is correct
5 Correct 27 ms 424 KB Output is correct
6 Correct 25 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 350 ms 532 KB Output is correct
2 Correct 469 ms 588 KB Output is correct
3 Correct 381 ms 540 KB Output is correct
4 Correct 456 ms 588 KB Output is correct
5 Correct 440 ms 656 KB Output is correct
6 Correct 468 ms 520 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1351 ms 928 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -