Submission #155640

# Submission time Handle Problem Language Result Execution time Memory
155640 2019-09-29T13:33:58 Z Akashi Carnival (CEOI14_carnival) C++14
100 / 100
26 ms 404 KB
#include <bits/stdc++.h>
using namespace std;

int n;
vector <int> v;
int a[155];
bool f[155];

int main()
{
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

    cin >> n;

    int NR = 0, x;

    a[1] = ++NR;
    v.push_back(1);

    for(int i = 2; i <= n ; ++i){
        cout << v.size() + 1 << " ";
        for(auto it : v) cout << it << " ";
        cout << i;
        cout << endl;

        cin >> x;
        if(x == NR){
            memset(f, 0, sizeof(f));
            shuffle(v.begin(), v.end(), rng);

            for(int p = 0; p < v.size() ; ++p){
                int it = v[p];
                if(p == v.size() - 1){
                    a[i] = a[it];
                    break ;
                }

                cout << 2 << " ";
                cout << i << " " << it << endl;
                cin >> x;
                if(x == 1){
                    a[i] = a[it];
                    break ;
                }
            }
        }
        else{
            v.push_back(i);
            a[i] = ++NR;
        }
    }

    cout << 0 << " ";

    for(int i = 1; i <= n ; ++i) cout << a[i] << " ";
    cout << endl;

    return 0;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:31:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int p = 0; p < v.size() ; ++p){
                            ~~^~~~~~~~~~
carnival.cpp:33:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 if(p == v.size() - 1){
                    ~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 11 ms 376 KB Output is correct
2 Correct 22 ms 248 KB Output is correct
3 Correct 21 ms 248 KB Output is correct
4 Correct 8 ms 248 KB Output is correct
5 Correct 6 ms 248 KB Output is correct
6 Correct 5 ms 248 KB Output is correct
7 Correct 18 ms 248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 376 KB Output is correct
2 Correct 12 ms 248 KB Output is correct
3 Correct 11 ms 376 KB Output is correct
4 Correct 9 ms 376 KB Output is correct
5 Correct 10 ms 252 KB Output is correct
6 Correct 12 ms 380 KB Output is correct
7 Correct 10 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 300 KB Output is correct
2 Correct 11 ms 376 KB Output is correct
3 Correct 23 ms 404 KB Output is correct
4 Correct 6 ms 376 KB Output is correct
5 Correct 13 ms 296 KB Output is correct
6 Correct 17 ms 376 KB Output is correct
7 Correct 20 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 376 KB Output is correct
2 Correct 7 ms 376 KB Output is correct
3 Correct 20 ms 248 KB Output is correct
4 Correct 7 ms 248 KB Output is correct
5 Correct 12 ms 248 KB Output is correct
6 Correct 17 ms 300 KB Output is correct
7 Correct 16 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 16 ms 248 KB Output is correct
3 Correct 26 ms 376 KB Output is correct
4 Correct 20 ms 328 KB Output is correct
5 Correct 19 ms 380 KB Output is correct
6 Correct 11 ms 376 KB Output is correct
7 Correct 7 ms 312 KB Output is correct