QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#497315#3098. Ancient Machinebykem0 32ms9704kbC++201.6kb2024-07-28 22:42:422024-07-28 22:42:42

Judging History

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

  • [2024-07-28 22:42:42]
  • 评测
  • 测评结果:0
  • 用时:32ms
  • 内存:9704kb
  • [2024-07-28 22:42:42]
  • 提交

Anna

#include "Anna.h"

using namespace std;
using ull = unsigned long long;

const int kS = 90, kB = 63;

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) {
  vector<int> v;
  bool fx = 0;
  for (char c : s) {
    fx |= c == 'X';
    v.empty() || (v.back() &= c != 'Z');
    v.push_back(fx && c == '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 = 90, kB = 63;

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) {
  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 += 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 (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: 3772kb

input:

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

output:

63
110100100100011111111101011100100001110010111110010011000110100

input:

63
110100100100011111111101011100100001110010111110010011000110100

output:

0 63 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: 32ms
memory: 9704kb

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:

70056
000100111100011001110111011001110011111111001000010111011100110010001010100101001110111101101011110001000100011101010010011100101110001111111100010011100001010100111011011001111010110100000101011111011101000001001111000110101111110110101100101111110100010111000110101001011010111101101010000101...

input:

70056
000100111100011001110111011001110011111111001000010111011100110010001010100101001110111101101011110001000100011101010010011100101110001111111100010011100001010100111011011001111010110100000101011111011101000001001111000110101111110110101100101111110100010111000110101001011010111101101010000101...

output:

0 70056 7555

result:

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