답안 #928554

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
928554 2024-02-16T16:15:13 Z denniskim Ancient Machine (JOI21_ancient_machine) C++17
0 / 100
45 ms 7908 KB
#include "Anna.h"
#include <vector>

namespace {
int X = -1;
}

void Anna(int N, std::vector<char> S)
{
	X = -1;
	
	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;
      |     ^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 780 KB Output is correct
2 Correct 0 ms 792 KB Output is correct
3 Incorrect 1 ms 780 KB Wrong Answer [6]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 40 ms 7908 KB Partially correct
2 Incorrect 45 ms 7840 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -