#include "registers.h"
#include <bits/stdc++.h>
using namespace std;
int maxb = 2000;
int maxn = 100;
class Registers{
private:
vector<int> free;
int cont = 0;
int create(){ return ++cont; }
public:
int get(){
if( free.empty() ) return create();
int x = free.back(); free.pop_back();
return x;
}
void take_back( int id ){
free.push_back(id);
}
} reg;
void append_extract( int goal, int source, int l, int r ){
append_left( goal, source, maxb - r - 1 );
append_right( goal, goal, maxb - (r - l + 1) );
}
void append_subtract( int goal, int a, int b ){
append_not( goal, b );
append_add( goal, goal, a );
}
void append_spread( int goal, int k ){
int aux = reg.get();
append_right( aux, goal, k );
append_and( goal, aux, goal );
append_or( goal, aux, goal );
reg.take_back(aux);
}
void get_min( int n, int k ){
int a = reg.get();
int b = reg.get();
append_extract( a, 0, 0, k - 1 );
append_extract( b, 0, k, 2*k - 1 );
int sub = reg.get();
append_subtract( sub, a, b );
append_spread( sub, k );
append_and( 0, sub, a );
append_not( sub, sub );
append_and( sub, sub, b );
append_or( 0, 0, sub );
}
void sort( int n, int k ){}
void construct_instructions( int s, int n, int k, int q ){
if( s == 0 ) get_min( n, k );
else sort( n, k );
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |