# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1012468 | 2024-07-02T08:16:34 Z | Unforgettablepl | Ancient Machine (JOI21_ancient_machine) | C++17 | 34 ms | 9284 KB |
#include "Anna.h" #include <vector> #include <bits/stdc++.h> using namespace std; namespace { vector<int> fib(43); void genFib(){ fib[1] = 1; for(int i=2;i<43;i++)fib[i]=fib[i-1]+fib[i-2]; } void blockp(vector<int> block){ int ans = 0; for(int i=0;i<block.size();i++){ if(block[i])ans+=fib[block.size()-i+1]; } for(int bit=0;bit<28;bit++)Send(min(1,ans&(1<<bit))); } void process(vector<int> arr){ genFib(); for(int blocks=0;blocks<2500;blocks++){ vector<int> curr; for(int i=0;i<40;i++)curr.emplace_back(arr[blocks*40+i]); blockp(curr); } } } void Anna(int N, std::vector<char> S) { bool foundX = false; S.emplace_back('$'); vector<int> bits; int founder = -1; for(int i=0;i<N;i++){ if(S[i]=='X'){ if(foundX)bits.emplace_back(0); else { foundX = true; founder = i; bits.emplace_back(1); } } else if(S[i]=='Y'){ bits.emplace_back(0); } else if(S[i]=='Z'){ if(!foundX or S[i+1]=='Z' or i-1==founder)bits.emplace_back(0); else bits.emplace_back(1); } } while(bits.size()<100000)bits.emplace_back(0); process(bits); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 3752 KB | Output is correct |
2 | Correct | 15 ms | 3740 KB | Output is correct |
3 | Correct | 9 ms | 4004 KB | Output is correct |
4 | Correct | 9 ms | 4016 KB | Output is correct |
5 | Correct | 9 ms | 4016 KB | Output is correct |
6 | Correct | 9 ms | 3740 KB | Output is correct |
7 | Correct | 9 ms | 3996 KB | Output is correct |
8 | Correct | 9 ms | 3736 KB | Output is correct |
9 | Correct | 9 ms | 3736 KB | Output is correct |
10 | Correct | 9 ms | 4012 KB | Output is correct |
11 | Correct | 10 ms | 3784 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 34 ms | 9284 KB | Output is correct |
2 | Correct | 34 ms | 9136 KB | Output is correct |
3 | Incorrect | 30 ms | 9108 KB | Wrong Answer [6] |
4 | Halted | 0 ms | 0 KB | - |