QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#497319#3098. Ancient Machinebykem0 40ms9856kbC++201.6kb2024-07-28 22:51:392024-07-28 22:51:39

Judging History

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

  • [2024-07-28 22:51:39]
  • 评测
  • 测评结果:0
  • 用时:40ms
  • 内存:9856kb
  • [2024-07-28 22:51:39]
  • 提交

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 |= (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 (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: 3892kb

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 1

result:

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

Subtask #2:

score: 0
Wrong Answer

Test #12:

score: 98
Acceptable Answer
time: 40ms
memory: 9856kb

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 22133

result:

points 0.98947368420 n = 100000, D = 70056, L = 22133

Test #13:

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

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:

70056
101010110111000000001101010111110010001011011111001011001010000100001001100001110111111100010100011100100111100000000001001100101000101010111111111011100000100110000110011100101111111100110101011000001001110000100000101000011111011100111101111111001101001011011000001100110011110011111001111111...

input:

70056
101010110111000000001101010111110010001011011111001011001010000100001001100001110111111100010100011100100111100000000001001100101000101010111111111011100000100110000110011100101111111100110101011000001001110000100000101000011111011100111101111111001101001011011000001100110011110011111001111111...

output:

0 70056 11185

result:

wrong answer your query is valid but your solution is not optimal: read 11185 but expected 22275