Submission #1011666

#TimeUsernameProblemLanguageResultExecution timeMemory
101166612345678Broken Device (JOI17_broken_device)C++17
85 / 100
41 ms3000 KiB
#include "Annalib.h" #include <bits/stdc++.h> using namespace std; const int nx=150; mt19937 rng(4200); int f, c[nx]; vector<pair<int, int>> v; void init() { v.clear(); for (int i=0; i<nx; i++) v.push_back({rng(), i}); sort(v.begin(), v.end()); for (int i=0; i<nx; i++) c[i]=v[i].second; } void Anna( int N, long long X, int K, int P[] ){ init(); vector<int> b(nx); //for (int i=0; i<N;i ++) cout<<"perm "<<i<<' '<<c[i]<<'\n'; for (int i=0; i<K; i++) b[P[i]]=1; for (int i=0; i<75; i++) { if (b[c[2*i]]||b[c[2*i+1]]||X==0) Set(c[2*i], 0), Set(c[2*i+1], 0); else Set(c[2*i], ((X%3)+1)/2), Set(c[2*i+1], ((X%3)+1)%2), X/=3; } }
#include "Brunolib.h" #include <bits/stdc++.h> using namespace std; #define ll long long const int kx=60, nxx=150; mt19937 rng2(4200); int f2, c2[nxx]; vector<pair<int, int>> v2; void init2() { v2.clear(); for (int i=0; i<nxx; i++) v2.push_back({rng2(), i}); sort(v2.begin(), v2.end()); for (int i=0; i<nxx; i++) c2[i]=v2[i].second; } long long Bruno( int N, int A[] ){ init2(); vector<ll> p(kx); ll res=0, cnt=0; p[0]=1; for (int i=1; i<kx; i++) p[i]=p[i-1]*3; for (int i=0; i<75; i++) if (A[c2[2*i]]||A[c2[2*i+1]]) res+=p[cnt]*(A[c2[2*i]]*2+A[c2[2*i+1]]-1),cnt++; return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...