답안 #800047

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
800047 2023-08-01T09:35:59 Z Sohsoh84 Ancient Machine (JOI21_ancient_machine) C++17
0 / 100
43 ms 8180 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;

	if (ind) A[ind - 1] = 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;
      |      ^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 508 KB Output is correct
2 Correct 0 ms 516 KB Output is correct
3 Incorrect 1 ms 508 KB Wrong Answer [6]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 40 ms 8120 KB Partially correct
2 Partially correct 43 ms 8176 KB Partially correct
3 Partially correct 40 ms 8180 KB Partially correct
4 Incorrect 40 ms 8172 KB Wrong Answer [6]
5 Halted 0 ms 0 KB -