Submission #434361

# Submission time Handle Problem Language Result Execution time Memory
434361 2021-06-21T04:19:52 Z kevinxiehk Carnival (CEOI14_carnival) C++17
100 / 100
37 ms 328 KB
#include <bits/stdc++.h>
#define mp make_pair
#define pb emplace_back
#define fi first
#define se second
#define ick cout<<"ickbmi32.9\n"
using namespace std;
int col[155];
int cnt = 1;
int unq(int l, int r) {
    set<int> dk;
    dk.clear();
    for(int i = l; i <= r; i++) dk.insert(col[i]);
    return dk.size();
}
int query(int l, int r, int k) {
    cout << r - l + 2 << ' ';
    for(int i = l; i <= r; i++) cout << i + 1 << ' ';
    cout << k + 1 << endl;
    int a;
    cin >> a;
    return a;
}
int det(int k) {
    int a = query(0, k - 1, k);
    if(a > unq(0, k - 1)) {
        cnt++;
        return cnt;
    }
    int l = 0, r = k - 1; 
    while(l < r) {
        int m = (l + r) / 2;
        cerr << l << ' ' << m << ' ' << r << '\n';
        if(query(l, m, k) <= unq(l, m)) r = m;
        else l = m + 1;
    }
    int t = col[l];
    return t;
}
int main(){
    int n;
    cin >> n;
    col[0] = 1;
    for(int i = 1; i < n; i++) col[i] = det(i);
    cout << "0 ";
    for(int i = 0; i < n; i++) cout << col[i] << ' ';
    cout << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 19 ms 200 KB Output is correct
2 Correct 16 ms 200 KB Output is correct
3 Correct 10 ms 296 KB Output is correct
4 Correct 5 ms 200 KB Output is correct
5 Correct 29 ms 200 KB Output is correct
6 Correct 25 ms 200 KB Output is correct
7 Correct 23 ms 280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 200 KB Output is correct
2 Correct 22 ms 272 KB Output is correct
3 Correct 11 ms 292 KB Output is correct
4 Correct 6 ms 200 KB Output is correct
5 Correct 26 ms 276 KB Output is correct
6 Correct 25 ms 200 KB Output is correct
7 Correct 25 ms 320 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 200 KB Output is correct
2 Correct 19 ms 284 KB Output is correct
3 Correct 18 ms 296 KB Output is correct
4 Correct 6 ms 328 KB Output is correct
5 Correct 17 ms 320 KB Output is correct
6 Correct 20 ms 200 KB Output is correct
7 Correct 21 ms 272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 37 ms 276 KB Output is correct
2 Correct 17 ms 288 KB Output is correct
3 Correct 10 ms 288 KB Output is correct
4 Correct 4 ms 288 KB Output is correct
5 Correct 17 ms 200 KB Output is correct
6 Correct 15 ms 200 KB Output is correct
7 Correct 17 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 200 KB Output is correct
2 Correct 26 ms 328 KB Output is correct
3 Correct 15 ms 296 KB Output is correct
4 Correct 11 ms 296 KB Output is correct
5 Correct 13 ms 200 KB Output is correct
6 Correct 10 ms 200 KB Output is correct
7 Correct 6 ms 328 KB Output is correct