Submission #24648

# Submission time Handle Problem Language Result Execution time Memory
24648 2017-06-10T19:45:12 Z jiangzhi ICC (CEOI16_icc) C++
Compilation error
0 ms 0 KB
#include <cstdio>
#include <vector>
#include <algorithm> 
#include "icc.h"

using namespace std;

const int N = 110;

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

int t1[N];
int size_t1;
int t2[N];
int size_t2;

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 cas = 1; cas <= n - 1; cas++){
		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_b++]=aux[total[i]][j];
					}
				}
			}
			if(query(size_a,size_b,a,b))break;
		}
		while(size_a!=1){
			size_t1 = 0;
			size_t2 = 0;
			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){
			size_t1 = 0;
			size_t2 = 0;
			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]);
		}
		total.clear();
		for(int i = 0; i < total2.size(); i++){
			total.push_back(total2[i]);
		}

	}
}




Compilation message

icc.cpp: In function 'void run(int)':
icc.cpp:35:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
      for(int j = 0; j < aux[total[i]].size(); j++){
                       ^
icc.cpp:40:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
      for(int j = 0; j < aux[total[i]].size(); j++){
                       ^
icc.cpp:98:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int i = 0; i < aux[b[0]].size(); i++){
                     ^
icc.cpp:105:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int i = 0; i < aux[a[0]].size(); i++){
                     ^
icc.cpp:112:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 0; i < total.size(); i++){
                    ^
icc.cpp:116:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 0; i < total2.size(); i++){
                    ^
In file included from /usr/include/c++/5/array:35:0,
                 from graderlib.cpp:9,
                 from grader.cpp:4:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support \
  ^
In file included from grader.cpp:4:0:
graderlib.cpp:569:9: warning: identifier 'nullptr' is a keyword in C++11 [-Wc++0x-compat]
         solver = nullptr;
         ^
graderlib.cpp:132:9: error: 'array' does not name a type
 typedef array<array<int, kMaxN>, kMaxN> IntArr;
         ^
graderlib.cpp:143:51: error: 'IntArr' does not name a type
 AdjacencyMatrixInformation GetAMInformation(const IntArr& valid_edge, const vector<int>& component) {
                                                   ^
graderlib.cpp: In function 'ceoi_2016::AdjacencyMatrixInformation ceoi_2016::GetAMInformation(const int&, const std::vector<int>&)':
graderlib.cpp:144:5: error: 'IntArr' was not declared in this scope
     IntArr component_count;
     ^
graderlib.cpp:151:13: error: 'component_count' was not declared in this scope
             component_count[i][j] = 0;
             ^
graderlib.cpp:157:29: error: invalid types 'const int[int]' for array subscript
             if (valid_edge[i][j] == 1) {
                             ^
graderlib.cpp:158:17: error: 'component_count' was not declared in this scope
                 component_count[component[i]][component[j]] += 1;
                 ^
graderlib.cpp:165:17: error: 'component_count' was not declared in this scope
             if (component_count[i][j] != 0) {
                 ^
graderlib.cpp: At global scope:
graderlib.cpp:218:10: error: 'IntArr' was not declared in this scope
     pair<IntArr, IntArr> GetIncludedExcluded(int a, int b, int* A, int *B);
          ^
graderlib.cpp:218:18: error: 'IntArr' was not declared in this scope
     pair<IntArr, IntArr> GetIncludedExcluded(int a, int b, int* A, int *B);
                  ^
graderlib.cpp:218:24: error: template argument 1 is invalid
     pair<IntArr, IntArr> GetIncludedExcluded(int a, int b, int* A, int *B);
                        ^
graderlib.cpp:218:24: error: template argument 2 is invalid
graderlib.cpp:233:5: error: 'IntArr' does not name a type
     IntArr valid_edge;
     ^
graderlib.cpp:238:22: error: 'IntArr' does not name a type
     void Print(const IntArr& arr) {
                      ^
graderlib.cpp: In member function 'void ceoi_2016::BasicInteractiveSolver::Print(const int&)':
graderlib.cpp:241:75: error: invalid types 'const int[int]' for array subscript
             for (int j = 1; j <= n; j += 1) { fprintf(stderr, "%d ", arr[i][j]); }
                                                                           ^
graderlib.cpp: In member function 'virtual bool ceoi_2016::BasicInteractiveSolver::SetEdge(int, int)':
graderlib.cpp:297:17: error: 'valid_edge' was not declared in this scope
             if (valid_edge[i][j] != 0) {
                 ^
graderlib.cpp:299:31: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
                 answer = {i, j};
                               ^
graderlib.cpp:299:24: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
                 answer = {i, j};
                        ^
graderlib.cpp: In member function 'void ceoi_2016::BasicInteractiveSolver::UniteVertices(int, int)':
graderlib.cpp:326:10: warning: 'auto' changes meaning in C++11; please remove it [-Wc++0x-compat]
     for (auto& itr : component) {
          ^
graderlib.cpp:326:16: error: ISO C++ forbids declaration of 'itr' with no type [-fpermissive]
     for (auto& itr : component) {
                ^
graderlib.cpp:326:22: warning: range-based 'for' loops only available with -std=c++11 or -std=gnu++11
     for (auto& itr : component) {
                      ^
graderlib.cpp:332:30: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
     selected_edges.push_back({a, b});
                              ^
graderlib.cpp:332:36: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
     selected_edges.push_back({a, b});
                                    ^
graderlib.cpp: In member function 'void ceoi_2016::BasicInteractiveSolver::ResetValidEdges()':
graderlib.cpp:339:13: error: 'valid_edge' was not declared in this scope
             valid_edge[i][j] = (component[i] != component[j]);
             ^
graderlib.cpp: At global scope:
graderlib.cpp:345:6: error: 'IntArr' was not declared in this scope
 pair<IntArr, IntArr> BasicInteractiveSolver::GetIncludedExcluded(int a, int b, int* A, int *B) {
      ^
graderlib.cpp:345:14: error: 'IntArr' was not declared in this scope
 pair<IntArr, IntArr> BasicInteractiveSolver::GetIncludedExcluded(int a, int b, int* A, int *B) {
              ^
graderlib.cpp:345:20: error: template argument 1 is invalid
 pair<IntArr, IntArr> BasicInteractiveSolver::GetIncludedExcluded(int a, int b, int* A, int *B) {
                    ^
graderlib.cpp:345:20: error: template argument 2 is invalid
graderlib.cpp: In member function 'int ceoi_2016::BasicInteractiveSolver::GetIncludedExcluded(int, int, int*, int*)':
graderlib.cpp:346:5: error: 'IntArr' was not declared in this scope
     IntArr exclude = valid_edge; // answer false -> all current edges in the query are invalid
     ^
graderlib.cpp:347:12: error: expected ';' before 'include'
     IntArr include = valid_edge; // include only the query edges. the others are invalid -> answer = true
            ^
graderlib.cpp:351:13: error: 'exclude' was not declared in this scope
             exclude[A[i]][B[j]] = false;
             ^
graderlib.cpp:358:17: error: 'include' was not declared in this scope
             if (include[A[i]][B[j]] == 1) {
                 ^
graderlib.cpp:367:17: error: 'include' was not declared in this scope
             if (include[i][j] == 1) {
                 ^
graderlib.cpp:375:12: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
     return {include, exclude};
            ^
graderlib.cpp:375:13: error: 'include' was not declared in this scope
     return {include, exclude};
             ^
graderlib.cpp:375:22: error: 'exclude' was not declared in this scope
     return {include, exclude};
                      ^
graderlib.cpp:375:29: error: cannot convert '<brace-enclosed initializer list>' to 'int' in return
     return {include, exclude};
                             ^
graderlib.cpp: In member function 'virtual bool ceoi_2016::BasicInteractiveSolver::Query(int, int, int*, int*)':
graderlib.cpp:393:5: warning: 'auto' changes meaning in C++11; please remove it [-Wc++0x-compat]
     auto incexc = GetIncludedExcluded(a, b, A, B);
     ^
graderlib.cpp:393:10: error: 'incexc' does not name a type
     auto incexc = GetIncludedExcluded(a, b, A, B);
          ^
graderlib.cpp:395:5: warning: 'auto' changes meaning in C++11; please remove it [-Wc++0x-compat]
     auto& include = incexc.first;
     ^
graderlib.cpp:395:11: error: ISO C++ forbids declaration of 'include' with no type [-fpermissive]
     auto& include = incexc.first;
           ^
graderlib.cpp:395:21: error: 'incexc' was not declared in this scope
     auto& include = incexc.first;
                     ^
graderlib.cpp:396:5: warning: 'auto' changes meaning in C++11; please remove it [-Wc++0x-compat]
     auto& exclude = incexc.second;
     ^
graderlib.cpp:396:11: error: ISO C++ forbids declaration of 'exclude' with no type [-fpermissive]
     auto& exclude = incexc.second;
           ^
graderlib.cpp:398:5: warning: 'auto' changes meaning in C++11; please remove it [-Wc++0x-compat]
     auto inf_inc = GetAMInformation(include, component);
     ^
graderlib.cpp:398:10: error: 'inf_inc' does not name a type
     auto inf_inc = GetAMInformation(include, component);
          ^
graderlib.cpp:399:5: warning: 'auto' changes meaning in C++11; please remove it [-Wc++0x-compat]
     auto inf_exc = GetAMInformation(exclude, component);
     ^
graderlib.cpp:399:10: error: 'inf_exc' does not name a type
     auto inf_exc = GetAMInformation(exclude, component);
          ^
graderlib.cpp:401:49: error: 'inf_inc' was not declared in this scope
     double inc = true_coef * MaxScoreFromAMInfo(inf_inc);
                                                 ^
graderlib.cpp:402:50: error: 'inf_exc' was not declared in this scope
     double exc = false_coef * MaxScoreFromAMInfo(inf_exc);
                                                  ^
graderlib.cpp:407:9: error: 'valid_edge' was not declared in this scope
         valid_edge = include;
         ^
graderlib.cpp:410:9: error: 'valid_edge' was not declared in this scope
         valid_edge = exclude;
         ^
graderlib.cpp: In member function 'virtual int ceoi_2016::BasicInteractiveSolver::MaxScoreFromAMInfo(ceoi_2016::AdjacencyMatrixInformation)':
graderlib.cpp:432:38: error: 'rand' was not declared in this scope
         1.0 * max_rand * (1.0 * rand() / RAND_MAX);
                                      ^
graderlib.cpp:432:42: error: 'RAND_MAX' was not declared in this scope
         1.0 * max_rand * (1.0 * rand() / RAND_MAX);
                                          ^
graderlib.cpp: In member function 'void ceoi_2016::Interaction::SetScore(int, const string&)':
graderlib.cpp:474:11: error: 'exit' was not declared in this scope
     exit(0);
           ^
graderlib.cpp: In member function 'void ceoi_2016::Interaction::DecideScore()':
graderlib.cpp:480:57: error: 'to_string' was not declared in this scope
         SetScore(max_score, "Ok! " + to_string(num_steps) + " queries used.");
                                                         ^
graderlib.cpp:482:63: error: 'to_string' was not declared in this scope
         SetScore(0, "Too many queries! " + to_string(num_steps) + " out of " + to_string(max_steps));
                                                               ^
graderlib.cpp: In member function 'bool ceoi_2016::Interaction::Query(int, int, int*, int*)':
graderlib.cpp:488:96: error: 'to_string' was not declared in this scope
     Expect(num_steps <= 2 * max_steps, "Number of queries more than " + to_string(2 * max_steps) + " out of " + to_string(max_steps));
                                                                                                ^
graderlib.cpp: In function 'void InitGrader()':
graderlib.cpp:569:18: error: 'nullptr' was not declared in this scope
         solver = nullptr;
                  ^