답안 #798396

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
798396 2023-07-30T16:39:35 Z Sohsoh84 Ancient Machine (JOI21_ancient_machine) C++17
컴파일 오류
0 ms 0 KB
#include "Anna.h"
#include <bits/stdc++.h>

using namespace std;

namespace {
	int variable_example = 0;
}

void Anna(int N, std::vector<char> S) {
	variable_example++;
	vector<int> ans;
	bool flag = true;
	for (int i = 0; i < N; i++) {
		if (S[i] == 'X') flag = false;
		ans.push_back(flag || S[i] == 'Z');
	}

	for (int e : ans)
		cerr << e << ' ';
	cerr << endl;

	while (!ans.empty() && ans.back() == 0) ans.pop_back();
	if (!ans.empty()) ans.pop_back();

	for (int e : ans)
		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) {
	A.push_back(1);
	while (A.size() < N) A.push_back(0);

	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();
	}
}
i

Compilation message

Bruno.cpp: In function 'void Bruno(int, int, std::vector<int>)':
Bruno.cpp:16:18: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   16 |  while (A.size() < N) A.push_back(0);
      |         ~~~~~~~~~^~~
Bruno.cpp: At global scope:
Bruno.cpp:35:1: error: 'i' does not name a type
   35 | i
      | ^
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;
      |      ^~~~~~~~~~~~~~~~