Submission #300892

# Submission time Handle Problem Language Result Execution time Memory
300892 2020-09-17T14:51:50 Z JovanK26 Carnival (CEOI14_carnival) C++14
100 / 100
9 ms 384 KB
#include <bits/stdc++.h>

using namespace std;
int n;
int ind[151];
int color[151];
int query(int m,int x)
{
    cout << m+1 <<' ';
    for(int i=0;i<m;i++)
    {
        cout << ind[i]+1 <<' ';
    }
    cout << x+1 << endl;
    int rez;
    cin >> rez;
    return rez;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    int colors=1;
    for(int i=1;i<n;i++)
    {
        if(query(colors,i)==colors+1)
        {
            ind[colors]=i;
            color[i]=colors;
            colors++;
        }
        else
        {
            int l=0;
            int r=colors-1;
            int m;
            while(l<r)
            {
                m=(l+r)/2;
                if(query(m+1,i)==m+2)
                {
                    l=m+1;
                }
                else
                {
                    r=m;
                }
            }
            color[i]=l;
        }
    }
    cout << 0;
    for(int i=0;i<n;i++)
    {
        cout << ' ' <<color[i]+1;
    }
    cout << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 6 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 8 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 6 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 8 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 7 ms 384 KB Output is correct
6 Correct 6 ms 384 KB Output is correct
7 Correct 7 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 7 ms 384 KB Output is correct
6 Correct 6 ms 384 KB Output is correct
7 Correct 9 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 7 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 6 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct