QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#327586#3098. Ancient Machine5ab0 52ms9908kbC++202.1kb2024-02-15 11:01:202024-02-15 11:01:21

Judging History

你现在查看的是最新测评结果

  • [2024-02-15 11:01:21]
  • 评测
  • 测评结果:0
  • 用时:52ms
  • 内存:9908kb
  • [2024-02-15 11:01:20]
  • 提交

Anna

#include "Anna.h"
#include <vector>
using namespace std;

namespace
{
#define all(x) (x).begin(), (x).end()
#define ssz(x) (int((x).size()))

auto chmax = [](auto& x, auto y) { if (x < y) x = y; };
auto chmin = [](auto& x, auto y) { if (y < x) x = y; };

using ull = unsigned long long;
using ll = long long;

const int B = 63, lgC = 44;
ull f[B + 1];
}

void Anna(int n, vector<char> S)
{
	int i = 0;
	while (i < n && S[i] != 'X')
		i++;
	if (i == n)
		return;
	
	vector<bool> s(n + 1);
	s[i] = 1;
	
	for (int k = i; k < n; k++)
	{
		while (k + 1 < n && S[k + 1] == 'Z')
			k++;
		s[k + 1] = (S[k] == 'Z');
	}
	f[0] = 1, f[1] = 2;
	for (int i = 2; i <= B; i++)
		f[i] = f[i - 1] + f[i - 2];
	
	for (int i = 0; i < ssz(s); )
	{
		ull cid = 0;
		for (int j = 0; j < B; j++, i++)
		{
			int b = (i < ssz(s) ? s[i] : 0);
			if (b)
				cid += f[B - j - 1];
		}
		for (int j = 0; j < lgC; j++)
		{
			Send(cid % 2);
			cid >>= 1;
		}
	}
}

Bruno

#include "Bruno.h"
#include <vector>
using namespace std;

namespace
{
#define all(x) (x).begin(), (x).end()
#define ssz(x) (int((x).size()))

auto chmax = [](auto& x, auto y) { if (x < y) x = y; };
auto chmin = [](auto& x, auto y) { if (y < x) x = y; };

using ull = unsigned long long;
using ll = long long;

const int B = 63, lgC = 44;
ull f[B + 1];
}  // namespace

void Bruno(int n, int l, vector<int> a)
{
	if (a.empty())
	{
		for (int i = 0; i < n; i++)
			Remove(i);
		return;
	}
	
	f[0] = 1, f[1] = 2;
	for (int i = 2; i <= B; i++)
		f[i] = f[i - 1] + f[i - 2];
	
	vector<bool> s;
	
	for (int i = 0, k = 0; i < l; )
	{
		ull sv = 0, cb = 1;
		for (int j = 0; j < lgC; j++, i++)
			sv += a[i] * cb, cb <<= 1;
		for (int j = 0; j < B; j++, k++)
		{
			s.push_back(sv >= f[B - j - 1]);
			if (sv >= f[B - j - 1])
				sv -= f[B - j - 1];
		}
	}
	int i = 0, k = i;
	while (i < n && s[i] == 0)
		Remove(i++);
	for (int j = i + 1; j < n; j++)
		if (s[j + 1] == 1)
		{
			for (int t = j - 1; t > k; t--)
				Remove(t);
			Remove(j);
			k = j;
		}
	k++;
	while (k < n)
		Remove(k++);
	Remove(i);
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3780kb

input:

18
Y X Y Z X Z X X Z Z Y Y Z Y Y Z X X

output:

44
11001010110010000011111110001011010000000001

input:

44
11001010110010000011111110001011010000000001

output:

4

result:

wrong answer Wrong Answer [4]

Subtask #2:

score: 0
Wrong Answer

Test #12:

score: 100
Accepted
time: 52ms
memory: 9908kb

input:

100000
X Z X Z Z X Y Z Y X Y X Z Z Z Y X Z Y X Y Y X Y Y Y Z Y Z Z Y X X Y X X Y Y X X X Z Y Y Y Z Z Z Z Y X Y Y Z Z Z X Y Z X X X X Y X Y X X Z X Z Z Z X Y X X X Z X Z X X X Y Y Y Y Z X X Y Z Y Y X Z X Z Z Z Z Z Y Z Y X Y Y Y Y X Z Z Y Z Z Y Z Z Z X Z Z X X Z Z Z Z X X Z Y Y Z Y Y Z Z Y Y Z Y Z Y Z...

output:

69872
101100101010101100100101100010011101011001111111010011011100001110000000101011111001000000000011001000010010111100011001101010111000101001001000000110110001110010101111001000101010011111000100111000101001010001000010100010100101010011111000101111001001010010010110111110000000001100010111110111...

input:

69872
101100101010101100100101100010011101011001111111010011011100001110000000101011111001000000000011001000010010111100011001101010111000101001001000000110110001110010101111001000101010011111000100111000101001010001000010100010100101010011111000101111001001010010010110111110000000001100010111110111...

output:

0 69872 22133

result:

points 1.0 n = 100000, D = 69872, L = 22133

Test #13:

score: 0
Wrong Answer
time: 30ms
memory: 8972kb

input:

100000
Z X X Y Z Z Z Y Z X Y Y Z X X Z Z Z Y Z X Y X Y X Z Y X Z X Y X Y Y Z X X Z X Z Y Z Y Z Z Z Y X Z X Z Y Y Y Z Y Z Y Z X Y X Z Z X Y X Y Z X Y Z Y X Y X X Z Z X Z X X Z X X X X Y X X Z Z X Y Y Y Y X Y X X Z Y Z Y Y Z X X Z Z Y Y X Z Y Y X Y Z Y Z Y Y Z Z X Z Y Z Z Z X Y Z Z X X X X Z Y X Y Y Z...

output:

69872
101101010000010010101100101011011000111001101101110111001100000101001001100101000101011011011110110011100010111011001101000001010001101000001111010111100110001001101000000101001101100010000001011000111110111110101001111000001110111111010111011000100111000011101011001011101101100010101101011110...

input:

69872
101101010000010010101100101011011000111001101101110111001100000101001001100101000101011011011110110011100010111011001101000001010001101000001111010111100110001001101000000101001101100010000001011000111110111110101001111000001110111111010111011000100111000011101011001011101101100010101101011110...

output:

4

result:

wrong answer Wrong Answer [4]