답안 #819076

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
819076 2023-08-10T07:54:40 Z AlphaBruh Data Transfer (IOI19_transfer) C++14
100 / 100
81 ms 2500 KB
#include "transfer.h"
#include<bits/stdc++.h>
using namespace std;
std::vector<int> get_attachment(std::vector<int> source) {
	int x = 0,n=source.size();
	for(int i = 0; i < n;i++){
		if(source[i]==1){
			x = (i+1) xor x;
		}
	}
	std::vector<int>rt;
	if(n<=63){
		int e=0,m=32;
		for(int i = 0; i < 6; i++){
			rt.push_back(x/m);
			x%=m;
			m = m>>1;
		}
		for(int i : rt){
			e = e xor i;
		}
		rt.push_back(e);
	}
	else{
		int e=0,m=128;
		for(int i = 0; i < 8; i++){
			rt.push_back(x/m);
			x%=m;
			m = m>>1;
		}
		for(int i : rt){
			e = e xor i;
		}
		rt.push_back(e);
	}
	return rt;
}

std::vector<int> retrieve(std::vector<int> data) {
	int n = data.size();
	vector<int>odata;
	vector<int>dbgc;
	if(n<=75){
		for(int i =0; i < 63; i++){
			odata.push_back(data[i]);
		}
		for(int i = 63; i < n; i++){
			dbgc.push_back(data[i]);
		}
	}
	else{
		for(int i =0; i < 255; i++){
			odata.push_back(data[i]);
		}
		for(int i = 255; i < n; i++){
			dbgc.push_back(data[i]);
		}
	}
	int dginc = 0;
	for(int i : dbgc){
		dginc = dginc xor i;
	}
	if(dginc == 1) return odata;
	int dbcl = dbgc.size()-1;
	int x = 0;
	for(int i = 0; i <dbcl; i++){
		x = (x<<1)+(dbgc[i]);
	}
	int bx = 0;
	n = odata.size();
	for(int i = 0; i < n; i++){
		if(odata[i]==1){
			bx = bx xor (i+1);
		}
	}
	int bp = bx xor x;
	if(bp>0) odata[bp-1] = 1-odata[bp-1];
	return odata;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 644 KB Output is correct
2 Correct 3 ms 740 KB Output is correct
3 Correct 2 ms 732 KB Output is correct
4 Correct 3 ms 652 KB Output is correct
5 Correct 3 ms 644 KB Output is correct
6 Correct 3 ms 644 KB Output is correct
7 Correct 2 ms 644 KB Output is correct
8 Correct 2 ms 644 KB Output is correct
9 Correct 3 ms 732 KB Output is correct
10 Correct 3 ms 732 KB Output is correct
11 Correct 3 ms 736 KB Output is correct
12 Correct 3 ms 652 KB Output is correct
13 Correct 3 ms 656 KB Output is correct
14 Correct 3 ms 644 KB Output is correct
15 Correct 2 ms 644 KB Output is correct
16 Correct 3 ms 824 KB Output is correct
17 Correct 2 ms 736 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 66 ms 2488 KB Output is correct
2 Correct 62 ms 2496 KB Output is correct
3 Correct 62 ms 2484 KB Output is correct
4 Correct 63 ms 2496 KB Output is correct
5 Correct 62 ms 2488 KB Output is correct
6 Correct 81 ms 2488 KB Output is correct
7 Correct 76 ms 2488 KB Output is correct
8 Correct 63 ms 2448 KB Output is correct
9 Correct 64 ms 2448 KB Output is correct
10 Correct 61 ms 2488 KB Output is correct
11 Correct 66 ms 2496 KB Output is correct
12 Correct 63 ms 2500 KB Output is correct
13 Correct 63 ms 2488 KB Output is correct
14 Correct 62 ms 2492 KB Output is correct
15 Correct 62 ms 2444 KB Output is correct
16 Correct 62 ms 2484 KB Output is correct
17 Correct 62 ms 2496 KB Output is correct
18 Correct 62 ms 2452 KB Output is correct
19 Correct 65 ms 2444 KB Output is correct