답안 #540675

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
540675 2022-03-21T11:08:45 Z RyoPham 사육제 (CEOI14_carnival) C++17
100 / 100
14 ms 336 KB
#include <bits/stdc++.h>

using namespace std;

#define sz(x) (int)x.size()
#define fi first
#define se second
#define mp make_pair

typedef long long lli;
typedef pair<int, int> pii;

const int maxn = 155;

int n, m;
int c[maxn];

int mem[maxn];

void ask(int l, int r, int x)
{
    cout << r - l + 2;
    for(int i = l; i <= r; ++i)
        cout << ' ' << i;
    cout << ' ' << x << endl;
}

void answer()
{
    cout << 0;
    for(int i = 1; i <= n; ++i)
        cout << ' ' << c[i];
    cout << endl;
}

void read_input()
{
    cin >> n;
}

void solve()
{
    m = 1;
    c[1] = 1;
    mem[1] = 1;
    for(int i = 2; i <= n; ++i)
    {
        ask(1, i - 1, i);
        int k;
        cin >> k;
        mem[i] = k;
        if(k == m + 1)
        {
            ++m;
            c[i] = m;
            continue;
        }
        int low = 1, high = i - 1;
        while(low <= high)
        {
            int mid = (low + high) / 2;
            ask(1, mid, i);
            cin >> k;
            if(k == mem[mid] + 1)
                low = mid + 1;
            else
                high = mid - 1;
        }
        c[i] = c[low];
    }
    answer();
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
  
    read_input();
    solve();
}

# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 208 KB Output is correct
2 Correct 12 ms 208 KB Output is correct
3 Correct 5 ms 208 KB Output is correct
4 Correct 5 ms 208 KB Output is correct
5 Correct 12 ms 208 KB Output is correct
6 Correct 14 ms 208 KB Output is correct
7 Correct 11 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 208 KB Output is correct
2 Correct 9 ms 208 KB Output is correct
3 Correct 5 ms 208 KB Output is correct
4 Correct 6 ms 208 KB Output is correct
5 Correct 9 ms 208 KB Output is correct
6 Correct 12 ms 208 KB Output is correct
7 Correct 10 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 208 KB Output is correct
2 Correct 10 ms 336 KB Output is correct
3 Correct 12 ms 208 KB Output is correct
4 Correct 3 ms 208 KB Output is correct
5 Correct 8 ms 208 KB Output is correct
6 Correct 8 ms 208 KB Output is correct
7 Correct 11 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 208 KB Output is correct
2 Correct 11 ms 208 KB Output is correct
3 Correct 4 ms 208 KB Output is correct
4 Correct 3 ms 208 KB Output is correct
5 Correct 9 ms 208 KB Output is correct
6 Correct 8 ms 208 KB Output is correct
7 Correct 10 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 208 KB Output is correct
2 Correct 10 ms 208 KB Output is correct
3 Correct 9 ms 208 KB Output is correct
4 Correct 6 ms 208 KB Output is correct
5 Correct 6 ms 208 KB Output is correct
6 Correct 4 ms 220 KB Output is correct
7 Correct 3 ms 208 KB Output is correct