# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1056427 | 2024-08-13T09:23:32 Z | juicy | Ancient Machine (JOI21_ancient_machine) | C++17 | 4 ms | 2004 KB |
#include "Anna.h" #include <bits/stdc++.h> using namespace std; namespace { } void Anna(int N, std::vector<char> S) { int B = 63, K = 44; vector<long long> fib(B); fib[0] = fib[1] = 1; for (int i = 2; i < B; ++i) { fib[i] = fib[i - 1] + fib[i - 2]; } auto encode = [&](vector<int> msg) { long long res = 0; for (int i = 0; i < B; ++i) { res += msg[i] * fib[i]; } return res; }; int p = 0; vector<int> msg; while (p < N && S[p] != 'X') { ++p; msg.push_back(0); } if (p < N) { msg.push_back(1); msg.push_back(0); ++p; } for (; p < N; ++p) { if (S[p] == 'Z' && (p + 1 == N || S[p + 1] != S[p])) { msg.push_back(1); } else { msg.push_back(0); } } while (msg.size() % B) { msg.push_back(0); } for (int i = 0; i < msg.size(); i += B) { auto x = encode(vector(msg.begin() + i, msg.begin() + B)); for (int j = 0; j < K; ++j) { Send(x >> j & 1); } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 796 KB | Wrong Answer [6] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 4 ms | 2004 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |