Submission #220740

# Submission time Handle Problem Language Result Execution time Memory
220740 2020-04-08T14:00:38 Z csamoila Carnival (CEOI14_carnival) C++17
100 / 100
15 ms 384 KB
#include <iostream>
#include <vector>

using namespace std;

int n;
int F[151];
int COLOUR[151];
vector <int> SEFI;
int C;

int main()
{
    cin >> n;
    SEFI.push_back(1);
    F[1]=1;
    COLOUR[1]=1;
    for(int i=2;i<=n;i++)
    {
        cout << SEFI.size()+1 << ' ';
        for(auto x : SEFI)
        {
            cout << x << ' ';
        }
        cout << i << '\n';
        int q;
        cin >> q;
        if(q==SEFI.size()+1)
        {
            SEFI.push_back(i);
            F[i]=1;
            COLOUR[i]=q;
        }
    }
    C=SEFI.size();
    for(int i=1;i<=n;i++)
    {
        if(F[i]==0)
        {
            int st=1,dr=C;
            int rez=0;
            while(st<=dr)
            {
                int mij=(st+dr)/2;
                cout << mij+1 << ' ';
                for(int j=0;j!=mij;j++)
                {
                    cout << SEFI[j] << ' ';
                }
                cout << i << '\n';
                int q;
                cin >> q;
                if(q==mij+1)
                {
                    st=mij+1;
                }
                else
                {
                    rez=mij;
                    dr=mij-1;
                }
            }
            COLOUR[i]=COLOUR[SEFI[rez-1]];
        }
    }
    cout << 0 << ' ';
    for(int i=1;i<=n;i++) cout << COLOUR[i] << ' ';
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:28:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(q==SEFI.size()+1)
            ~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 10 ms 256 KB Output is correct
2 Correct 12 ms 256 KB Output is correct
3 Correct 9 ms 384 KB Output is correct
4 Correct 7 ms 384 KB Output is correct
5 Correct 9 ms 384 KB Output is correct
6 Correct 6 ms 256 KB Output is correct
7 Correct 11 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 256 KB Output is correct
2 Correct 11 ms 256 KB Output is correct
3 Correct 8 ms 256 KB Output is correct
4 Correct 8 ms 384 KB Output is correct
5 Correct 7 ms 256 KB Output is correct
6 Correct 10 ms 384 KB Output is correct
7 Correct 9 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 384 KB Output is correct
2 Correct 9 ms 256 KB Output is correct
3 Correct 15 ms 384 KB Output is correct
4 Correct 7 ms 256 KB Output is correct
5 Correct 12 ms 384 KB Output is correct
6 Correct 9 ms 384 KB Output is correct
7 Correct 14 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 256 KB Output is correct
2 Correct 10 ms 256 KB Output is correct
3 Correct 9 ms 256 KB Output is correct
4 Correct 7 ms 384 KB Output is correct
5 Correct 14 ms 384 KB Output is correct
6 Correct 11 ms 256 KB Output is correct
7 Correct 14 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 384 KB Output is correct
2 Correct 8 ms 256 KB Output is correct
3 Correct 11 ms 288 KB Output is correct
4 Correct 13 ms 384 KB Output is correct
5 Correct 10 ms 256 KB Output is correct
6 Correct 10 ms 256 KB Output is correct
7 Correct 8 ms 384 KB Output is correct