Submission #511129

#TimeUsernameProblemLanguageResultExecution timeMemory
511129cig32Bit Shift Registers (IOI21_registers)C++17
58 / 100
1 ms460 KiB
#include "registers.h" #include <bits/stdc++.h> using namespace std; void construct_instructions(int s, int n, int k, int q) { const int b = 2000; //Subtask group 1: 21 points if(s == 0 && n == 2 && k <= 2) { if(k == 1) { append_right(1, 0, 1); vector<bool> oh(b); oh[0] = 1; append_store(2, oh); append_and(0, 0, 2); append_and(0, 0, 1); return; } else { append_right(1, 0, 2); vector<bool> oh(b); oh[0] = oh[1] = 1; append_store(2, oh); append_and(0, 0, 2); for(int i=0; i<3; i++) { append_move(2, 1); for(int j=0; j<k; j++) { int tar = (i == 2 && j == k-1 ? 0 : 2); append_add(tar, 0, 2); append_right(tar, tar, 1); } if(i < 2) append_move(0, 2); } return; } } //Subtask group 2: 12 points if(s == 0 && q == 4000) { vector<bool> init2(b); for(int i=0; i<b; i++) init2[i] = 1; vector<bool> init(b); for(int i=0; i<k; i++) init[i] = 1; append_store(4, init2); append_store(5, init); append_move(1, 0); append_and(1, 1, 5); append_right(0, 0, k); for(int i=1; i<n; i++) { append_move(2, 0); append_and(2, 2, 5); append_right(0, 0, k); append_not(3, 2); append_add(3, 3, 1); append_right(3, 3, 1999); append_add(3, 3, 4); append_and(2, 2, 3); append_not(3, 3); append_and(1, 1, 3); append_add(1, 1, 2); } append_move(0, 1); return; } vector<bool> w(b); for(int i=0; i<b; i++) w[i] = 0; for(int i=0; i<n; i++) w[(i+1)*k - 1] = 1; append_store(2, w); vector<bool> v(b); v[0] = 1; for(int i=1; i<n*k; i++) v[i] = 0; for(int i=n*k; i<b; i++) v[i] = 1; append_store(4, v); //r[4] = - (2^nk - 1) forever vector<bool> c(b); c[0] = 1; append_store(6, c); //r[6] = 1 forever for(int i=k-1; i>=0; i--) { append_and(1, 0, 2); if(k-1 > i) append_left(1, 1, k-1 - i); append_right(3, 1, k-1); append_not(3, 3); append_add(5, 1, 3); append_add(5, 5, 6); append_or(1, 1, 5); append_add(7, 1, 4); append_right(7, 7, 1999); append_xor(7, 7, 6); append_left(8, 7, i); append_add(9, 9, 8); if(i > 0) { append_add(1, 1, 7); append_right(2, 2, 1); append_or(0, 0, 1); } } append_move(0, 9); }
#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...