답안 #940436

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
940436 2024-03-07T09:15:10 Z jasen_penchev Super Dango Maker (JOI22_dango3) C++17
100 / 100
378 ms 852 KB
#include "dango3.h"
///#include "grader.cpp"
#include <iostream>
#include <vector>
#define endl '\n'
using namespace std;

int Query(const vector<int> &x);

void Answer(const vector<int> &a);

void rec(vector<int> &v, int cnt)
{
    if (cnt == 1)
    {
        Answer(v);
        return;
    }

    vector<int> v2;
    for (int i = v.size() - 1; i >= 0; -- i)
    {
        v2.push_back(v[i]);
        v.erase(v.begin() + i);
        if (Query(v) < cnt / 2)
        {
            v.push_back(v2.back());
            v2.pop_back();
        }
    }

    rec(v, cnt / 2);
    rec(v2, cnt - cnt / 2);
}

void Solve(int N, int M)
{
    vector<int> v;
    for (int i = 1; i <= N * M; ++ i)
    {
        v.push_back(i);
    }
    rec(v, M);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 344 KB Output is correct
2 Correct 50 ms 344 KB Output is correct
3 Correct 66 ms 348 KB Output is correct
4 Correct 65 ms 348 KB Output is correct
5 Correct 48 ms 560 KB Output is correct
6 Correct 48 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 378 ms 608 KB Output is correct
2 Correct 189 ms 652 KB Output is correct
3 Correct 253 ms 652 KB Output is correct
4 Correct 277 ms 648 KB Output is correct
5 Correct 185 ms 852 KB Output is correct
6 Correct 204 ms 604 KB Output is correct