Submission #1072183

#TimeUsernameProblemLanguageResultExecution timeMemory
1072183noyancanturkBit Shift Registers (IOI21_registers)C++17
0 / 100
1 ms600 KiB
#include "registers.h" #include<bits/stdc++.h> using namespace std; const int m=100,b=2000; int s,n,k,q; //variables #define ansreg 0 #define datareg 1 #define bitreg1 2 #define bitreg2 3 #define xorreg 4 #define temp1 5 #define temp2 6 #define small1 7 #define small2 8 #define mask1 9 #define mask2 10 //constants #define zeromask 97 #define onemask 98 #define completemask 99 void moveguy(int i,int j){ append_right(i,datareg,(j+1)*k); append_left(i,i,(j+1)*k); append_xor(i,datareg,i); append_right(i,i,j*k); } void writebit(int t,int i,int j){ append_right(t,datareg,i*k+j); append_and(t,t,onemask); } void writebit(int t,int from,int i,int j){ append_right(t,from,i*k+j); append_and(t,t,onemask); } void wb(int t,int from,int j){ append_right(t,from,j); append_and(t,t,onemask); } void chmin(int t){ append_move(mask1,completemask); append_move(mask2,completemask); append_move(small1,onemask); append_move(small2,onemask); moveguy(temp2,t); for(int i=k-1;0<=i;i--){ writebit(bitreg1,temp2,0,i); writebit(bitreg2,ansreg,0,i); append_xor(xorreg,bitreg1,bitreg2); append_and(bitreg1,bitreg1,xorreg); append_and(bitreg1,bitreg1,mask2); append_add(mask2,bitreg1,mask2); append_and(bitreg2,bitreg2,xorreg); append_and(bitreg2,bitreg2,mask1); append_add(mask1,bitreg2,mask1); append_and(ansreg,ansreg,mask1); append_and(temp2,temp2,mask2); } append_or(ansreg,ansreg,temp2); } void construct_instructions(int S, int N, int K, int Q) { s=S,n=N,k=K,q=Q; if(!s){ append_move(datareg,0); append_store(completemask,vector<bool>(b,1)); vector<bool>to(b,0); to[0]=1; append_store(onemask,to); moveguy(ansreg,0); for(int i=0;i<n;i++)chmin(i); }else assert(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...