Submission #995886

# Submission time Handle Problem Language Result Execution time Memory
995886 2024-06-10T03:23:48 Z vjudge1 Carnival (CEOI14_carnival) C++17
100 / 100
26 ms 600 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 ";
    map<int,int> mp;
    int cc = 1;
    for(int i = 1;i<=n;i++){
        if(mp[ans[i]]==0){
            mp[ans[i]]=cc;
            ans[i]=cc;
            cc++;
        }
        else{ans[i]=mp[ans[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;
}




# Verdict Execution time Memory Grader output
1 Correct 10 ms 344 KB Output is correct
2 Correct 13 ms 512 KB Output is correct
3 Correct 11 ms 456 KB Output is correct
4 Correct 15 ms 444 KB Output is correct
5 Correct 10 ms 432 KB Output is correct
6 Correct 6 ms 600 KB Output is correct
7 Correct 9 ms 456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 464 KB Output is correct
2 Correct 10 ms 344 KB Output is correct
3 Correct 9 ms 448 KB Output is correct
4 Correct 15 ms 444 KB Output is correct
5 Correct 8 ms 452 KB Output is correct
6 Correct 8 ms 344 KB Output is correct
7 Correct 7 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 456 KB Output is correct
2 Correct 7 ms 344 KB Output is correct
3 Correct 11 ms 344 KB Output is correct
4 Correct 14 ms 432 KB Output is correct
5 Correct 9 ms 456 KB Output is correct
6 Correct 12 ms 344 KB Output is correct
7 Correct 15 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 344 KB Output is correct
2 Correct 7 ms 344 KB Output is correct
3 Correct 15 ms 428 KB Output is correct
4 Correct 26 ms 428 KB Output is correct
5 Correct 9 ms 344 KB Output is correct
6 Correct 11 ms 344 KB Output is correct
7 Correct 11 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 592 KB Output is correct
2 Correct 12 ms 600 KB Output is correct
3 Correct 12 ms 344 KB Output is correct
4 Correct 12 ms 344 KB Output is correct
5 Correct 11 ms 344 KB Output is correct
6 Correct 12 ms 340 KB Output is correct
7 Correct 23 ms 432 KB Output is correct