Submission #488173

# Submission time Handle Problem Language Result Execution time Memory
488173 2021-11-18T05:08:41 Z 8e7 Bit Shift Registers (IOI21_registers) C++17
10 / 100
1 ms 624 KB
//Challenge: Accepted
#include "registers.h"
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
using namespace std;
void debug(){cout << endl;}
template<class T, class ... U> void debug(T a, U ... b){cout << a << " ", debug(b...);}
template<class T> void pary(T l, T r) {
	while (l != r) cout << *l << " ", l++;
	cout << endl;
}
#define ll long long
#define maxn 400005
#define pii pair<int, int>
#define ff first
#define ss second
#define io ios_base::sync_with_stdio(0);cin.tie(0);
const int m = 100;
const int b = 2000;
int n, k;
vector<bool> kb(b, 0);
void clean(int id) {
	append_and(id, id, m - 2);
}
void push(int id) {
	for (int i = 2;i < k*2;i *= 2) {
		append_move(m - 1, id);
		append_right(m - 1, m - 1, i>>1); 
		append_or(id, id, m - 1);
	}
}
void chmin(int ind) {
	append_move(m - 3, 0);
	append_move(1, 0);
	append_right(1, 1, ind*k);
	append_xor(2, 0, 1);
	clean(2);	
	push(2);
	//append_print(2);

	append_not(3, 2);
	append_and(m - 3, 3, m - 3);
	append_right(3, 3, 1);

	append_and(4, 0, 2); append_and(5, 1, 2); //d, e
	append_xor(4, 4, 2); append_xor(5, 5, 2);
	append_and(6, 4, 3), append_and(7, 5, 3);	
	push(6), push(7);
	//append_print(6), append_print(7);
	append_and(6, 6, 0), append_and(7, 7, 1);	
	append_add(m - 3, 6, m - 3), append_add(0, m - 3, 7);
}
void construct_instructions(int s, int nn, int kk, int q) {
	n = nn, k = kk;	
	for (int i = 0;i < k;i++) kb[i] = 1;
	append_store(m - 2, kb);
	for (int i = 1;i < n;i++) chmin(i);
}
/*
0 2 2 1000
0 1
1 0

*/
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Wrong answer detected in grader
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 1 ms 624 KB Wrong answer detected in grader
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Wrong answer detected in grader
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 332 KB Incorrect sorting
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 332 KB Incorrect sorting
2 Halted 0 ms 0 KB -