Submission #1066370

#TimeUsernameProblemLanguageResultExecution timeMemory
1066370sammyuriSuper Dango Maker (JOI22_dango3)C++17
22 / 100
217 ms688 KiB
#include "dango3.h"

#include <bits/stdc++.h>
using namespace std;

void Solve(int N, int M) {
    mt19937 rng(1000);
    vector<int> mapping(N * M);
    for (int i = 0; i < N * M; i ++)
        mapping[i] = i + 1;
    shuffle(mapping.begin(), mapping.end(), rng);
    vector<int> active;
    for (int i = 0; i < N * M; i ++) {
        active.push_back(mapping[i]);
        int xx = Query(active);
        if (xx == 0)
            continue;
        // remove pointless ones
        vector<int> cur = active;
        vector<int> secure;
        vector<int> wasted;
        int ii = 0;
        while (cur.size() - ii + secure.size() > N) {
            vector<int> test = secure;
            for (int j = ii + 1; j < active.size(); j ++)
                test.push_back(active[j]);
            int ans = Query(test);
            if (ans == 0)
                secure.push_back(active[ii]);
            else
                wasted.push_back(active[ii]);
            ii ++;
        }
        for (int j = ii; j < active.size(); j ++)
            secure.push_back(active[j]);
        Answer(secure);
        active = wasted;
    }
}

Compilation message (stderr)

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:23:48: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   23 |         while (cur.size() - ii + secure.size() > N) {
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
dango3.cpp:25:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |             for (int j = ii + 1; j < active.size(); j ++)
      |                                  ~~^~~~~~~~~~~~~~~
dango3.cpp:34:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |         for (int j = ii; j < active.size(); j ++)
      |                          ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...