답안 #676046

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
676046 2022-12-29T05:39:29 Z pirhosig Data Transfer (IOI19_transfer) C++17
100 / 100
87 ms 2500 KB
#include "transfer.h"
#include <bits/stdc++.h>
#define R(a) for (int i = 0; i < a; ++i)
using namespace std;

vector<int> get_attachment(vector<int> source) {
	int chk = 0;
	R((int)source.size()) if (source[i]) chk ^= (i + 1);
	if (source.size() == 63) {
		vector<int> ret(7);
		R(6) ret[i] = (chk >> i) & 1;
		R(6) ret[6] ^= ret[i];
		return ret;
	}
	vector<int> ret(9);
	R(8) ret[i] = (chk >> i) & 1;
	R(8) ret[8] ^= ret[i];
	return ret;
}

vector<int> retrieve(vector<int> data) {
	if (data.size() <= 70) {
		int fck = 0;
		R(6) fck ^= data[data.size() - 7 + i];
		if (fck != data[data.size() - 1]) return vector<int>(data.begin(), data.end()-7);
		int chk = 0;
		R((int)data.size() - 7) if (data[i]) chk ^= (i + 1);
		int ick = 0;
		R(6) ick += (data[data.size() - 7 + i] << i);
		int diff = chk ^ ick;
		if (diff) data[diff - 1] ^= 1;
		return vector<int>(data.begin(), data.end()-7);
	}
	int fck = 0;
	R(8) fck ^= data[data.size() - 9 + i];
	if (fck != data[data.size() - 1]) return vector<int>(data.begin(), data.end()-9);
	int chk = 0;
	R((int)data.size() - 9) if (data[i]) chk ^= (i + 1);
	int ick = 0;
	R(8) ick += (data[data.size() - 9 + i] << i);
	int diff = chk ^ ick;
	if (diff) data[diff - 1] ^= 1;
	return vector<int>(data.begin(), data.end()-9);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 732 KB Output is correct
2 Correct 2 ms 644 KB Output is correct
3 Correct 3 ms 644 KB Output is correct
4 Correct 3 ms 652 KB Output is correct
5 Correct 3 ms 728 KB Output is correct
6 Correct 3 ms 644 KB Output is correct
7 Correct 3 ms 644 KB Output is correct
8 Correct 3 ms 652 KB Output is correct
9 Correct 2 ms 740 KB Output is correct
10 Correct 2 ms 644 KB Output is correct
11 Correct 3 ms 644 KB Output is correct
12 Correct 3 ms 816 KB Output is correct
13 Correct 3 ms 644 KB Output is correct
14 Correct 2 ms 652 KB Output is correct
15 Correct 3 ms 652 KB Output is correct
16 Correct 2 ms 740 KB Output is correct
17 Correct 3 ms 652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 54 ms 2500 KB Output is correct
2 Correct 45 ms 2492 KB Output is correct
3 Correct 44 ms 2488 KB Output is correct
4 Correct 47 ms 2496 KB Output is correct
5 Correct 86 ms 2492 KB Output is correct
6 Correct 87 ms 2500 KB Output is correct
7 Correct 72 ms 2488 KB Output is correct
8 Correct 48 ms 2496 KB Output is correct
9 Correct 38 ms 2496 KB Output is correct
10 Correct 40 ms 2496 KB Output is correct
11 Correct 38 ms 2496 KB Output is correct
12 Correct 53 ms 2488 KB Output is correct
13 Correct 43 ms 2488 KB Output is correct
14 Correct 44 ms 2488 KB Output is correct
15 Correct 51 ms 2416 KB Output is correct
16 Correct 53 ms 2488 KB Output is correct
17 Correct 50 ms 2496 KB Output is correct
18 Correct 42 ms 2448 KB Output is correct
19 Correct 56 ms 2488 KB Output is correct