Submission #1322032

#TimeUsernameProblemLanguageResultExecution timeMemory
1322032nubData Transfer (IOI19_transfer)C++20
0 / 100
7 ms3244 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)

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...