Submission #568712

#TimeUsernameProblemLanguageResultExecution timeMemory
568712joelauSuper Dango Maker (JOI22_dango3)C++17
100 / 100
2131 ms600 KiB
#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> lst[30],v;

void Solve(int N, int M) {
    for (int i = 0; i < N*M; ++i) v.push_back(i+1);
    while (!v.empty()) {
        int x = v.back(); v.pop_back();
        int low = 0, high = M;
        while (high - low > 1) {
            int mid = (low+high)/2;
            int n = 0;
            for (int i = 0; i < mid; ++i) {
                n += lst[i].size();
                for (int j = 0; j < lst[i].size(); ++j) v.push_back(lst[i][j]);
            }
            int q = Query(v);
            if (q == mid-1) high = mid;
            else low = mid;
            for (int i = 0; i < n; ++i) v.pop_back();
        }
        lst[low].push_back(x);
    }
    for (int i = 0; i < M; ++i) Answer(lst[i]);
}

Compilation message (stderr)

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:17:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |                 for (int j = 0; j < lst[i].size(); ++j) v.push_back(lst[i][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...