Submission #931597

# Submission time Handle Problem Language Result Execution time Memory
931597 2024-02-22T06:24:10 Z lamter Ancient Machine (JOI21_ancient_machine) C++17
Compilation error
0 ms 0 KB
#include "Anna.h"
#include <bits/stdc++.h>

void Anna(int n, std::vector <char> a) {
	bool found = 0;
	for (int i = 0; i < n; i += 1) {
		int bit = 0;

		if (not found and a[i] == 'X') {
			bit = 1;
			found = true;
		}

		if (found and a[i] == 'Z') {
			bit = 1;
		}

		Send(bit);
	}
}
#include "Bruno.h"
#include <bits/stdc++.h>

void Bruno(int n, int l, std::vector <int> a) {
	assert(n == l);
	std::vector <int> posOne;
	for (int i = 0; i < n; i += 1) if (a[i])
		posOne.push_back(i);
	assert(posOne.size());
	int x = posOne[0];
	for (int i = 0; i < x; i += 1) {
		Remove(i);
	}
	for (int i = 0; i + 1 < (int) posOne.size(); i += 1) {
		for (int j = posOne[i + 1] - 1; j > posOne[i]; j -= 1)
			Remove(j);
		Remove(posOne[i + 1]);
	}
	for (int j = posOne.back() + 1; j < n; j += 1) {
		Remove(j);
	}
	Remove(x);
}
#include "Bruno.h"
#include <bits/stdc++.h>

void Bruno(int n, int l, std::vector <int> a) {
	assert(n == l);
	std::vector <int> posOne;
	for (int i = 0; i < n; i += 1) if (a[i])
		posOne.push_back(i);
	assert(posOne.size());
	int x = posOne[0];
	for (int i = 0; i < x; i += 1) {
		Remove(i);
	}
	for (int i = 0; i + 1 < (int) posOne.size(); i += 1) {
		for (int j = posOne[i + 1] - 1; j > posOne[i]; j -= 1)
			Remove(j);
		Remove(posOne[i + 1]);
	}
	for (int j = posOne.back() + 1; j < n; j += 1) {
		Remove(j);
	}
	Remove(x);
}

Compilation message

Bruno.cpp:27:6: error: redefinition of 'void Bruno(int, int, std::vector<int>)'
   27 | void Bruno(int n, int l, std::vector <int> a) {
      |      ^~~~~
Bruno.cpp:4:6: note: 'void Bruno(int, int, std::vector<int>)' previously defined here
    4 | void Bruno(int n, int l, std::vector <int> a) {
      |      ^~~~~