답안 #980692

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
980692 2024-05-12T10:23:37 Z penguin133 Data Transfer (IOI19_transfer) C++17
0 / 100
9 ms 2516 KB
#include <bits/stdc++.h>
using namespace std;
#include "transfer.h"
//#define int long long
#define pi pair<int, int>
#define pii pair<int, pi>
#define fi first
#define se second
#ifdef _WIN32
#define getchar_unlocked _getchar_nolock
#endif
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());


std::vector<int> get_attachment(std::vector<int> source) {
	int n = (int)source.size();
	vector <int> ans;
	for(int i = 0; (1 << i) < n; i++){
		int x = 0;
		for(int j = 0; j < n; j++)if(j >> i & 1)x ^= source[j];
		ans.push_back(x);
	}
	int x = 0;
	for(int i = 0; i < n; i++)x ^= source[i];
	ans.push_back(x);
	return ans;
}

std::vector<int> retrieve(std::vector<int> data) {
	int n, num;
	if((int)data.size() >= 200)n = 255, num = 9;
	else n = 63, num = 7;
	int tmp = 0;
	for(int i = 0; i < n; i++)tmp ^= data[i];
	if(tmp == data[(int)data.size() - 1]){
		vector <int> ans;
		for(int i = 0; i < n; i++)ans.push_back(data[i]);
		return ans;
	}
	int flipped = 0;
	for(int i = 0; (1 << i) < n; i++){
		int x = 0;
		for(int j = 0; j < n; j++)if(j >> i & 1)x ^= data[j];
		if(x != data[(int)data.size() - num + i])flipped ^= (1 << i);
	}
	data[flipped] = !data[flipped];
	vector <int> ans;
	for(int i = 0; i < n; i++)ans.push_back(data[i]);
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 1060 KB WA in grader: wrong source retrieval
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 2516 KB WA in grader: wrong source retrieval
2 Halted 0 ms 0 KB -