Submission #540675

# Submission time Handle Problem Language Result Execution time Memory
540675 2022-03-21T11:08:45 Z RyoPham Carnival (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();
}

# Verdict Execution time Memory 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
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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