Submission #116652

# Submission time Handle Problem Language Result Execution time Memory
116652 2019-06-13T10:49:11 Z ioilolcom Carnival (CEOI14_carnival) C++14
0 / 100
2 ms 384 KB
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;
const int N=156;
vector<int> adj[N];
int cnt=1;
bool vis[N];
int c[N];
void dfs(int u){
	if(vis[u]) return;
	c[u]=cnt;
	vis[u]=1;
	for(int v:adj[u]) {
		dfs(v);
	}
}
int main()
{

	ios_base:: sync_with_stdio(false); cin.tie(0);
	int n; cin>>n;
	for(int i=1; i<=n; i++) {
		for(int j=i+1; j<=n; j++) {
			cout<<2<<" ";
			cout<<i<<" "<<j<<endl;
			fflush(stdout);
			int t;
			cin>>t;
			if(t==1) {
				adj[i].push_back(j);
				adj[j].push_back(i);
			}
		}
	}
	for(int i=1; i<=n; i++) {
		if(!vis[i]) {
			dfs(i);
			cnt++;
		}
	}
	cout<<"0 ";
	for(int i=1; i<=n; i++) {
		cout<<c[i]<<" ";
	}

	return 0;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 2 ms 384 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2 ms 384 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2 ms 256 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2 ms 384 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2 ms 384 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -