Submission #876260

# Submission time Handle Problem Language Result Execution time Memory
876260 2023-11-21T13:21:14 Z danikoynov Super Dango Maker (JOI22_dango3) C++17
22 / 100
289 ms 636 KB
#include "dango3.h"

#include <bits/stdc++.h>

using namespace std;


int get_query(vector < int > lf, vector < int > rf)
{
    for (int cur : rf)
        lf.push_back(cur);
    return Query(lf);
}

mt19937 rng;
int n, m;
void sub_solve(vector < int > &d)
{
    if (Query(d) == 0)
        return;

    vector < int > df;
    while(true)
    {
        vector < int > lf, rf;
        for (int i = 0; i < d.size(); i ++)
        {
            if (rng() % 2 == 0)
                lf.push_back(d[i]);
            else
                rf.push_back(d[i]);
        }
        sub_solve(lf);
        sub_solve(rf);
        if (lf.size() + rf.size() > 4 * n && get_query(lf, rf) > 1)
        {
            d = lf;
            for (int cur : rf)
                d.push_back(cur);
            continue;
        }
        for (int cur : lf)
            df.push_back(cur);
        for (int cur : rf)
            df.push_back(cur);
        break;
    }

    int cnt = Query(df);
    for (int t = 0; t < cnt; t++)
    {
        vector < int > secure, trash;
        while(!df.empty() && secure.size() < n)
        {
            int bk = df.back();
            df.pop_back();
            if (get_query(df, secure) == 0)
                secure.push_back(bk);
            else
                trash.push_back(bk);
        }

        Answer(secure);
        for (int cur : trash)
            df.push_back(cur);
    }

    d = df;

}
void Solve(int N, int M)
{
    n = N;
    m = M;
    vector < int > d;
    for (int i = 1; i <= N * M; i ++)
        d.push_back(i);

    sub_solve(d);
}

Compilation message

dango3.cpp: In function 'void sub_solve(std::vector<int>&)':
dango3.cpp:26:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |         for (int i = 0; i < d.size(); i ++)
      |                         ~~^~~~~~~~~~
dango3.cpp:35:35: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   35 |         if (lf.size() + rf.size() > 4 * n && get_query(lf, rf) > 1)
      |             ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
dango3.cpp:53:44: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   53 |         while(!df.empty() && secure.size() < n)
      |                              ~~~~~~~~~~~~~~^~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 6 ms 348 KB Output is correct
6 Correct 23 ms 560 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 74 ms 604 KB Output is correct
2 Correct 35 ms 600 KB Output is correct
3 Correct 31 ms 604 KB Output is correct
4 Correct 39 ms 604 KB Output is correct
5 Correct 60 ms 636 KB Output is correct
6 Correct 40 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 289 ms 600 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -