Submission #1307213

#TimeUsernameProblemLanguageResultExecution timeMemory
1307213NonozeData Transfer (IOI19_transfer)C++20
80 / 100
181 ms1732 KiB
#include "transfer.h"
/*
*	Author: Nonoze
*	Created: Friday 02/01/2026
*/
#include <bits/stdc++.h>
using namespace std;

#ifndef DEBUG
	#define dbg(...)
#endif

// #define cout cerr << "OUT: "
#define endl '\n'
#define endlfl '\n' << flush
#define quit(x) return (void)(cout << x << endl)

template<typename T> void read(T& x) { cin >> x; }
template<typename T1, typename T2> void read(pair<T1, T2>& p) { read(p.first), read(p.second); }
template<typename T> void read(vector<T>& v) { for (auto& x : v) read(x); }
template<typename T1, typename T2> void read(T1& x, T2& y) { read(x), read(y); }
template<typename T1, typename T2, typename T3> void read(T1& x, T2& y, T3& z) { read(x), read(y), read(z); }
template<typename T1, typename T2, typename T3, typename T4> void read(T1& x, T2& y, T3& z, T4& zz) { read(x), read(y), read(z), read(zz); }
template<typename T> void print(vector<T>& v) { for (auto& x : v) cout << x << ' '; cout << endl; }

#define sz(x) (int)(x.size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define make_unique(v) sort(all(v)), v.erase(unique(all(v)), (v).end())
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define fi first
#define se second
#define cmin(a, b) a = min(a, b)
#define cmax(a, b) a = max(a, b)
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define QYES quit("YES")
#define QNO quit("NO")

// #define int long long
#define double long double
const int inf = numeric_limits<int>::max() / 4;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MOD = 1e9+7, LOG=20;

vector<int> get_attachment(vector<int> source) {
	int sm=0; for (auto &x: source) sm^=x;
	source.push_back(sm);
	vector<int> ans(1, sm);
	for (int LOG=0; (1<<LOG) <= sz(source); LOG++) {
		int cur=0;
		for (int i=0; i<sz(source); i++) {
			if (i&(1<<LOG)) cur^=source[i];
		}
		ans.push_back(cur);
	}
	return ans;
}

vector<int> retrieve(vector<int> data) {
	int n=63;
	if (sz(data)>100) n=255;
	int sm=0; for (int i=0; i<n; i++) sm^=data[i];
	if (sm==data[n])  return vector<int>(data.begin(), data.begin()+n);
	n++;
	int empl=n, res=0;
	for (int LOG=0; (1<<LOG) <= n; LOG++) {
		int cur=0;
		for (int i=0; i<n; i++) {
			if (i&(1<<LOG)) cur^=data[i];
		}
		if (data[empl]!=cur) res^=(1<<LOG);
		empl++;
	}
	data[res]^=1;
	return vector<int>(data.begin(), data.begin()+n-1);
}

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)
      |     ^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...