Submission #927957

# Submission time Handle Problem Language Result Execution time Memory
927957 2024-02-15T14:45:33 Z MuntherCarrot Carnival (CEOI14_carnival) C++14
84 / 100
27 ms 968 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
// #define endl '\n'
#define all(x) x.begin(), x.end()
#define INF 0x3f3f3f3f
#define INFLL (ll)0x3f3f3f3f3f3f3f3f
const int MOD = 1e9 + 7, SZ = 1e5 + 10;
int ask(vector<int> vec){
    cout.flush() << vec.size() << ' ';
    for(int i : vec) cout.flush() << i << ' ';
    cout.flush() << endl;
    int res;
    cin >> res;
    return res;
}
int32_t main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    int a[n + 1] = {};
    for(int i = 1; i <= n; i++){
        vector<int> vec(i);
        iota(all(vec), 1);
        a[i] = ask(vec);
    }
    int ans[n + 1], x = 0;
    for(int i = 1; i <= n; i++){
        if(a[i] == a[i - 1] + 1){
            ans[i] = ++x;
        }
        else{
            for(int j = 1; j < i; j++){
                if(ask({j, i}) == 1){
                    ans[i] = ans[j];
                    break;
                }
            }
        }
    }
    cout.flush() << 0 << ' ';
    for(int i = 1; i <= n; i++){
        cout.flush() << ans[i] << ' ';
    }
    cout.flush() << endl;
    return 0;
}
// by me
# Verdict Execution time Memory Grader output
1 Correct 8 ms 464 KB Output is correct
2 Correct 19 ms 704 KB Output is correct
3 Correct 16 ms 960 KB Output is correct
4 Correct 4 ms 708 KB Output is correct
5 Correct 5 ms 452 KB Output is correct
6 Correct 5 ms 852 KB Output is correct
7 Correct 12 ms 712 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 452 KB Output is correct
2 Correct 22 ms 612 KB Output is correct
3 Correct 12 ms 456 KB Output is correct
4 Correct 7 ms 712 KB Output is correct
5 Correct 5 ms 708 KB Output is correct
6 Correct 5 ms 964 KB Output is correct
7 Correct 9 ms 704 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 968 KB Output is correct
2 Correct 9 ms 456 KB Output is correct
3 Partially correct 27 ms 708 KB Partially correct
4 Correct 6 ms 964 KB Output is correct
5 Correct 5 ms 700 KB Output is correct
6 Correct 6 ms 600 KB Output is correct
7 Correct 17 ms 956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 708 KB Output is correct
2 Correct 6 ms 460 KB Output is correct
3 Correct 10 ms 708 KB Output is correct
4 Correct 6 ms 724 KB Output is correct
5 Correct 5 ms 964 KB Output is correct
6 Correct 6 ms 964 KB Output is correct
7 Correct 16 ms 448 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 964 KB Output is correct
2 Correct 15 ms 712 KB Output is correct
3 Correct 25 ms 708 KB Output is correct
4 Correct 13 ms 708 KB Output is correct
5 Correct 7 ms 704 KB Output is correct
6 Correct 4 ms 456 KB Output is correct
7 Correct 7 ms 716 KB Output is correct