QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#497325#3098. Ancient Machinebykem0 38ms9804kbC++201.9kb2024-07-28 23:15:262024-07-28 23:15:26

Judging History

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

  • [2024-07-28 23:15:26]
  • 评测
  • 测评结果:0
  • 用时:38ms
  • 内存:9804kb
  • [2024-07-28 23:15:26]
  • 提交

Anna

#include "Anna.h"

using namespace std;
using ull = unsigned long long;

const int kS = 80, kB = 55;

ull af[kS];
auto init_af = []() {
  af[0] = 1, af[1] = 2;
  for (int i = 2; i < kS; ++i) {
    af[i] = af[i - 1] + af[i - 2];
  }
  return 0;
}();

void Anna(int n, vector<char> s) {
  s.push_back('X');
  vector<int> v;
  bool fx = 1;
  for (int i = 0; i < n; ++i) {
    char c = s[i];
    if (fx) {
      v.push_back(c == 'X');
      fx &= c != 'X';
    } else {
      v.push_back(c == 'Z' && s[i + 1] != 'Z');
    }
  }
  for (; v.size() % kS; v.push_back(0)) {
  }
  for (int i = 0; i < n; i += kS) {
    ull fs = 0;
    for (int j = 0; j < kS; ++j) {
      fs += v[i + j] * af[kS - 1 - j];
    }
    for (int j = 0; j < kB; ++j) {
      Send(fs >> j & 1);
    }
  }
}

Bruno

#include "Bruno.h"

using namespace std;
using ull = unsigned long long;

const int kS = 80, kB = 55;

ull bf[kS];
auto init_bf = []() {
  bf[0] = 1, bf[1] = 2;
  for (int i = 2; i < kS; ++i) {
    bf[i] = bf[i - 1] + bf[i - 2];
  }
  return 0;
}();

void remove(int n, int d) {
  if (d < n) {
    Remove(d);
  }
}
void Bruno(int n, int la, vector<int> a) {
  bool fx = 1;
  vector<int> s;
  for (int i = 0, ri = 0; i < la; i += kB, ri += kS) {
    ull fs = 0;
    for (int j = 0; j < kB; ++j) {
      fs |= (ull)a[i + j] << j;
    }
    for (int j = kS - 1; j >= 0; --j) {
      int rj = ri + kS - 1 - j;
      bool v = fs >= bf[j];
      fs -= v * bf[j];
      if (fx) {
        if (!v) {
          remove(n, rj);
        } else {
          s.push_back(rj);
          fx = 0;
        }
      } else {
        if (v) {
          for (; s.size() > 1; remove(n, s.back()), s.pop_back()) {
          }
          remove(n, rj);
        } else {
          s.push_back(rj);
        }
      }
    }
  }
  for (int i : s) {
    remove(n, 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: 4024kb

input:

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

output:

55
0101100110111110010011111110110000100100101001101000000

input:

55
0101100110111110010011111110110000100100101001101000000

output:

0 55 0

result:

wrong answer your query is valid but your solution is not optimal: read 0 but expected 3

Subtask #2:

score: 0
Wrong Answer

Test #12:

score: 0
Wrong Answer
time: 38ms
memory: 9804kb

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:

68750
100100001000010000100011111001010001111001100010010011111001000101101111111111101001101110000101010111110010000001010011011101001010101001001011111100100000110010110000110111111110101100001011001100101011111110101111010011000110110100110101011011000011001101101010101000011001101001000101001001...

input:

68750
100100001000010000100011111001010001111001100010010011111001000101101111111111101001101110000101010111110010000001010011011101001010101001001011111100100000110010110000110111111110101100001011001100101011111110101111010011000110110100110101011011000011001101101010101000011001101001000101001001...

output:

0 68750 9001

result:

wrong answer your query is valid but your solution is not optimal: read 9001 but expected 22133