Submission #999083

#TimeUsernameProblemLanguageResultExecution timeMemory
999083AdamGSBroken Device (JOI17_broken_device)C++17
85 / 100
34 ms2572 KiB
#include "Annalib.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; #define rep(a, b) for(int a = 0; a < (b); ++a) #define st first #define nd second #define pb push_back #define all(a) a.begin(), a.end() void Anna(int n, ll x, int k, int P[]) { mt19937 rng(2137); vector<int>S(n); rep(i, n) S[i]=i; rep(i, n) swap(S[i], S[rng()%(i+1)]); rep(i, 60) if(rng()&1) x^=1ll<<(ll)i; vector<int>czy(n), T(n); rep(i, k) czy[P[i]]=1; ll akt=0; rep(i, 60) { ll a=0; if(x&(1ll<<(ll)i)) a=1; while(akt<n && (akt%2!=a || czy[S[akt]])) ++akt; if(akt==n) break; T[S[akt]]=1; ++akt; } rep(i, n) Set(i, T[i]); }
#include "Brunolib.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; #define rep(a, b) for(int a = 0; a < (b); ++a) #define st first #define nd second #define pb push_back #define all(a) a.begin(), a.end() ll Bruno(int n, int A[]) { mt19937 rng(2137); vector<int>S(n); rep(i, n) S[i]=i; rep(i, n) swap(S[i], S[rng()%(i+1)]); ll x=0, p=0; rep(i, n) if(A[S[i]]) { if(i%2==1) x|=1ll<<(ll)p; ++p; } rep(i, 60) if(rng()&1) x^=1ll<<(ll)i; return x; }
#Verdict Execution timeMemoryGrader output
Fetching results...