Submission #547996

#TimeUsernameProblemLanguageResultExecution timeMemory
547996SamNguyenAncient Machine (JOI21_ancient_machine)C++17
0 / 100
56 ms7692 KiB
#include "Anna.h"
#include <vector>
#include <iostream>
#include <math.h>
using namespace std;

void Anna(int N, vector<char> S) {
	const int MAX_BIT = log2(N - 1);

	char target = 'X';

	for (int i = 0; i < N; target = target ^ 'X' ^ 'Z') {
		int j = i;	
		while (j < N and S[j] != target) {
			Send(0);
			j++;
		}
		if (j >= N) break;

		Send(1);
		i = j + 1;
	}
}
#include "Bruno.h"
#include <vector>
#include <string>
#include <cstring>
#include <iostream>
#include <bitset>
#include <math.h>
using namespace std;

namespace {
	
}

void Bruno(int N, int L, std::vector<int> A) {
	const int MAX_BIT = log2(N - 1);
	vector<int> check_points = {-1};

	for (int i = 0; i < L; i++) 
		if (A[i])
			check_points.push_back(i);

	check_points.push_back(N);

	for (int i = 0; i < (int)check_points.size(); i++) 
		for (int j = check_points[i] - 1; j > check_points[i - 1]; j--)
			Remove(j);
	
	for (int i : check_points)
		if (i >= 0 and i < N)
			Remove(i);
}

Compilation message (stderr)

Anna.cpp: In function 'void Anna(int, std::vector<char>)':
Anna.cpp:8:12: warning: unused variable 'MAX_BIT' [-Wunused-variable]
    8 |  const int MAX_BIT = log2(N - 1);
      |            ^~~~~~~

Bruno.cpp: In function 'void Bruno(int, int, std::vector<int>)':
Bruno.cpp:15:12: warning: unused variable 'MAX_BIT' [-Wunused-variable]
   15 |  const int MAX_BIT = log2(N - 1);
      |            ^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...