답안 #24635

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
24635 2017-06-10T19:20:35 Z jiangzhi CEOI16_icc (CEOI16_icc) C++11
컴파일 오류
0 ms 0 KB
#include <cstdio>
#include <vector>
#include "icc.h"

using namespace std;

const int N = 110;

int a[N];
int size_a;
int b[N];
int size_b;

int f1[N];
int size_f1;
int f2[N];
int size_f2;

vector<int> aux[N];

void run(int n){
	vector<int> total;
	for(int i = 1; i <= n; i++){
		total.push_back(i);
		aux[i].push_back(i);
	}		
	for(int i = 1; i <= n - 1; i++){
		while(1){
			random_shuffle(total.begin(),total.end());
			size_a = 0;
			size_b = 0;
			for(int i = 0; i < n; i++){
				if(i%2==0){
					for(int j = 0; j < aux[total[i]].size(); j++){
						a[size_a++]=aux[total[i]][j];
					}
				}
				else{
					for(int j = 0; j < aux[total[i]].size(); j++){
						b[size_a++]=aux[total[i]][j];
					}
				}
			}
			if(query(size_a,size_b,a,b))break;
		}
		while(size_a!=1){
			for(int i = 0; i < size_a; i++){
				if(i%2==0){
					t1[size_t1++]=a[i];
				}
				else{
					t2[size_t2++]=a[i];
				}
			}
			if(query(size_t1,size_b,t1,b)){
				size_a=size_t1;
				for(int i = 0; i < size_t1; i++){
					a[i]=t1[i];
				}
			}
			else{
				size_a=size_t2;
				for(int i = 0; i < size_t2; i++){
					a[i]=t2[i];
				}
			}
		}
		while(size_b!=1){
			for(int i = 0; i < size_b; i++){
				if(i%2==0){
					t1[size_t1++]=b[i];
				}
				else{
					t2[size_t2++]=b[i];
				}
			}
			if(query(size_a,size_t1,a,t1)){
				size_b=size_t1;
				for(int i = 0; i < size_t1; i++){
					b[i]=t1[i];
				}
			}
			else{
				size_b=size_t2;
				for(int i = 0; i < size_t2; i++){
					b[i]=t2[i];
				}
			}
		}
		setRoad(a[0],b[0]);
		int val;
		if(aux[a[0]].size()>aux[b[0]].size()){
			for(int i = 0; i < aux[b[0]].size(); i++){
				aux[a[0]].push_back(aux[b[0]][i]);
			}
			aux[b[0]].clear();
			val = b[0];
		}
		else{
			for(int i = 0; i < aux[a[0]].size(); i++){
				aux[b[0]].push_back(aux[a[0]][i]);
			}			
			aux[a[0]].clear();
			val = a[0];
		}
		vector<int>total2;
		for(int i = 0; i < total.size(); i++){
			if(total[i]!=val)total2.push_back(total[i]);
		}

	}
}


Compilation message

icc.cpp: In function 'void run(int)':
icc.cpp:29:44: error: 'random_shuffle' was not declared in this scope
    random_shuffle(total.begin(),total.end());
                                            ^
icc.cpp:34:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
      for(int j = 0; j < aux[total[i]].size(); j++){
                       ^
icc.cpp:39:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
      for(int j = 0; j < aux[total[i]].size(); j++){
                       ^
icc.cpp:49:6: error: 't1' was not declared in this scope
      t1[size_t1++]=a[i];
      ^
icc.cpp:49:9: error: 'size_t1' was not declared in this scope
      t1[size_t1++]=a[i];
         ^
icc.cpp:52:6: error: 't2' was not declared in this scope
      t2[size_t2++]=a[i];
      ^
icc.cpp:52:9: error: 'size_t2' was not declared in this scope
      t2[size_t2++]=a[i];
         ^
icc.cpp:55:13: error: 'size_t1' was not declared in this scope
    if(query(size_t1,size_b,t1,b)){
             ^
icc.cpp:55:28: error: 't1' was not declared in this scope
    if(query(size_t1,size_b,t1,b)){
                            ^
icc.cpp:62:12: error: 'size_t2' was not declared in this scope
     size_a=size_t2;
            ^
icc.cpp:64:11: error: 't2' was not declared in this scope
      a[i]=t2[i];
           ^
icc.cpp:71:6: error: 't1' was not declared in this scope
      t1[size_t1++]=b[i];
      ^
icc.cpp:71:9: error: 'size_t1' was not declared in this scope
      t1[size_t1++]=b[i];
         ^
icc.cpp:74:6: error: 't2' was not declared in this scope
      t2[size_t2++]=b[i];
      ^
icc.cpp:74:9: error: 'size_t2' was not declared in this scope
      t2[size_t2++]=b[i];
         ^
icc.cpp:77:20: error: 'size_t1' was not declared in this scope
    if(query(size_a,size_t1,a,t1)){
                    ^
icc.cpp:77:30: error: 't1' was not declared in this scope
    if(query(size_a,size_t1,a,t1)){
                              ^
icc.cpp:84:12: error: 'size_t2' was not declared in this scope
     size_b=size_t2;
            ^
icc.cpp:86:11: error: 't2' was not declared in this scope
      b[i]=t2[i];
           ^
icc.cpp:93:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int i = 0; i < aux[b[0]].size(); i++){
                     ^
icc.cpp:100:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int i = 0; i < aux[a[0]].size(); i++){
                     ^
icc.cpp:107:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 0; i < total.size(); i++){
                    ^