Submission #229926

# Submission time Handle Problem Language Result Execution time Memory
229926 2020-05-07T06:59:29 Z Ruxandra985 Carnival (CEOI14_carnival) C++14
100 / 100
32 ms 436 KB
#include <bits/stdc++.h>

using namespace std;
int v[160];
int main()
{
    int dif , i , n , st , dr , mid , j , val1 , val2;
    cin >> n;
    dif = 0;
    for (i = 1 ; i <= n ; i++){

        if (!v[i]){
            v[i] = ++dif;
        }

        /// acuma ar trb sa cauti urm = v[i]
        if (n - i + 1 > 0){
            cout << n - i + 1 << " ";
            for (j = i ; j <= n ; j++)
                cout << j << " ";
            cout << endl;
            cin >> val1;
        }
        else val1 = 0;

        if (n - i > 0){
            cout << n - i << " ";
            for (j = i + 1 ; j <= n ; j++)
                cout << j << " ";
            cout << endl;
            cin >> val2;
        }
        else val2 = 0;

        if (val1 != val2){
            /// v[i] nu mai apare nicaieri
            continue;
        }


        /// v[i] mai apare , unde?

        st = i + 1;
        dr = n;

        while (st <= dr){

            mid = (st + dr)/2;

            if (mid - i + 1 > 0){

                cout << mid - i + 1 << " ";
                for (j = i ; j <= mid ; j++)
                    cout << j << " ";
                cout << endl;
                cin >> val1;

            }
            else val1 = 0;

            if (mid - i > 0){

                cout << mid - i << " ";
                for (j = i + 1 ; j <= mid ; j++)
                    cout << j << " ";
                cout << endl;
                cin >> val2;

            }
            else val2 = 0;

            if (val1 == val2){
                dr = mid - 1;
            }
            else st = mid + 1;


        }

        v[st] = v[i];


    }
    cout << "0 ";
    for (i = 1 ; i <= n ; i++)
        cout << v[i] << " ";

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 28 ms 256 KB Output is correct
2 Correct 26 ms 384 KB Output is correct
3 Correct 14 ms 256 KB Output is correct
4 Correct 8 ms 256 KB Output is correct
5 Correct 28 ms 256 KB Output is correct
6 Correct 22 ms 256 KB Output is correct
7 Correct 22 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 384 KB Output is correct
2 Correct 25 ms 256 KB Output is correct
3 Correct 12 ms 256 KB Output is correct
4 Correct 9 ms 256 KB Output is correct
5 Correct 29 ms 256 KB Output is correct
6 Correct 16 ms 256 KB Output is correct
7 Correct 25 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 384 KB Output is correct
2 Correct 26 ms 256 KB Output is correct
3 Correct 27 ms 256 KB Output is correct
4 Correct 12 ms 256 KB Output is correct
5 Correct 25 ms 384 KB Output is correct
6 Correct 25 ms 256 KB Output is correct
7 Correct 26 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 32 ms 384 KB Output is correct
2 Correct 26 ms 256 KB Output is correct
3 Correct 13 ms 256 KB Output is correct
4 Correct 10 ms 384 KB Output is correct
5 Correct 22 ms 256 KB Output is correct
6 Correct 12 ms 256 KB Output is correct
7 Correct 24 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 308 KB Output is correct
2 Correct 25 ms 384 KB Output is correct
3 Correct 18 ms 384 KB Output is correct
4 Correct 19 ms 256 KB Output is correct
5 Correct 18 ms 256 KB Output is correct
6 Correct 17 ms 436 KB Output is correct
7 Correct 12 ms 384 KB Output is correct