답안 #973658

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
973658 2024-05-02T09:10:20 Z happy_node Super Dango Maker (JOI22_dango3) C++17
100 / 100
2189 ms 1172 KB
#include "dango3.h"

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

const int MX=400*25+5;

bool used[MX];

int N,M;

vector<vector<int>> groups; 

bool chk(int l, int r, int z) {
        for(int i=l;i<=r;i++) {
                for(auto x:groups[i]) used[x]=true;
        }
        used[z]=true;
        vector<int> qry;
        for(int j=1;j<=N*M;j++) {
                if(!used[j]) qry.push_back(j);
        }
        for(int i=l;i<=r;i++) {
                for(auto x:groups[i]) used[x]=false;
        }
        used[z]=false;
        int k=Query(qry);
        return k==M-(r-l+1);
}

int dnc(int l, int r, int z) {
        if(l==r) return l;
        int mid=(l+r)/2;
        if(chk(l,mid,z)) return dnc(l,mid,z);
        return dnc(mid+1,r,z);
}

void Solve(int NN, int MM) {
        N=NN, M=MM;

        groups.push_back({1});

        for(int i=2;i<=N*M;i++) {
                int res=dnc(0,groups.size(),i);

                if(res==groups.size()) {
                        groups.push_back({i});
                } else {
                        groups[res].push_back(i);
                }
        }

        for(auto v:groups) {
                Answer(v);
        }
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:46:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |                 if(res==groups.size()) {
      |                    ~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 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 1 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 600 KB Output is correct
2 Correct 15 ms 348 KB Output is correct
3 Correct 16 ms 348 KB Output is correct
4 Correct 17 ms 348 KB Output is correct
5 Correct 11 ms 348 KB Output is correct
6 Correct 11 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 443 ms 596 KB Output is correct
2 Correct 423 ms 844 KB Output is correct
3 Correct 544 ms 596 KB Output is correct
4 Correct 553 ms 592 KB Output is correct
5 Correct 373 ms 596 KB Output is correct
6 Correct 366 ms 856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1764 ms 1172 KB Output is correct
2 Correct 1779 ms 964 KB Output is correct
3 Correct 2142 ms 668 KB Output is correct
4 Correct 2189 ms 984 KB Output is correct
5 Correct 1462 ms 852 KB Output is correct
6 Correct 1436 ms 964 KB Output is correct