Submission #134184

# Submission time Handle Problem Language Result Execution time Memory
134184 2019-07-22T08:09:24 Z ekrem ICC (CEOI16_icc) C++
0 / 100
48 ms 24184 KB
#include "icc.h"
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define sol (k+k)
#define sag (k+k+1)
#define orta ((bas+son)/2)
#define coc g[node][i]
#define mod 1000000007
#define inf 1000000009
#define N 1000005
using namespace std;

typedef long long ll;
typedef pair < int , int > ii;
typedef vector < int > vi;


int n, fl, ata[N], aa, bb, a[N], b[N];
vector < int > g[N];

void merge(int i, int j){
	i = ata[i];
	j = ata[j];
	for(int x = 0; x < g[j].size(); x++){
		ata[g[j][x]] = i;
		g[i].pb(g[j][x]);
	}
}

void coz2(vi x, vi y){
	if((int)x.size() == 1 and (int)y.size() == 1){
		setRoad(x[0], y[0]);
		// cout << x[0] << " " << y[0] << endl;
		return;
	}
	aa = bb = 0;
	vi bir, iki;
	if((int)y.size() == 1){
		int sz = x.size();
		for(int i = 0; i < sz/2; i++){
			bir.pb(x[i]);
			a[aa++] = x[i];
		}
		for(int i = sz/2; i < sz; i++)
			iki.pb(x[i]);
		for(int i = 0; i < y.size(); i++)
			b[bb++] = y[i];
		if(query(aa, bb, a, b))
			coz2(bir, y);
		else
			coz2(iki, y);
	} else{
		int sz = y.size();
		for(int i = 0; i < sz/2; i++){
			bir.pb(y[i]);
			a[aa++] = y[i];
		}
		for(int i = sz/2; i < sz; i++)
			iki.pb(y[i]);
		for(int i = 0; i < x.size(); i++)
			b[bb++] = x[i];
		if(query(aa, bb, a, b))
			coz2(x, bir);
		else
			coz2(x, iki);
	}
}

void coz(vi x){
	if(fl or (int)x.size() <= 1)
		return;
	int sz = x.size();
	aa = 0;
	bb = 0;
	vi bir, iki, birr, ikii;
	for(int i = 0; i < sz/2; i++){
		bir.pb(x[i]);
		for(int j = 0; j < g[x[i]].size(); j++){
			a[aa++] = g[x[i]][j];
			birr.pb(g[x[i]][j]);
		}
	}
	for(int i = sz/2; i < sz; i++){
		iki.pb(x[i]);
		for(int j = 0; j < g[x[i]].size(); j++){
			b[bb++] = g[x[i]][j];
			ikii.pb(g[x[i]][j]);
		}
	}
	if(query(aa, bb, a, b)){
		coz2(birr, ikii);
		fl = 1;
		return;
	}
	coz(bir);
	coz(iki);
}


void run(int nn){n = nn;
	for(int i = 1; i <= n; i++){
		ata[i] = i;
		g[i].pb(i);
	}
	for(int i = 1; i < n; i++){
		vi x;
		for(int i = 1; i <= n; i++)
			if(ata[i] == i)
				x.pb(i);
		fl = 0;
		coz(x);
	}
}

Compilation message

icc.cpp: In function 'void merge(int, int)':
icc.cpp:28:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int x = 0; x < g[j].size(); x++){
                 ~~^~~~~~~~~~~~~
icc.cpp: In function 'void coz2(vi, vi)':
icc.cpp:50:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 0; i < y.size(); i++)
                  ~~^~~~~~~~~~
icc.cpp:64:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 0; i < x.size(); i++)
                  ~~^~~~~~~~~~
icc.cpp: In function 'void coz(vi)':
icc.cpp:82:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j = 0; j < g[x[i]].size(); j++){
                  ~~^~~~~~~~~~~~~~~~
icc.cpp:89:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j = 0; j < g[x[i]].size(); j++){
                  ~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 24056 KB Wrong road!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 24056 KB Wrong road!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 40 ms 24056 KB Wrong road!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 48 ms 24056 KB Wrong road!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 41 ms 24184 KB Wrong road!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 40 ms 24056 KB Wrong road!
2 Halted 0 ms 0 KB -