Submission #99252

# Submission time Handle Problem Language Result Execution time Memory
99252 2019-03-02T02:59:42 Z HellAngel Carnival (CEOI14_carnival) C++14
100 / 100
29 ms 384 KB
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000;
int n, m, mark[1000], type[maxn], cnt = 0, dem;

int Ask(int l, int r)
{
    cout << r - l + 1 << ' ';
    for(int i = l; i <= r; i++) cout << i << ' ';
    cout << endl;
    fflush(stdout);
    int x;
    cin >> x;
    return x;
}

int Ask1(int x, int y)
{
    cout << 2 << ' ';
    cout << x << ' ' << y << endl;
    fflush(stdout);
    int z;
    cin >> z;
    return z;
}

void Ans()
{
    cout << 0 << ' ';
    for(int i = 1; i <= n; i++) cout << type[i] << ' ';
    cout << endl;
    fflush(stdout);
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("test.inp", "r", stdin);freopen("test.out", "w", stdout);
    fill_n(type, maxn, -1);
    int old = 0;
    cin >> n;
    for(int i = 1; i <= n; i++)
    {
        int New = Ask(1, i);
        if(New == old + 1)
        {
            mark[i] = 1;
        }
        old = New;
    }
    for(int i = 1; i <= n; i++)
    {
        if(mark[i])
        {
            type[i] = ++cnt;
            int t = i + 1;
            for(; t <= n && !mark[t]; t++)
            {
                if(type[t] == -1) type[t] = cnt;
            }
            for(int j = t; j <= n; j++)
            {
                if(!mark[j] && type[j] == -1 && Ask1(i, j) == 1)
                {
                    type[j] = cnt;
                }
            }
        }
    }
    Ans();
}
# Verdict Execution time Memory Grader output
1 Correct 12 ms 256 KB Output is correct
2 Correct 22 ms 384 KB Output is correct
3 Correct 16 ms 384 KB Output is correct
4 Correct 6 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 4 ms 256 KB Output is correct
7 Correct 12 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 19 ms 256 KB Output is correct
3 Correct 6 ms 256 KB Output is correct
4 Correct 6 ms 304 KB Output is correct
5 Correct 7 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 10 ms 256 KB Output is correct
3 Correct 29 ms 384 KB Output is correct
4 Correct 8 ms 384 KB Output is correct
5 Correct 6 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 18 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 256 KB Output is correct
2 Correct 8 ms 256 KB Output is correct
3 Correct 7 ms 344 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 3 ms 256 KB Output is correct
6 Correct 9 ms 384 KB Output is correct
7 Correct 14 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 384 KB Output is correct
2 Correct 15 ms 384 KB Output is correct
3 Correct 19 ms 384 KB Output is correct
4 Correct 10 ms 256 KB Output is correct
5 Correct 9 ms 384 KB Output is correct
6 Correct 6 ms 384 KB Output is correct
7 Correct 9 ms 256 KB Output is correct