Submission #227681

# Submission time Handle Problem Language Result Execution time Memory
227681 2020-04-28T12:29:46 Z MKopchev Broken Device (JOI17_broken_device) C++14
100 / 100
84 ms 3568 KB
#include "Annalib.h"
#include<bits/stdc++.h>
using namespace std;

const int nmax=150,MX=60;

long long nums[nmax]={307422075906420056,31346333476977366,751538979187435120,154279397843784701,739300929372587129,125698079662086764,663114243174628743,1050882811848467797,959905617801813273,385444311530711411,512817536392136995,662574049727954295,721817720375285862,259872109506253906,303151545032480828,460632706631997770,151503837468306586,279601718683009418,116740018002263942,779381898698810472,527462414946696666,42521995335021886,651745690928403659,960342173847439610,449953176040374380,449289592351417448,511130917170489762,541700316481087107,875828381368315472,1072860041540760884,85051844382864560,1001055615071046652,183264904366198881,500471828927634522,63835817811192782,127954344057129018,120838053016377530,758454238486967404,847645413388789654,603036886786340761,298571284009683329,947847276848062166,525766783643089427,827343617554380919,299073670037542655,206859532607704678,603746640398845049,712422028292176765,626717069466205704,62733976766572515,1093023341247510213,1138592857878279399,753979679570537560,134889343266248562,1143981232946249022,910868232526097162,1140166364095265486,30716081070658243,625097675567742946,942505717471056906,410994143216132790,1035630405772317279,248596569379907537,849796041904908245,716682431833171632,739467939849650353,351040795743682201,832126703370898474,310229214718306509,1067105014681501328,1152089508501160316,294920862964873414,257882642513923972,650748885903970599,696722788112087140,44225714599181847,354380675083786504,22689016659869283,685782594107933249,482025007381686430,39965697415777585,1010627280544352788,277080388530849779,685825912296573172,1133448965788314106,403206304060473600,612489193326150393,960401149848092772,660254439597621979,1002629921330663340,1104134162716322574,428377541123903367,404010598941365175,811913507148930765,1026486796668438185,781948228192017253,417720338420997321,394354769471544647,252774326212878532,430299583817921207,100836629183089816,699919924122681091,263129018848148616,693513945272787153,258529894321391257,359790227440116546,354689719563495762,32699430422874488,158974616222830595,986733105668659993,451430498147087728,886439260400903659,831577326609963295,820485178233226598,1073301751126560629,175923829627817950,359087009581246499,886747055001366355,537445543694349529,6519905474125266,840474235874882331,218299792429532457,896941258023383420,793850002809969525,1044710469235155561,960856229949000373,956180450254319954,685046809499042156,467192113633432442,539820084351143198,1043602636746228948,73947066312757177,160508289093219826,835466808124001768,511063839022804958,75086937199374325,1034047236808176843,211667994108275170,474616295036432973,116399098693853368,718936718010168965,1083975336838445884,460478383216489237,895796574262670841,384798448514542971,12250254168084698,93171951658288179,744491278776701441,1063251681161378533,596836909488541205};
/*
long long would=0;

void Set(int pos,int val)
{
    return;
    if(val)would=would^nums[pos];
    cout<<pos<<" "<<val<<endl;
}
*/

pair<long long/*value*/,bitset<nmax>/*ids*/> basis[nmax];

bool use[nmax];

bitset<nmax> idle;

void add(long long mask,bitset<nmax> id)
{
    //cout<<"add "<<mask<<" : ";for(int i=0;i<nmax;i++)cout<<id[i];cout<<endl;

    for(int i=0;i<MX;i++)
    {
        if((mask&(1LL<<i))==0)continue;

        if(basis[i].second==idle)
        {
            //cout<<i<<" -> "<<mask<<" "<<id<<endl;
            basis[i]={mask,id};
            return;
        }

        mask=mask^basis[i].first;
        id=id^basis[i].second;
    }
}

void Anna(int N,long long X, int K, int P[])
{
    idle=idle^idle;

    for(int i=0;i<nmax;i++)use[i]=1;

    for(int i=0;i<K;i++)use[P[i]]=0;

    for(int i=0;i<MX;i++)basis[i]={0,idle};

    for(int i=0;i<N;i++)
        if(use[i])
        {
            bitset<nmax> cur=idle;
            cur[i]=1;

            add(nums[i],cur);

            cur[i]=0;
        }

    long long mask=X;

    bitset<nmax> type;
    type=type^type;

    for(int i=0;i<MX;i++)
    {
        if((mask&(1LL<<i))==0)continue;

        if(basis[i].second==-1)assert(0==1);

        mask=mask^basis[i].first;
        type=type^basis[i].second;
    }

    for(int i=0;i<N;i++)
        Set(i,type[i]);

    //cout<<"would= "<<would<<endl;
}

/*
int arr[nmax];
int main()
{
    Anna(150,1,0,arr);
}
*/
#include "Brunolib.h"
#include<bits/stdc++.h>
using namespace std;

const int nmax=150;

long long nums[nmax]={307422075906420056,31346333476977366,751538979187435120,154279397843784701,739300929372587129,125698079662086764,663114243174628743,1050882811848467797,959905617801813273,385444311530711411,512817536392136995,662574049727954295,721817720375285862,259872109506253906,303151545032480828,460632706631997770,151503837468306586,279601718683009418,116740018002263942,779381898698810472,527462414946696666,42521995335021886,651745690928403659,960342173847439610,449953176040374380,449289592351417448,511130917170489762,541700316481087107,875828381368315472,1072860041540760884,85051844382864560,1001055615071046652,183264904366198881,500471828927634522,63835817811192782,127954344057129018,120838053016377530,758454238486967404,847645413388789654,603036886786340761,298571284009683329,947847276848062166,525766783643089427,827343617554380919,299073670037542655,206859532607704678,603746640398845049,712422028292176765,626717069466205704,62733976766572515,1093023341247510213,1138592857878279399,753979679570537560,134889343266248562,1143981232946249022,910868232526097162,1140166364095265486,30716081070658243,625097675567742946,942505717471056906,410994143216132790,1035630405772317279,248596569379907537,849796041904908245,716682431833171632,739467939849650353,351040795743682201,832126703370898474,310229214718306509,1067105014681501328,1152089508501160316,294920862964873414,257882642513923972,650748885903970599,696722788112087140,44225714599181847,354380675083786504,22689016659869283,685782594107933249,482025007381686430,39965697415777585,1010627280544352788,277080388530849779,685825912296573172,1133448965788314106,403206304060473600,612489193326150393,960401149848092772,660254439597621979,1002629921330663340,1104134162716322574,428377541123903367,404010598941365175,811913507148930765,1026486796668438185,781948228192017253,417720338420997321,394354769471544647,252774326212878532,430299583817921207,100836629183089816,699919924122681091,263129018848148616,693513945272787153,258529894321391257,359790227440116546,354689719563495762,32699430422874488,158974616222830595,986733105668659993,451430498147087728,886439260400903659,831577326609963295,820485178233226598,1073301751126560629,175923829627817950,359087009581246499,886747055001366355,537445543694349529,6519905474125266,840474235874882331,218299792429532457,896941258023383420,793850002809969525,1044710469235155561,960856229949000373,956180450254319954,685046809499042156,467192113633432442,539820084351143198,1043602636746228948,73947066312757177,160508289093219826,835466808124001768,511063839022804958,75086937199374325,1034047236808176843,211667994108275170,474616295036432973,116399098693853368,718936718010168965,1083975336838445884,460478383216489237,895796574262670841,384798448514542971,12250254168084698,93171951658288179,744491278776701441,1063251681161378533,596836909488541205};

long long Bruno(int N, int A[])
{
    long long ret=0;
    for(int i=0;i<nmax;i++)
        if(A[i])ret=ret^nums[i];
    return ret;
}
/*
int main()
{

}
*/
# Verdict Execution time Memory Grader output
1 Correct 80 ms 3056 KB Output is correct - L* = 40
2 Correct 78 ms 3056 KB Output is correct - L* = 40
3 Correct 79 ms 3056 KB Output is correct - L* = 40
4 Correct 79 ms 2920 KB Output is correct - L* = 40
5 Correct 80 ms 3064 KB Output is correct - L* = 40
6 Correct 83 ms 3048 KB Output is correct - L* = 40
7 Correct 80 ms 3056 KB Output is correct - L* = 40
8 Correct 81 ms 3568 KB Output is correct - L* = 40
9 Correct 79 ms 3152 KB Output is correct - L* = 40
10 Correct 78 ms 3056 KB Output is correct - L* = 40
11 Correct 81 ms 3056 KB Output is correct - L* = 40
12 Correct 79 ms 3056 KB Output is correct - L* = 40
13 Correct 80 ms 3056 KB Output is correct - L* = 40
14 Correct 80 ms 3056 KB Output is correct - L* = 40
15 Correct 82 ms 3312 KB Output is correct - L* = 40
16 Correct 79 ms 3064 KB Output is correct - L* = 40
17 Correct 80 ms 3056 KB Output is correct - L* = 40
18 Correct 79 ms 3056 KB Output is correct - L* = 40
19 Correct 80 ms 3056 KB Output is correct - L* = 40
20 Correct 80 ms 3056 KB Output is correct - L* = 40
21 Correct 81 ms 3312 KB Output is correct - L* = 40
22 Correct 80 ms 3056 KB Output is correct - L* = 40
23 Correct 79 ms 3056 KB Output is correct - L* = 40
24 Correct 81 ms 3056 KB Output is correct - L* = 40
25 Correct 80 ms 3056 KB Output is correct - L* = 40
26 Correct 81 ms 3312 KB Output is correct - L* = 40
27 Correct 81 ms 3128 KB Output is correct - L* = 40
28 Correct 79 ms 3064 KB Output is correct - L* = 40
29 Correct 80 ms 3056 KB Output is correct - L* = 40
30 Correct 80 ms 3056 KB Output is correct - L* = 40
31 Correct 79 ms 3056 KB Output is correct - L* = 40
32 Correct 80 ms 3056 KB Output is correct - L* = 40
33 Correct 84 ms 3152 KB Output is correct - L* = 40
34 Correct 79 ms 3056 KB Output is correct - L* = 40
35 Correct 79 ms 3056 KB Output is correct - L* = 40
36 Correct 79 ms 3064 KB Output is correct - L* = 40
37 Correct 80 ms 3056 KB Output is correct - L* = 40
38 Correct 79 ms 2880 KB Output is correct - L* = 40
39 Correct 80 ms 3064 KB Output is correct - L* = 40
40 Correct 84 ms 3312 KB Output is correct - L* = 40