Submission #947325

# Submission time Handle Problem Language Result Execution time Memory
947325 2024-03-15T22:03:52 Z Cyber_Wolf Airline Route Map (JOI18_airline) C++17
Compilation error
0 ms 0 KB
#include "Alicelib.h"
#include <bits/stdc++.h>
#include <cassert>
#include <cstdio>

using namespace std;

void Alice( int N, int M, int A[], int B[] ){
	vector<array<int, 2>> v;
	for(int i = 0; i < M; i++)
	{
		v.push_back({A[i], B[i]});
	}
	for(int i = N; i < 2*N+1; i++)
	{
		for(int j = i+1; j < 2*N+1; j++)
		{
			v.push_back({i, j});
		}
	}
	for(int i = 0; i < N; i++)
	{
		for(int j = N; j < N+i; j++)
		{
			v.push_back({i, j});
		}
	}
	InitG(2*N+1, v.size());
	for(int i = 0; i < v.size(); i++)
	{
		MakeG(i, v[i][0], v[i][1]);
	}
}

#include "Boblib.h"
#include <bits/stdc++.h>
#include <cassert>
#include <cstdio>

void Bob( int V, int U, int C[], int D[] ){
	int N = (V-1)/2;
	int deg[V], p[V];
	memset(deg, 0, sizeof(deg));
	memset(p, 0, sizeof(p));
	for(int i = 0; i < U; i++)
	{
		deg[C[i]]++;
		deg[D[i]]++;
	}
	vector<int> o;
	for(int i = 0; i < V; i++)
	{
		if(deg[i] >= N)
		{
			o.push_back(i);
		}
	}
	vector<array<int, 2>> v;
	for(int i = 0; i < U; i++)
	{
		if(deg[C[i]] >= N || deg[D[i]] >= N)
		{
			p[D[i]]++, p[C[i]]++;
			continue;
		}
		v.push_back({C[i], D[i]});
	}
	InitMap(N, v.size());
	for(auto [a, b] : v)	MakeMap(p[a], p[b]);
}

Compilation message

Alice.cpp: In function 'void Alice(int, int, int*, int*)':
Alice.cpp:29:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::array<int, 2> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |  for(int i = 0; i < v.size(); i++)
      |                 ~~^~~~~~~~~~

Bob.cpp: In function 'void Bob(int, int, int*, int*)':
Bob.cpp:16:2: error: 'vector' was not declared in this scope
   16 |  vector<int> o;
      |  ^~~~~~
Bob.cpp:16:2: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from Bob.cpp:2:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from Bob.cpp:2:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
Bob.cpp:16:9: error: expected primary-expression before 'int'
   16 |  vector<int> o;
      |         ^~~
Bob.cpp:21:4: error: 'o' was not declared in this scope
   21 |    o.push_back(i);
      |    ^
Bob.cpp:24:9: error: 'array' was not declared in this scope; did you mean 'std::array'?
   24 |  vector<array<int, 2>> v;
      |         ^~~~~
      |         std::array
In file included from /usr/include/c++/10/tuple:39,
                 from /usr/include/c++/10/functional:54,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from Bob.cpp:2:
/usr/include/c++/10/array:94:12: note: 'std::array' declared here
   94 |     struct array
      |            ^~~~~
Bob.cpp:24:15: error: expected primary-expression before 'int'
   24 |  vector<array<int, 2>> v;
      |               ^~~
Bob.cpp:32:3: error: 'v' was not declared in this scope
   32 |   v.push_back({C[i], D[i]});
      |   ^
Bob.cpp:34:13: error: 'v' was not declared in this scope
   34 |  InitMap(N, v.size());
      |             ^