Submission #1060803

#TimeUsernameProblemLanguageResultExecution timeMemory
1060803jamjanekBit Shift Registers (IOI21_registers)C++17
22 / 100
1 ms348 KiB
#include "registers.h" #include<bits/stdc++.h> using namespace std; int iterator1; void policz_mniejsze(int k, int skip, int n){ vector<bool>jeden(2000, 0); for(int i=0;i<n;i+=skip) jeden[i*k] = 1; iterator1++;append_store(2, jeden); append_right(1, 0, k*skip); iterator1++;append_and(4, 98, 4); iterator1++;append_and(3, 98, 3); int i; for(i=k-1;i>=0;i--){ iterator1++;append_right(5, 0, i); iterator1++;append_right(6, 1, i); iterator1++;append_and(5, 5, 2);//i-ty bit a iterator1++;append_and(6, 6, 2);//i-ty bit b iterator1++;append_xor(7, 5, 6);//xor iterator1++;append_xor(8, 3, 2); // !4 iterator1++;append_and(8, 8, 7); iterator1++;append_and(8, 8, 5); iterator1++;append_add(4, 4, 8); // 1 - jesli b<a //3 = (!4) & 7 & 5 iterator1++;append_or(3, 3, 7);//czy_znaleziono_poprawione } // iterator1++;append_print(3); // iterator1++;append_print(4); //3 same 0 jeśli a<b, same 1, jeśli b<a iterator1++;append_move(3, 4); for(i=1;i<k;i++){ iterator1++;append_left(3,3,1); iterator1++;append_or(3, 3, 4); } iterator1++;append_and(4, 0, 3); iterator1++;append_xor(4, 4, 0); //a^(a&1111) iterator1++;append_and(5, 1, 3); //b&1111 iterator1++;append_or(0, 4, 5); } void construct_instructions(int s, int n, int k, int q) { vector<bool>zero(2000, 0); for(int i=n*k;i<2000;i++)zero[i] = 1; append_store(1, zero); append_or(0, 0, 1); int skip = 1; while(skip<n){ policz_mniejsze(k, skip, n); append_print(0); skip*=2; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...