Submission #274022

# Submission time Handle Problem Language Result Execution time Memory
274022 2020-08-19T08:13:35 Z toonewbie Carnival (CEOI14_carnival) C++17
0 / 100
83 ms 384 KB
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
//#define endl '\n'
#define ll long long
#define pi pair<int,int>

using namespace std;

const int MOD = 1e9 + 7;
const int N = 155;

int n;

int ask(vector<int> v) {
    cout << v.size() << " ";
    for (int i : v) cout << i << " ";
    cout << endl;
    int x; cin >> x;
    return x;
}

vector<int> g[N];
int nxt = 0, used[N], res[N];
void dfs(int v) {
    used[v] = 1;
    res[v] = nxt;
    for (int i : g[v]) if (!used[i]) dfs(i);
}
int in_same(int x, int y) {
    for (int i = 1; i <= n; i++) used[i] = 0;
    dfs(x);
    return used[y];
}
int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        for (int j = i + 1; j <= n; j++) {
            if (in_same(i, j)) continue;
            if (ask({i, j}) == 1) g[i].pb(j), g[j].pb(i);
        }
    }
    for (int i = 1; i <= n; i++) {
        if (!used[i]) {
            nxt++;
            dfs(i);
        }
    }
    cout << 0 << " ";
    for (int i = 1; i <= n; i++) {
        cout << res[i] << " ";
    }
    cout << endl;
    return 0;
}

# Verdict Execution time Memory Grader output
1 Incorrect 83 ms 384 KB Integer 0 violates the range [1, 11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 78 ms 384 KB Integer 0 violates the range [1, 5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 384 KB Integer 0 violates the range [1, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 64 ms 384 KB Integer 0 violates the range [1, 4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 52 ms 384 KB Integer 0 violates the range [1, 2]
2 Halted 0 ms 0 KB -