제출 #1119246

#제출 시각아이디문제언어결과실행 시간메모리
1119246mariaclaraSuper Dango Maker (JOI22_dango3)C++17
100 / 100
3121 ms876 KiB
#include "dango3.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pb push_back
#define mk make_pair 
#define fr first 
#define sc second

void Solve(int N, int M) {

    vector<vector<int>> a;

    for(int i = 1; i <= N*M; i++) {
        // vamos ver onde pôr o elemento i

        int l = 0, r = sz(a) - 1;
        while(l <= r) {
            int mid = (l+r)/2;

            vector<bool> q(N*M, 1);
            for(auto it : a[mid]) q[it-1] = 0;
            q[i - 1] = 0;

            vector<int> make_query;
            for(int j = 1; j <= N*M; j++) if(q[j-1]) make_query.pb(j);

            if(Query(make_query) == M-1) r = mid-1;
            else l = mid+1;
        }

        if(r+1 >= sz(a)) a.pb({i});
        else a[r+1].pb(i);
    }

    for(int i = 0; i < M; i++) Answer(a[i]);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...