Submission #574968

# Submission time Handle Problem Language Result Execution time Memory
574968 2022-06-09T13:30:27 Z Rifal Carnival (CEOI14_carnival) C++14
0 / 100
1 ms 316 KB
#include <bits/stdc++.h>
//#include <fstream>
///#define endl '\n'
#define mod 10007
#define INF 100000000
#define ll long long
//ofstream fout("split.out");
//ifstream fin("split.in");
//#define cin fin
//#define cout fout
using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
    int n; cin >> n;
    int ans[n+1] = {};
    int cnt = 1;
    vector<int> v;
    int y;
    cout << 2 << ' ' << 1 << ' ' << 2 << endl;
    cin >> y;
    if(y == 1)
    {
        ans[1] = cnt;
        ans[2] = cnt;
        cnt++;
        v.push_back(1);
    }
    else
    {
        ans[1] = 1;
        ans[2] = 2;
        cnt += 2;
        v.push_back(1);
        v.push_back(2);
    }

    for(int i = 3; i <= n; i++)
    {
        int l = 0, r = v.size()-1;
        while(l <= r)
        {
            int mid = (l+r-1)/2;
            cout << l << ' ' << r << ' ' << mid << 'k' << endl;
            int a = -1, b = -1;
            if(mid-l+1 != 0)
            {
                cout << mid-l+2 << ' ';
                for(int j = l; j <= mid; j++)
                {
                    cout << v[j] << ' ';
                }
                cout << i << ' ';
                cout << endl;
                cin >> a;
            }
            if(r-mid != 0)
            {
                cout << r-mid+1 << ' ';
                for(int j = mid+1; j <= r; j++)
                {
                    cout << v[j] << ' ';
                }
                cout << i << ' ';
                cout << endl;
                cin >> b;
            }
            if(a == mid-l+1)
            {
                if(mid-l+1 == 1)
                {
                    ans[i] = ans[v[mid]];
                    break;
                }
                r = mid;
            }
            else if(b == r-mid)
            {
                if(r-mid == 1)
                {
                    ans[i] = ans[v[mid]];
                    break;
                }
                l = mid+1;
            }
            else
            {
                ans[i] = cnt;
                cnt++;
                v.push_back(i);
                break;
            }
        }
    }
    cout << 0 << ' ';
    for(int i = 1; i <= n; i++)
    {
        cout << ans[i] << ' ';
    }
    cout << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 316 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 208 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -