Submission #704925

# Submission time Handle Problem Language Result Execution time Memory
704925 2023-03-03T06:51:31 Z piOOE Super Dango Maker (JOI22_dango3) C++17
22 / 100
1719 ms 1024 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;
    
    set<int> left;
    
    for (int x : ord) {
        left.insert(x);
    }

    for (int x : ord) {
        if (left.size() == n) {
            Answer(vector(left.begin(), left.end()));
            break;
        }
        
        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);
            
            for (int y : stick) {
                left.erase(y);
            }

            swap(st, save);
        }
    }
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:26:25: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   26 |         if (left.size() == n) {
      |             ~~~~~~~~~~~~^~~~
dango3.cpp:43:34: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   43 |                 if (stick.size() < n && Query(vector(st.begin(), st.end())) == 0) {
      |                     ~~~~~~~~~~~~~^~~
# Verdict Execution time Memory Grader output
1 Correct 0 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
# Verdict Execution time Memory Grader output
1 Correct 18 ms 468 KB Output is correct
2 Correct 17 ms 340 KB Output is correct
3 Correct 16 ms 464 KB Output is correct
4 Correct 19 ms 468 KB Output is correct
5 Correct 22 ms 476 KB Output is correct
6 Correct 22 ms 472 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 497 ms 692 KB Output is correct
2 Correct 562 ms 848 KB Output is correct
3 Correct 485 ms 828 KB Output is correct
4 Correct 488 ms 708 KB Output is correct
5 Correct 459 ms 716 KB Output is correct
6 Correct 454 ms 696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1719 ms 1024 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -