답안 #995881

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
995881 2024-06-10T03:21:25 Z anHiep 사육제 (CEOI14_carnival) C++14
0 / 100
9 ms 344 KB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")

#include <bits/stdc++.h>


using namespace std;

#define int long long
#define ll long long
#define vec vector<long long>
#define pb push_back
#define sz(a) a.size()
#define fi first
#define se second
#define ret(a) return cout<<(a)<<"\n",void()
// #define endl "\n"
#define el cout<<"\n"
#define f(a) for(int i=0;i<(a);i++)
#define f1(a) for(int i=1;i<(a);i++)
#define all(v) v.begin(),v.end()
template<class T> void PRINTARR(T a[], int n){for(int i=0;i<n;i++){std::cout<<a[i]<<" ";}std::cout<<'\n';}
template<class T> void PRINTVEC(std::vector<T> arr){for(int i=0;i<arr.size();i++){std::cout<<arr[i]<<" ";}std::cout << '\n';}

int tc=1;
void input(){
    // cin>>tc;
}

const ll oo = 1e18;
const int maxn = 160;
const int MOD = 1e9+7;
const int S = 360;

#define BASE 37
#define SMOD 998244353

//REMEMBER:
//USE LONG LONG WHEN NECESSARY
//ALWAYS USE "\n" OR el;
//PRAGMA?

int n;

int ans[maxn];

bool check(int i , int mid){
    if(i==mid) return 1;
    int cnt1, cnt2;
    cout<<mid - i + 1 << " ";
    for(int j = i; j<=mid;j++) cout<<j<<" ";
    cout<<endl;
    cin>>cnt1;
    cout<<mid - (i+1) + 1<<" ";
    for(int j = i+1;j<=mid;j++) cout<<j<<" ";
    cout<<endl;
    cin>>cnt2;
    if(cnt1==cnt2) return 1;
    return 0;
}

void solve()
{
    cin >> n;
    for(int i = 1; i <= n; i++){
        ans[i] = i;
    }
    for(int i = 1; i <=n;i++){
        int l = i, r = n + 1;
        while(r-l>1){
            int mid = (l + r)/2;
            if(check(i, mid)) r = mid;
            else l = mid;
        }
        ans[r] = ans[i];
    }
    cout<<"0 ";
    for(int i = 1;i<=n;i++){
        cout<<ans[i]<<" ";
    }
    cout<<endl;
}

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    // init();

    input();
    while (tc--)
        solve();

    cerr << "\nTime elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << " ms.\n";

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 344 KB Integer 19 violates the range [1, 11]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 344 KB Integer 6 violates the range [1, 5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 344 KB Output is correct
2 Incorrect 8 ms 344 KB Integer 11 violates the range [1, 8]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 344 KB Integer 5 violates the range [1, 4]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 344 KB Output is correct
2 Incorrect 9 ms 344 KB Integer 20 violates the range [1, 17]
3 Halted 0 ms 0 KB -