Submission #800049

# Submission time Handle Problem Language Result Execution time Memory
800049 2023-08-01T09:36:22 Z Sohsoh84 Ancient Machine (JOI21_ancient_machine) C++17
0 / 100
40 ms 8172 KB
#include "Anna.h"
#include <bits/stdc++.h>

using namespace std;

namespace {
	int variable_example = 0;
}

void Anna(int N, vector<char> S) {
	variable_example++;
	bool flag = true;
	vector<int> A;

	for (int i = 0; i < N; i++) {
		A.push_back((S[i] == 'Z'));
	}

	int ind = 0;
	while (S[ind] != 'X' && ind < N) ind++;

	if (ind == N) return;
/*
	for (int i = N - 2; i >= 0; i--)
		if (A[i] == 1 && A[i + 1] == 1)
			A[i] = 0;
*/
	for (int i = 0; i <= ind; i++)
		A[i] = 0;

	A[ind] = 1;

	for (int e : A)
		Send(e);
}


#include "Bruno.h"
#include <bits/stdc++.h>

using namespace std;

namespace {

	int variable_example = 0;

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

}  // namespace

void Bruno(int N, int L, std::vector<int> A) {
	if (!L) {
		for (int i = 0; i < N; i++)
			Remove(i);

		return;
	}

	stack<int> st;
	for (int i = 0; i < L; i++) {
		if (A[i]) {
			while (st.size() > 1) {
				Remove(st.top());
				st.pop();
			}

			Remove(i);
		} else st.push(i);
	}

	while (!st.empty()) {
		Remove(st.top());
		st.pop();
	}
}


Compilation message

Anna.cpp: In function 'void Anna(int, std::vector<char>)':
Anna.cpp:12:7: warning: unused variable 'flag' [-Wunused-variable]
   12 |  bool flag = true;
      |       ^~~~

Bruno.cpp:10:6: warning: 'int {anonymous}::FunctionExample(int)' defined but not used [-Wunused-function]
   10 |  int FunctionExample(int P) { return 1 - P; }
      |      ^~~~~~~~~~~~~~~
Bruno.cpp:8:6: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    8 |  int variable_example = 0;
      |      ^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 508 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 40 ms 8148 KB Partially correct
2 Incorrect 40 ms 8172 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -