Submission #1361932

#TimeUsernameProblemLanguageResultExecution timeMemory
1361932avahwData Transfer (IOI19_transfer)C++20
15 / 100
97 ms2104 KiB
#include "transfer.h"
#include <bits/stdc++.h>
using namespace std;

std::vector<int> get_attachment(std::vector<int> source) {
	vector<int> ans;
	int ones = 0;
	for(auto e : source){ones+= e;}
	for(auto e : source) ans.push_back(1 ^ e);
	ans.push_back(ones % 2);
	return ans;


}

std::vector<int> retrieve(std::vector<int> data) {
	int n = data.size() / 2;
	vector<int> a;
	vector<int> b;
	int p = data[data.size() - 1];
	for(int i = 0; i < n; i++){
		a.push_back(data[i]);
		b.push_back(data[i + n]);
	}
	int ones = 0;
	// for(auto e : a) cout << e << " ";
	// cout << "\n";
	// for(auto e : b) cout << e << " ";
	// cout << "\n";
	// cout << "p is " << p << "\n";
	for(auto e : a) ones += e;
	if((ones % 2) == p) return a;
	for(int i = 0; i < n; i++){
		if(a[i] == b[i]){
			a[i] = 1 ^ a[i];
		}
	}
	return a;
}

Compilation message (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)
      |     ^~~~~~~~~~~~~~
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...