Submission #1048596

#TimeUsernameProblemLanguageResultExecution timeMemory
1048596AmirAli_H1Bit Shift Registers (IOI21_registers)C++17
47 / 100
1 ms348 KiB
// In the name of Allah #include <bits/stdc++.h> #include "registers.h" using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define endl '\n' #define sep ' ' #define F first #define S second #define all(x) (x).begin(),(x).end() #define len(x) ((ll) (x).size()) #define pb push_back #define Mp make_pair const int M = 100; int n, k, q; vector<bool> vc; void solve(int n, int k) { if (n <= 1) return ; int j = (n / 2) * (2 * k); append_right(1, 0, j); vc.clear(); vc.resize(2000); for (int i = 0; i < j; i++) vc[i] = 1; append_store(2, vc); append_and(0, 0, 2); n = (n + 1) / 2; append_xor(2, 0, M - 3); append_add(2, 2, M - 4); append_add(3, 1, 2); append_and(3, 3, M - 5); append_right(3, 3, k); append_left(4, 3, 2 * k); append_not(3, 3); append_store(5, vc); append_add(3, 3, M - 6); append_add(3, 3, 4); append_not(4, 3); append_and(5, 0, 3); append_and(6, 1, 4); append_or(0, 5, 6); solve(n, k); } void construct_instructions(int sx, int nx, int kx, int qx) { n = nx; k = kx; q = qx; vc.clear(); vc.resize(2000); for (int i = 0; i < n * k; i++) vc[i] = 1; append_store(1, vc); append_xor(0, 0, 1); vc.clear(); vc.resize(2000); for (int i = 0; i < n * k; i++) { if (i % (2 * k) < k) vc[i] = 1; } append_store(M - 1, vc); vc.clear(); vc.resize(2000); for (int i = 0; i < n * k; i++) { if (i % (2 * k) >= k) vc[i] = 1; } append_store(M - 2, vc); vc.clear(); vc.resize(2000); for (int i = 0; i < 2000; i++) { if (i % (2 * k) <= k) vc[i] = 1; } append_store(M - 3, vc); vc.clear(); vc.resize(2000); for (int i = 0; i < 2000; i++) { if (i % (2 * k) == 0) vc[i] = 1; } append_store(M - 4, vc); vc.clear(); vc.resize(2000); for (int i = 0; i < 2000; i++) { if (i % (2 * k) == k) vc[i] = 1; } append_store(M - 5, vc); vc.clear(); vc.resize(2000); vc[0] = 1; append_store(M - 6, vc); append_and(1, 0, M - 1); append_and(2, 0, M - 2); int j = n * k; if (n % 2 == 1) j += k; append_left(2, 2, j - k); append_or(0, 1, 2); solve(n, k); vc.clear(); vc.resize(2000); for (int i = 0; i < n * k; i++) vc[i] = 1; append_store(1, vc); append_xor(0, 0, 1); }
#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...