| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1322032 | nub | Data Transfer (IOI19_transfer) | C++20 | 7 ms | 3244 KiB |
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define ld long double
#define ci const int
#define cll const long long
#define cull const unsigned long long
#define cd const double
#define cld const long double
#define fi first
#define se second
#define psb push_back
#define ppb pop_back
#define psf push_front
#define ppf pop_front
#define ps push
#define pp pop
#define all(x) x.begin(), x.end()
#define popcount __builtin_popcountll
#define ctz __builtin_ctzll
#define clz __builtin_clzll
using namespace std;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
ll rand(ll l, ll r){
return uniform_int_distribution<ll>(l, r)(rng);
}
ci inf = 1e9;
ci neginf = -1e9;
cll inf_ll = 1e18;
cll neginf_ll = -1e18;
vector<int> playerAsmall(vector<int> v){
v.psb(0);
for (int i=0; i<63; i++){
v[63] ^= v[i];
}
int t = 0;
for (int i=0; i<64; i++){
if (v[i]) t ^= i;
}
for (int i=5; i>=0; i--){
v.psb((t>>i)&1);
}
return v;
}
vector<int> playerAbig(vector<int> v){
v.psb(0);
for (int i=0; i<255; i++){
v[63] ^= v[i];
}
int t = 0;
for (int i=0; i<256; i++){
if (v[i]) t ^= i;
}
for (int i=7; i>=0; i--){
v.psb((t>>i)&1);
}
return v;
}
vector<int> playerBsmall(vector<int> v){
int t = 0;
for (int i=0; i<64; i++){
t ^= v[i];
}
if (t == 0){
while (v.size() > 63){
v.ppb();
}
return v;
}
int pos = 0;
for (int i=64; i<=69; i++){
pos = pos*2 + v[i];
}
for (int i=0; i<64; i++){
if (v[i]) pos ^= i;
}
v[pos] ^= 1;
while (v.size() > 63){
v.ppb();
}
return v;
}
vector<int> playerBbig(vector<int> v){
int t = 0;
for (int i=0; i<256; i++){
t ^= v[i];
}
if (t == 0){
while (v.size() > 255){
v.ppb();
}
return v;
}
int pos = 0;
for (int i=256; i<=263; i++){
pos = pos*2 + v[i];
}
for (int i=0; i<256; i++){
if (v[i]) pos ^= i;
}
v[pos] ^= 1;
while (v.size() > 256){
v.ppb();
}
return v;
}
vector<int> get_attachment(vector<int> source){
if (source.size() == 63) return playerAsmall(source);
else return playerAbig(source);
}
vector<int> retrieve(vector<int> data){
if (data.size() == 63) return playerBsmall(data);
else return playerBbig(data);
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
