Submission #928556

# Submission time Handle Problem Language Result Execution time Memory
928556 2024-02-16T16:16:11 Z denniskim Ancient Machine (JOI21_ancient_machine) C++17
0 / 100
40 ms 7884 KB
#include "Anna.h"
#include <bits/stdc++.h>

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

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;
      |     ^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 40 ms 7884 KB Partially correct
2 Incorrect 39 ms 7860 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -