답안 #581815

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
581815 2022-06-23T06:46:14 Z Abdulmohsen1284 도서관 (JOI18_library) C++14
0 / 100
0 ms 208 KB
#include"bits/stdc++.h"
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class x>
using ordered_set = tree<x, null_type,less<x>, rb_tree_tag,tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//---------------------------------------------------------------------------------------

#include <cstdio>
#include <vector>
#include "library.h"
using namespace std;
long long s=0;
void rec(long long cur,vector <int> grp)
{
    long long fr=Query(grp);
    grp.push_back(cur);
    if(fr+1==Query(grp))
    {
        if(grp.size()==1)
        {
            s=grp[0];
        }
        vector <int> on,tw;
        for(int i=0;i<(int)(grp.size()/2);i++)
        {
            on.push_back(grp[i]);
        }
        for(int i=grp.size()/2;i<(int)grp.size();i++)
        {
            tw.push_back(grp[i]);
        }
        rec(cur,on);
        rec(cur,tw);
    }
    else
        return;
}

void Solve(int N)
{
    for(int i=1;i<=N;i++)
    {
        vector <int> ask;
        for(int j=1;j<=N;j++)
        {
            if(i==j)
                continue;
            ask.push_back(j);
        }
        long long ans=Query(ask);
        if(ans==1)
        {
            s=i;
            break;
        }
    }
    vector <int> ret,lef;
    ret.push_back(s);
    for(int i=1;i<=N;i++)
    {
        if(s==i)
            continue;
        lef.push_back(i);
    }
    for(int i=1;i<N;i++)
    {
        rec(s,lef);
        ret.push_back(s);
    }
    Answer(ret);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 208 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 208 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -