# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
926482 | Tuanlinh123 | Broken Device (JOI17_broken_device) | C++17 | 38 ms | 3192 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "Annalib.h"
#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ld long double
using namespace std;
void Anna(int n, long long x, int k, int p[])
{
pair<ll, bitset<150>> bs[60];
vector <ll> val={888, 3561928307572012, 360526174126927439, 364998058823035, 40208, 31, 783, 65, 72444455486084455, 55389839735, 28112, 122, 828543276859, 192161796431007, 33663460, 12, 1886, 17291061348, 115896509, 5672, 827768, 7, 3501, 425035105159319, 154106415, 24215589121, 200377, 52461053117, 3558164, 1, 29656002, 6709760, 7, 1476444367238303, 673771881, 185663142, 1351747, 225026, 442, 11909, 4370, 58028959, 495, 53514944, 75856675614, 100205, 9, 1670334446, 160590842847497088, 35, 750124542857317568, 25405648386920, 16384196534, 4155863, 28, 539667638601, 1591730731836546, 294454, 11756, 15109223186428496, 233, 1369, 438425981, 58901664394626, 18409295, 55005832768869617, 8660, 7413060718, 1907203480686, 13, 3096, 53707, 48312084672979313, 1947, 23028529, 24948262536753004, 54894538340672, 2759, 48276, 107399950, 1227774513, 3, 1, 324, 273663, 132180314277924642, 7206637596738981, 8924499422733, 3, 84778, 4565069431030, 16928092852614, 126006807038600, 810, 919795843066339, 201451578679998, 7463791110, 13078757, 11948745, 3926895, 11545832278192836, 1420433, 3, 104, 2030659, 8063827, 211, 1, 633539539738971825, 51, 20600049720956854, 776226332163, 2546736684, 98216485873, 15155008233, 281669373094, 7, 770754, 267960765164534038, 42, 408464518, 71021963459679, 2699937007363484, 114512, 103490077, 143, 28827445813174, 5890472998375, 167305874, 735427, 25823, 6837751, 8938214, 3975274293818, 1063400751542217, 3511299535823, 300846, 215808544953, 170231146440, 615729526, 1135254621449, 514941354187006727, 6140005601605743, 977918616, 24859, 4237, 2389681659, 517658586, 26, 138548};
for (ll i=n-1, ptr=k-1; i>=0; i--)
{
while (ptr>=0 && p[ptr]==i)
i--, ptr--;
if (i<0) break;
bitset <150> cr; cr.reset(); cr[i]=1;
for (ll j=59; j>=0; j--)
if (val[i]&1ll<<j)
{
if (bs[j].fi) val[i]^=bs[j].fi, cr^=bs[j].se;
else {bs[j]={val[i], cr}; break;}
}
}
bitset <150> cr; cr.reset();
for (ll i=59; i>=0; i--)
if (x&1ll<<i)
x^=bs[i].fi, cr^=bs[i].se;
for (ll i=0; i<n; i++) Set(i, cr[i]);
}
#include "Brunolib.h"
#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ld long double
using namespace std;
long long Bruno(int n, int A[])
{
vector <ll> val={888, 3561928307572012, 360526174126927439, 364998058823035, 40208, 31, 783, 65, 72444455486084455, 55389839735, 28112, 122, 828543276859, 192161796431007, 33663460, 12, 1886, 17291061348, 115896509, 5672, 827768, 7, 3501, 425035105159319, 154106415, 24215589121, 200377, 52461053117, 3558164, 1, 29656002, 6709760, 7, 1476444367238303, 673771881, 185663142, 1351747, 225026, 442, 11909, 4370, 58028959, 495, 53514944, 75856675614, 100205, 9, 1670334446, 160590842847497088, 35, 750124542857317568, 25405648386920, 16384196534, 4155863, 28, 539667638601, 1591730731836546, 294454, 11756, 15109223186428496, 233, 1369, 438425981, 58901664394626, 18409295, 55005832768869617, 8660, 7413060718, 1907203480686, 13, 3096, 53707, 48312084672979313, 1947, 23028529, 24948262536753004, 54894538340672, 2759, 48276, 107399950, 1227774513, 3, 1, 324, 273663, 132180314277924642, 7206637596738981, 8924499422733, 3, 84778, 4565069431030, 16928092852614, 126006807038600, 810, 919795843066339, 201451578679998, 7463791110, 13078757, 11948745, 3926895, 11545832278192836, 1420433, 3, 104, 2030659, 8063827, 211, 1, 633539539738971825, 51, 20600049720956854, 776226332163, 2546736684, 98216485873, 15155008233, 281669373094, 7, 770754, 267960765164534038, 42, 408464518, 71021963459679, 2699937007363484, 114512, 103490077, 143, 28827445813174, 5890472998375, 167305874, 735427, 25823, 6837751, 8938214, 3975274293818, 1063400751542217, 3511299535823, 300846, 215808544953, 170231146440, 615729526, 1135254621449, 514941354187006727, 6140005601605743, 977918616, 24859, 4237, 2389681659, 517658586, 26, 138548};
ll ans=0;
for (ll i=0; i<n; i++)
if (A[i]) ans^=val[i];
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |