제출 #947165

#제출 시각아이디문제언어결과실행 시간메모리
947165siewjhAncient Machine (JOI21_ancient_machine)C++17
0 / 100
48 ms8472 KiB
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;

namespace {
}

void Anna(int N, vector<char> S) {
	bool active = 0;
	for (int i = 0; i < N; i++){
		if (S[i] == 'X'){
			Send(!active);
			active = 1;
		}
		else if (S[i] == 'Y') Send(0);
		else Send(active);
	}
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;

namespace {
}  // namespace

void Bruno(int N, int L, vector<int> A) {
	int prv, fx = -1;
	for (int i = 0; i < N; i++){
		if (A[i]){
			if (fx == -1){
				fx = i; prv = i + 1;
			}
			else{
				for (int j = i - 1; j >= prv; j--) Remove(j);
				Remove(i);
				prv = i + 1;
			}
		}
	}
	for (int i = 0; i <= fx; i++) Remove(i);
	for (int i = prv; i < N; i++) Remove(i);
}

컴파일 시 표준 에러 (stderr) 메시지

Bruno.cpp: In function 'void Bruno(int, int, std::vector<int>)':
Bruno.cpp:23:2: warning: 'prv' may be used uninitialized in this function [-Wmaybe-uninitialized]
   23 |  for (int i = prv; i < N; i++) Remove(i);
      |  ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...