제출 #1303612

#제출 시각아이디문제언어결과실행 시간메모리
1303612nicolo_010Data Transfer (IOI19_transfer)C++20
0 / 100
3095 ms568 KiB
#include "transfer.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

vector<int> get_attachment(vector<int> source) {
	vector<int> a;
	int x=0;
	for (int i=0; (int)source.size(); i++) {
		if (source[i]) x ^= (i+1);
	}
	int last=0;
	if (source.size()<64) {
		for (int i=0; i<6; i++) {
			a.push_back(x&1);
			last ^= (x&1);
			x /= 2;
		}
	}
	else {
		for (int i=0; i<8; i++) {
			a.push_back(x&1);
			last ^= (x&1);
			x /= 2;
		}
	}
	a.push_back(last);
	return a;
}

vector<int> retrieve(vector<int> data) {
	int last = data.back();
	data.pop_back();
	int x=0, nlast=0;
	if (data.size()<71) {
		for (int i=0; i<6; i++) {
			x *= 2;
			x += data.back();
			nlast ^= (data.back());
			data.pop_back();
		}
	}
	else {
		for (int i=0; i<8; i++) {
			x *= 2;
			x += data.back();
			nlast ^= (data.back());
		}
	}
	vector<int> a = data;
	if (nlast != last) {
		return data;
	}
	int ax=0;
	for (int i=0; i<data.size(); i++) {
		if (data[i]) x ^= (i+1);
	}
	int off = ax ^ x;
	if (off==0) return data;

	data[off-1] = 1-data[off-1];
	return data;
}

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

grader.cpp: In instantiation of 'void shuffle(std::vector<T>&) [with T = Scenario]':
grader.cpp:200:10:   required from here
grader.cpp:28:23: warning: 'void std::random_shuffle(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<Scenario*, vector<Scenario> >]' is deprecated: use 'std::shuffle' instead [-Wdeprecated-declarations]
   28 |         random_shuffle(v.begin(), v.end());
      |         ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/algorithm:61,
                 from grader.cpp:8:
/usr/include/c++/13/bits/stl_algo.h:4581:5: note: declared here
 4581 |     random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...