QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#497315 | #3098. Ancient Machine | bykem | 0 | 32ms | 9704kb | C++20 | 1.6kb | 2024-07-28 22:42:42 | 2024-07-28 22:42:42 |
Judging History
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