Submission #574805

# Submission time Handle Problem Language Result Execution time Memory
574805 2022-06-09T12:09:48 Z birthdaycake Carnival (CEOI14_carnival) C++17
0 / 100
4 ms 5012 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(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
 
    int n; cin >> n;
    for(int i = 0; i < n; i++){
        cout << 2 << endl;
        for(int j = i + 1; j < n; j++){
            cout << i +1 << ' ' << j + 1 << endl;
            int a; cin >> a;
            if(a == 1){
                adj[i].push_back(j);
            }
        }
    }
    for(int i = 0; i < n; i++){
        if(!vs[i]){
            c++;
            dfs(i);
        }
    }
    for(int i = 0; i < n;i++){
        cout << vs[i] << ' ';
    }
}
# Verdict Execution time Memory Grader output
1 Execution timed out 4 ms 4944 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3 ms 5012 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4 ms 4944 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4 ms 4944 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4 ms 5008 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -