답안 #892250

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
892250 2023-12-25T05:54:34 Z vjudge1 Super Dango Maker (JOI22_dango3) C++17
22 / 100
208 ms 856 KB
#include <bits/stdc++.h>

#include "dango3.h"

using namespace std;

#define all(x) x.begin(), x.end()
#define ar array
#define pb push_back
#define ln '\n'
//#define int long long

using i64 = long long;

template <class F, class _S>
bool chmin(F &u, const _S &v){
    bool flag = false;
    if ( u > v ){
        u = v; flag |= true;
    }
    return flag;
}

template <class F, class _S>
bool chmax(F &u, const _S &v){
    bool flag = false;
    if ( u < v ){
        u = v; flag |= true;
    }
    return flag;
}

void Solve(int n, int m){
    vector <int> p, us(n * m + 1);
    for ( int i = 1; i <= n * m; i++ ){
        p.pb(i);
    }
    for ( int op = 1; op <= m; op++ ){
        auto dfs = [&](auto dfs, int lst, auto &cur) -> void{
            if ( lst == -1 ){
                return;
            }
            int l = 0, r = lst;
            while ( l < r ){
                int md = (l + r) >> 1;
                auto q = cur;
                for ( int i = 0; i <= md; i++ ){
                    q.pb(p[i]);
                }
                if ( Query(q) ) r = md;
                else l = md + 1;
            }
            us[p[l]] = true;
            cur.pb(p[l]);
            dfs(dfs, l - 1, cur);
        };
        vector <int> tmp;
        if ( op == m ){
            Answer(p);
        } else{
            dfs(dfs, (int)p.size() - 1, tmp);
            Answer(tmp);
        }
        vector <int> nxt;
        for ( int i = 1; i <= n * m; i++ ){
            if ( !us[i] ){
                nxt.pb(i);
            }
        } swap(p, nxt);
    }
}

# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 8 ms 544 KB Output is correct
4 Correct 8 ms 544 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Correct 2 ms 528 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 46 ms 644 KB Output is correct
2 Correct 45 ms 856 KB Output is correct
3 Correct 208 ms 848 KB Output is correct
4 Correct 208 ms 600 KB Output is correct
5 Correct 21 ms 604 KB Output is correct
6 Correct 21 ms 656 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 128 ms 764 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -