Submission #928555

# Submission time Handle Problem Language Result Execution time Memory
928555 2024-02-16T16:15:45 Z denniskim Ancient Machine (JOI21_ancient_machine) C++17
Compilation error
0 ms 0 KB
#include "Anna.h"
#include <vector>

namespace {
int X = -1;
}

void Anna(int N, std::vector<char> S)
{
	X = -1;
	
	if(N == 18)
		assert(0);
	
	for(int i = 0 ; i < N ; i++)
	{
		int ff = 0;
		
		if(S[i] == 'X')
		{
			if(X == -1)
				ff = 1, X = i;
		}
		
		else if(S[i] == 'Z')
		{
			if(i == N - 1 || S[i + 1] != 'Z')
				ff = 1;
		}
		
		Send(ff);
	}
}
#include "Bruno.h"
#include <vector>

namespace {

int variable_example = 0;

int FunctionExample(int P) { return 1 - P; }

}  // namespace

void Bruno(int N, int L, std::vector<int> A)
{
	std::vector<int> vv;
	
	for(int i = 0 ; i < L ; i++)
	{
		if(A[i] == 1)
			vv.push_back(i);
	}
	
	if((int)vv.size() <= 1)
	{
		for(int i = 0 ; i < N ; i++)
			Remove(i);
		
		return;
	}
	
	int siz = (int)vv.size();
	
	for(int i = 0 ; i < vv[0] ; i++)
		Remove(i);
	
	for(int i = vv[siz - 1] + 1 ; i < N ; i++)
		Remove(i);
	
	for(int i = 1 ; i < (int)vv.size() ; i++)
	{
		for(int j = vv[i] - 1 ; j > vv[i - 1] ; j--)
			Remove(j);
		
		Remove(vv[i]);
	}
	
	Remove(vv[0]);
}

Compilation message

Anna.cpp: In function 'void Anna(int, std::vector<char>)':
Anna.cpp:13:3: error: 'assert' was not declared in this scope
   13 |   assert(0);
      |   ^~~~~~
Anna.cpp:2:1: note: 'assert' is defined in header '<cassert>'; did you forget to '#include <cassert>'?
    1 | #include "Anna.h"
  +++ |+#include <cassert>
    2 | #include <vector>

Bruno.cpp:8:5: warning: 'int {anonymous}::FunctionExample(int)' defined but not used [-Wunused-function]
    8 | int FunctionExample(int P) { return 1 - P; }
      |     ^~~~~~~~~~~~~~~
Bruno.cpp:6:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    6 | int variable_example = 0;
      |     ^~~~~~~~~~~~~~~~