답안 #574970

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
574970 2022-06-09T13:33:15 Z Rifal 사육제 (CEOI14_carnival) C++14
0 / 100
7 ms 208 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;

            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;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 208 KB Output is correct
2 Incorrect 6 ms 208 KB Incorrect
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -