답안 #785425

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
785425 2023-07-17T09:04:54 Z JooDdae Super Dango Maker (JOI22_dango3) C++17
22 / 100
884 ms 620 KB
#include "dango3.h"

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

int cnt;
vector<int> type[400];

int query(vector<int> v) {
    for(int i=0;i<cnt;i++) for(int j=1;j<type[i].size();j++) v.push_back(type[i][j]);
    return Query(v);
}

void Solve(int N, int M) {
    vector<int> v(N*M);
    iota(v.begin(), v.end(), 1);

    random_device rd;
    shuffle(v.begin(), v.end(), mt19937(rd()));

    for(int i=0;i<N*M;i++) {
        int u = v.back(); v.pop_back();

        int re = query(v);

        if(re == M-1) {
            type[cnt++].push_back(u);
            continue;
        }

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

            for(int i=l;i<=mid;i++) v.push_back(type[i][0]);
            int re = query(v);
            for(int i=l;i<=mid;i++) v.pop_back();

            if(re == M-1) r = mid;
            else l = mid+1;
        }
        
        type[l].push_back(u);
    }


    type[N-1] = v;

    for(int i=0;i<M;i++) {
        vector<int> re;
        for(int j=0;j<N;j++) {
            re.push_back(type[j][i]);
        }
        Answer(re);
    }
}

Compilation message

dango3.cpp: In function 'int query(std::vector<int>)':
dango3.cpp:11:41: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for(int i=0;i<cnt;i++) for(int j=1;j<type[i].size();j++) v.push_back(type[i][j]);
      |                                        ~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 376 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 420 KB Output is correct
2 Correct 15 ms 340 KB Output is correct
3 Correct 15 ms 384 KB Output is correct
4 Correct 15 ms 340 KB Output is correct
5 Correct 15 ms 392 KB Output is correct
6 Correct 15 ms 396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 449 ms 452 KB Output is correct
2 Correct 454 ms 520 KB Output is correct
3 Correct 443 ms 500 KB Output is correct
4 Correct 777 ms 528 KB Output is correct
5 Correct 450 ms 552 KB Output is correct
6 Correct 466 ms 620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 884 ms 576 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -