Submission #574931

# Submission time Handle Problem Language Result Execution time Memory
574931 2022-06-09T13:05:56 Z birthdaycake Carnival (CEOI14_carnival) C++17
0 / 100
12 ms 5004 KB
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
using namespace std;
 


vector<int>adj[200001];

int vs[151]; int c;

void dfs(int x){
    vs[x] = c;
    for(auto s:adj[x]){
        if(!vs[s]){
            vs[s] = c;
            dfs(s);
        }
    }
}
signed main(){
 
    int n; cin >> n;
    for(int i = 0; i < n; i++){
        int l = i, r = n - 1, aa = -1;
        while(l <= r){
            int mid = (l + r) / 2;
            if(mid - i + 1 == 1){
                l = mid + 1;
                aa = mid + 1;
                continue;
            }
            cout << mid - i + 1 << ' ' ;
            for(int j = i; j <= mid; j++){
                cout << j + 1 << ' ';
            }
            cout << endl;
            int ans; cin >> ans;
            if(ans == mid - l + 1){
                l = mid + 1;
                aa = mid + 1;
            }else{
                r = mid - 1;
            }
        }
        if(aa != -1){
            adj[i].push_back(aa);
        }
    }
    for(int i = 0; i < n; i++){
        if(!vs[i]){
            c++;
            dfs(i);
        }
    }
    cout << 0 << ' ' ;
    for(int i = 0; i < n;i++){
        cout << vs[i] << ' ';
    }
    cout << endl;
    
    
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 4996 KB Integer 12 violates the range [1, 11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 4996 KB Integer 6 violates the range [1, 5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 4992 KB Integer 2 violates the range [1, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 5004 KB Integer 5 violates the range [1, 4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 4944 KB Integer 3 violates the range [1, 2]
2 Halted 0 ms 0 KB -