답안 #1048573

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1048573 2024-08-08T08:27:57 Z AmirAli_H1 레지스터 (IOI21_registers) C++17
47 / 100
1 ms 600 KB
// In the name of Allah

#include <bits/stdc++.h>
#include "registers.h"
using namespace std;

typedef		long long				ll;
typedef		long double				ld;
typedef		pair<int, int>			pii;
typedef		pair<ll, ll>			pll;

#define		endl					'\n'
#define		sep						' '
#define		F						first
#define		S						second
#define		all(x)					(x).begin(),(x).end()
#define		len(x)					((ll) (x).size())
#define		pb						push_back
#define		Mp						make_pair

int n, k, q;
vector<bool> vc;

void solve(int n, int k) {
	if (n <= 1) return ;
	
	int j = (n / 2) * (2 * k);
	append_right(1, 0, j);
	vc.clear(); vc.resize(2000);
	for (int i = 0; i < j; i++) vc[i] = 1;
	append_store(2, vc); append_and(0, 0, 2);
	
	n = (n + 1) / 2;
	
	vc.clear(); vc.resize(2000);
	for (int i = 0; i < n * (2 * k); i++) {
		if (i % (2 * k) <= k) vc[i] = 1;
	}
	append_store(2, vc); append_xor(2, 0, 2);
	
	vc.clear(); vc.resize(2000);
	for (int i = 0; i < n * (2 * k); i++) {
		if (i % (2 * k) == 0) vc[i] = 1;
	}
	append_store(3, vc); append_add(2, 2, 3);
	
	append_add(3, 1, 2);
	
	vc.clear(); vc.resize(2000);
	for (int i = 0; i < n * (2 * k); i++) {
		if (i % (2 * k) == k) vc[i] = 1;
	}
	append_store(4, vc); append_and(3, 3, 4);
	
	append_right(3, 3, k);
	append_left(4, 3, 2 * k);
	
	append_not(3, 3);
	vc.clear(); vc.resize(2000); vc[0] = 1;
	append_store(5, vc); append_add(3, 3, 5);
	
	append_add(3, 3, 4);
	append_not(4, 3);
	
	append_and(5, 0, 3);
	append_and(6, 1, 4);
	append_or(0, 5, 6);
	
	solve(n, k);
}

void construct_instructions(int sx, int nx, int kx, int qx) {
	n = nx; k = kx; q = qx;
	vc.clear(); vc.resize(2000);
	for (int i = 0; i < n * k; i++) vc[i] = 1;
	append_store(1, vc); append_xor(0, 0, 1);
	
	vc.clear(); vc.resize(2000);
	for (int i = 0; i < n * k; i++) {
		if ((i / k) % 2 == 0) vc[i] = 1;
	}
	append_store(1, vc);
	
	vc.clear(); vc.resize(2000);
	for (int i = 0; i < n * k; i++) {
		if ((i / k) % 2 == 1) vc[i] = 1;
	}
	append_store(2, vc);
	
	append_and(1, 0, 1); append_and(2, 0, 2);
	int j = n * k;
	if (n % 2 == 1) j += k;
	append_left(2, 2, j - k);
	
	append_or(0, 1, 2);
	
	solve(n, k);
	
	vc.clear(); vc.resize(2000);
	for (int i = 0; i < n * k; i++) vc[i] = 1;
	append_store(1, vc); append_xor(0, 0, 1);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Wrong answer detected in grader
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 440 KB Output is correct
3 Correct 1 ms 600 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Incorrect sorting
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Incorrect sorting
2 Halted 0 ms 0 KB -