Submission #166587

# Submission time Handle Problem Language Result Execution time Memory
166587 2019-12-03T00:02:32 Z Diego Carnival (CEOI14_carnival) C++14
0 / 100
26 ms 376 KB
#include <bits/stdc++.h>
#define MAXN 152

using namespace std;

int F[MAXN];

void busca (int x, int ini, int fim, int n) {
    int C1, C2;

    if (ini > fim) return;
    if (ini == fim) {
        cout << 2 << " " << x << " " << ini << endl;
        cin >> C1;
        if (C1 == 1) F[ini] = F[x] = n;
        return;
    }

    cout << fim-ini+(x < ini || x > fim);
    for (int i = ini; i <= fim; i++) {
        if (i == x) continue;
        cout << " " << i;
    }
    cout << endl;
    cin >> C1;

    cout << fim-ini+1+(x < ini || x > fim);
    cout << " " << x;
    for (int i = ini; i <= fim; i++) {
        if (i == x) continue;
        cout << " " << i;
    }
    cout << endl;
    cin >> C2;

    if (C1 != C2) {
        F[x] = n;
        return;
    }

    int meio = (ini+fim)/2;
    if (fim == meio) meio = ini;
    busca(x, ini, meio, n);
    busca(x, meio+1, fim, n);
}

int main () {
    int N;

    cin >> N;

    memset(F, -1, sizeof(F));

    int n = 0;
    for (int i = 1; i <= N; i++) if (F[i] == -1) busca(i, 1, N, ++n);
    cout << 0;
    for (int i = 1; i <= N; i++) cout << " " << F[i];
    cout << endl;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 19 ms 248 KB Output is correct
2 Correct 15 ms 248 KB Output is correct
3 Correct 21 ms 376 KB Output is correct
4 Correct 11 ms 376 KB Output is correct
5 Incorrect 4 ms 248 KB Same person came twice to the party.
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 14 ms 376 KB Output is correct
2 Incorrect 7 ms 376 KB Same person came twice to the party.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 248 KB Same person came twice to the party.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 376 KB Output is correct
2 Incorrect 8 ms 248 KB Same person came twice to the party.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 248 KB Output is correct
2 Correct 26 ms 376 KB Output is correct
3 Correct 26 ms 376 KB Output is correct
4 Incorrect 17 ms 376 KB Same person came twice to the party.
5 Halted 0 ms 0 KB -