Submission #596824

#TimeUsernameProblemLanguageResultExecution timeMemory
5968248e7Bit Shift Registers (IOI21_registers)C++17
21 / 100
1 ms212 KiB
//Challenge: Accepted #include "registers.h" #include <iostream> #include <algorithm> #include <vector> #include <utility> using namespace std; void debug(){cout << endl;} template<class T, class ... U> void debug(T a, U ... b){cout << a << " ", debug(b...);} template<class T> void pary(T l, T r) { while (l != r) cout << *l << " ", l++; cout << endl; } #define ll long long #define maxn 400005 #define pii pair<int, int> #define ff first #define ss second #define io ios_base::sync_with_stdio(0);cin.tie(0); const int M = 100; const int B = 2000; void construct_instructions(int tasktype, int N, int K, int q) { vector<bool> st(B, 0); for (int i = 0;i < K;i++) st[i] = 1; append_store(99, st); if (tasktype == 0) { append_move(1, 0); append_right(1, 1, K); append_and(0, 0, 99); append_xor(2, 0, 1); { int tmp = K - 1; int i = 0; while (tmp) { if (tmp <= (1<<i)) { append_move(3, 2); append_right(3, 3, tmp); append_or(2, 2, 3); tmp = 0; } else { append_move(3, 2); append_right(3, 3, (1<<i)); append_or(2, 2, 3); tmp -= 1<<i; } i++; } } append_right(4, 2, 1); append_xor(5, 2, 4); //5: 1 on the different bit append_and(6, 1, 5); //check if 6 is 0 append_add(6, 6, 99); append_right(6, 6, K); { int tmp = K - 1; int i = 0; while (tmp) { if (tmp <= (1<<i)) { append_move(7, 6); append_left(7, 7, tmp); append_or(6, 6, 7); tmp = 0; } else { append_move(7, 6); append_left(7, 7, (1<<i)); append_or(6, 6, 7); tmp -= 1<<i; } i++; } } append_not(7, 6); append_and(8, 1, 7); append_and(9, 0, 6); append_add(0, 8, 9); } } /* 0 2 2 1000 0 1 1 0 */
#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...