# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
827633 | 2023-08-16T15:30:59 Z | Amylopectin | Bit Shift Registers (IOI21_registers) | C++17 | 1 ms | 212 KB |
#include "registers.h" #include <stdio.h> #include <iostream> #include <vector> using namespace std; const int mxn = 2010; int ru = 1; vector<bool> fa[100]; void construct_instructions(int s, int n, int k, int q) { int i,j,cn,cm,fn,fm,cle,o,p,h,f0,f1; if(s == 0) { if(k == 1) { cn = 0; for(i=6; i>=0; i--) { if((1<<i) < n) { if(1<<(i+1) >= n) append_right(ru,cn,(n - (1<<i))); else { append_right(ru,cn,(1<<i)); } cm = ru; ru ++; append_and(cn,cn,cm); } } return ; } cn = 0; ru = 1; for(j=0; j<n; j++) { if(j%2 == 0) { fa[2].push_back(0); fa[3].push_back(1); for(o=0; o<k; o++) { fa[0].push_back(0); fa[1].push_back(1); if(o > 0) { fa[2].push_back(0); fa[3].push_back(0); } } } else { fa[2].push_back(1); fa[3].push_back(0); for(o=0; o<k; o++) { fa[0].push_back(1); fa[1].push_back(0); if(o > 0) { fa[2].push_back(0); fa[3].push_back(0); } } } } for(j=n*k; j<2000; j++) { fa[0].push_back(0); fa[1].push_back(0); } fa[1][n*k] = 1; append_store(ru,fa[0]); append_store(ru+1,fa[1]); f0 = ru; f1 = ru+1; ru += 2; for(i=6; i>=0; i--) { if((1<<i) < n) { ru = 3; if(1<<(i+1) >= n) append_right(ru,cn,k*(n - (1<<i))); else { append_right(ru,cn,k*(1<<i)); } cm = ru; ru ++; append_print(cm); cle = (1<<i); // fa[0].clear(); // fa[1].clear(); // for(j=0; j<cle; j++) // { // if(j%2 == 0) // { // fa[2].push_back(0); // fa[3].push_back(1); // for(o=0; o<k; o++) // { // fa[0].push_back(0); // fa[1].push_back(1); // if(o > 0) // { // fa[2].push_back(0); // fa[3].push_back(0); // } // } // } // else // { // fa[2].push_back(1); // fa[3].push_back(0); // for(o=0; o<k; o++) // { // fa[0].push_back(1); // fa[1].push_back(0); // if(o > 0) // { // fa[2].push_back(0); // fa[3].push_back(0); // } // } // } // } // for(j=cle*k; j<2000; j++) // { // fa[0].push_back(0); // fa[1].push_back(0); // } // fa[1][cle*k] = 1; // append_store(ru,fa[0]); // append_store(ru+1,fa[1]); // append_not(ru+2,cm); append_and(ru+3,cn,f0); append_and(ru+4,cm,f0); append_and(ru+5,cn,f1); append_and(ru+6,cm,f1); append_not(ru+7,ru+4); append_not(ru+8,ru+6); append_add(ru+9,ru+3,ru+7); append_add(ru+10,ru+5,ru+8); append_and(ru+11,ru+9,f1); append_and(ru+12,ru+10,f0); append_or(ru+13,ru+11,ru+12); append_right(ru+14,ru+13,k); for(j=2; j<15; j++) { append_print(ru+j); } fn = ru+14; // for(j=0; j<4; j++) // { // if((1<<(j+1)) < k) // { // append_left(fn+1,fn,(1<<j)); // append_or(fn,fn,fn+1); // } // else // { // append_left(fn+1,fn,k-(1<<j)); // append_or(fn,fn,fn+1); // break; // } // } append_and(fn+2,fn,cn); append_not(fn+3,fn); append_and(fn+4,fn+3,cm); append_or(0,fn+2,fn+4); for(j=0; j<5; j++) { append_print(fn+j); } cn = 0; append_print(0); } } return ; } append_move(1, 0); append_right(1, 1, 1); append_and(0, 0, 1); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Incorrect sorting |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Incorrect sorting |
2 | Halted | 0 ms | 0 KB | - |