QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#497314 | #3098. Ancient Machine | bykem | 0 | 0ms | 0kb | C++20 | 1.6kb | 2024-07-28 22:41:20 | 2024-07-28 22:41:21 |
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.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
Programme Anna Runtime Error
Test #1:
score: 0
Programme Anna Runtime Error
input:
18 Y X Y Z X Z X X Z Z Y Y Z Y Y Z X X
output:
input:
output:
result:
Subtask #2:
score: 0
Programme Anna Runtime Error
Test #12:
score: 0
Programme Anna Runtime Error
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...