제출 #903403

#제출 시각아이디문제언어결과실행 시간메모리
903403abcvuitunggio레지스터 (IOI21_registers)C++17
71 / 100
1 ms604 KiB
#include "registers.h" #include <bits/stdc++.h> using namespace std; const int b=2000; int k; void minimize(){ append_not(3,1); append_add(3,2,3); append_right(3,3,k); append_not(4,3); append_and(3,3,2); append_and(4,4,1); append_add(2,3,4); } void bubble(int i){ append_move(2,i+5); append_move(1,i+6); minimize(); append_add(1,i+5,i+6); append_move(i+5,2); append_not(2,2); append_add(1,1,2); append_add(i+6,1,98); } void construct_instructions(int s, int n, int k, int q){ ::k=k; vector <bool> ve(b,0); for (int i=n*k;i<b;i++) ve[i]=1; append_store(97,ve); append_or(0,0,97); for (int i=0;i<b;i++) ve[i]=(i%(k*2)<k); append_store(96,ve); int x=1; while (x<n) x*=2; n=x; if (!s){ int d=k; while (x>1){ append_right(1,0,d); append_and(0,0,96); append_and(1,1,96); append_not(2,1); append_add(2,0,2); append_right(2,2,k); append_not(3,2); append_and(2,2,0); append_and(3,3,1); append_or(0,2,3); x/=2; d*=2; } return; } vector <bool> v(2000,0); v[0]=1; append_store(98,v); for (int i=0;i<n;i++){ append_move(i+5,0); append_left(i+5,i+5,b-k*(i+1)); append_right(i+5,i+5,b-k); } for (int i=n-1;i;i--) for (int j=0;j<i;j++) bubble(j); append_move(0,99); for (int i=0;i<n;i++){ append_left(i+5,i+5,k*i); append_add(0,0,i+5); } }
#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...