제출 #308000

#제출 시각아이디문제언어결과실행 시간메모리
308000kimjg1119Data Transfer (IOI19_transfer)C++17
48 / 100
9 ms1276 KiB
#include "transfer.h"
#include <bits/stdc++.h>

using namespace std;

vector<int> get_attachment_sub1(vector<int> sc) {
	int a[10] = {};
	for (int i = 0; i < sc.size(); i++) {
		for (int j = 0; j < 6; j++)
			if(sc[i]) a[j] ^= (i + 1) & (1 << j);
	}
	vector<int> r;
	for (int i = 0; i < 6; i++)
		if (a[i]) r.push_back(1);
		else r.push_back(0);
	
	vector<int> at;
	for (int i = 0; i < 2; i++) {
		for (int j = 0; j < 6; j++)
			at.push_back(r[j]);
	}
	return at;
}

std::vector<int> get_attachment(std::vector<int> source) {
	if (source.size() == 63) return get_attachment_sub1(source);
}

vector<int> retrieve_sub1(vector<int> d) {
	vector<int> t, t1, t2;
	for (int i = 63; i < d.size(); i++) t.push_back(d[i]);
	for (int i = 0; i < 12; i++) d.pop_back();
	for (int i = 0; i < 6; i++) t1.push_back(t[i]);
	for (int i = 0; i < 6; i++) t2.push_back(t[i + 6]);

	bool flag = true;
	for (int i = 0; i < 6; i++)
		if (t1[i] != t2[i]) flag = false;
	if (flag) {
		int a[10] = {};
		for (int i = 0; i < d.size(); i++) {
			for (int j = 0; j < 6; j++)
				if (d[i]) a[j] ^= (i+1) & (1 << j);
		}
		int r = 0;
		for (int i = 0; i < 6; i++) a[i] ^= t1[i] * (1<<i);
		for (int i = 0; i < 6; i++)
			if (a[i]) r |= (1 << i);
		if (r > 0) d[r - 1] = 1 - d[r - 1];
		return d;
	}
	else return d;
}

std::vector<int> retrieve(std::vector<int> data) {
	if (data.size() < 255) return retrieve_sub1(data);
}

컴파일 시 표준 에러 (stderr) 메시지

transfer.cpp: In function 'std::vector<int> get_attachment_sub1(std::vector<int>)':
transfer.cpp:8:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |  for (int i = 0; i < sc.size(); i++) {
      |                  ~~^~~~~~~~~~~
transfer.cpp: In function 'std::vector<int> retrieve_sub1(std::vector<int>)':
transfer.cpp:31:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |  for (int i = 63; i < d.size(); i++) t.push_back(d[i]);
      |                   ~~^~~~~~~~~~
transfer.cpp:41:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |   for (int i = 0; i < d.size(); i++) {
      |                   ~~^~~~~~~~~~
transfer.cpp: In function 'std::vector<int> get_attachment(std::vector<int>)':
transfer.cpp:27:1: warning: control reaches end of non-void function [-Wreturn-type]
   27 | }
      | ^
transfer.cpp: In function 'std::vector<int> retrieve(std::vector<int>)':
transfer.cpp:57:1: warning: control reaches end of non-void function [-Wreturn-type]
   57 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...