Submission #1308894

#TimeUsernameProblemLanguageResultExecution timeMemory
1308894ojuz_userData Transfer (IOI19_transfer)C++20
0 / 100
8 ms3252 KiB
#include "transfer.h"
#include <bits/stdc++.h>
using namespace std;

#define file "o"
#define ff(i, a, b) for(auto i=(a); i<=(b); ++i)
#define ffr(i, b, a) for(auto i=(b); i>=(a); --i)
#define nl "\n"
#define ss " "
#define pb emplace_back
#define fi first
#define se second
#define sz(s) (int)s.size()
#define all(s) (s).begin(), (s).end()
#define ms(a,x) memset(a, x, sizeof (a))
#define cn continue
#define re exit(0)

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
inline ll ran(ll l, ll r)
{
    return uniform_int_distribution<ll> (l, r)(rng);
}

inline void rf()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    if(fopen(file".inp","r"))
    {
        freopen(file".inp","r",stdin);
        freopen(file".out","w",stdout);
    }
}

const int mod=998244353;
const int maxn=2e5+15;
const ll inf=1e18;

template<typename T> inline void add(T &x, const T &y)
{
    x+=y;
    if(x>=mod) x-=mod;
    if(x<0) x+=mod;
}

template<typename T> inline bool maxi(T &a, T b)
{
    if(a>=b) return 0;
    a=b; return 1;
}

template<typename T> inline bool mini(T &a, T b)
{
    if(a<=b) return 0;
    a=b; return 1;
}

vi get_attachment(vi source)
{
    int ans=0, n=sz(source);
    ff(i, 0, n-1) if(source[i]==1) ans^=i;
    vi v=source;
    int k;
    if(n==63) k=6;
    else k=8;
    ff(i, 0, k) 
    {
        if(ans&1) v.pb(0);
        else v.pb(1);
        ans>>=1;
    }
    return v;
}

vi retrieve(vi data)
{
    int n=sz(data), k;
    if(n==70) k=6;
    else k=8;
    int tot=0, bit=0, pos=maxn;
    ff(i, 0, n-k-1) if(data[i]==1) tot^=i;
    ff(i, n-k, n-k-1) if(data[i]==1) bit|=(1<<(i-n+k));
    if(tot!=bit) pos=tot^bit;
    vi ans;
    ff(i, 0, n-k-1) 
    {
        if(i!=pos) ans.pb(data[i]);
        else ans.pb(1-data[i]);
    }
    return ans;
}

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