# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
974175 | steveonalex | Broken Device (JOI17_broken_device) | C++17 | 29 ms | 3152 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 <bits/stdc++.h>
#include "Annalib.h"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define ALL(v) (v).begin(), (v).end()
#define MASK(i) (1LL << (i))
#define GETBIT(mask, i) (((mask) >> (i)) & 1)
// mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng(1);
ll rngesus(ll l, ll r){return ((ull) rng()) % (r - l + 1) + l;}
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll LASTBIT(ll mask){return mask & (-mask);}
ll pop_cnt(ll mask){return __builtin_popcountll(mask);}
ll ctz(ll mask){return __builtin_ctzll(mask);}
ll clz(ll mask){return __builtin_clzll(mask);}
ll logOf(ll mask){return 63 - clz(mask);}
template <class T1, class T2>
bool minimize(T1 &a, T2 b){
if (a > b){a = b; return true;}
return false;
}
template <class T1, class T2>
bool maximize(T1 &a, T2 b){
if (a < b){a = b; return true;}
return false;
}
template <class T>
void printArr(T& a, string separator = " ", string finish = "\n", ostream& out = cout){
for(auto i: a) out << i << separator;
out << finish;
}
template <class T>
void remove_dup(vector<T> &a){
sort(ALL(a));
a.resize(unique(ALL(a)) - a.begin());
}
void Anna(int n, ll X, int k, int p[]){
string s = "";
for(int i = 0; i< 60; ++i) s.push_back('0' + GETBIT(X, i));
string sigma;
for(int j = 0; j < 7; ++j){
int cnt = 0;
for(int i = 0; i< 60; ++i) if (!GETBIT(i, j) && s[i] == '1') cnt ^= 1;
sigma.push_back('0' + cnt);
}
s = s + s + sigma;
while(s.size() < n) s.push_back('0');
for(int i = 0; i<n; ++i) Set(i, (s[i] == '1'));
}
// int main(void){
// ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
// int p[] = {0};
// Anna(150, 69420, 1, p);
// return 0;
// }
#include <bits/stdc++.h>
#include "Brunolib.h"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define ALL(v) (v).begin(), (v).end()
#define MASK(i) (1LL << (i))
#define GETBIT(mask, i) (((mask) >> (i)) & 1)
// mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng(1);
ll rngesus(ll l, ll r){return ((ull) rng()) % (r - l + 1) + l;}
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll LASTBIT(ll mask){return mask & (-mask);}
ll pop_cnt(ll mask){return __builtin_popcountll(mask);}
ll ctz(ll mask){return __builtin_ctzll(mask);}
ll clz(ll mask){return __builtin_clzll(mask);}
ll logOf(ll mask){return 63 - clz(mask);}
template <class T1, class T2>
bool minimize(T1 &a, T2 b){
if (a > b){a = b; return true;}
return false;
}
template <class T1, class T2>
bool maximize(T1 &a, T2 b){
if (a < b){a = b; return true;}
return false;
}
template <class T>
void printArr(T& a, string separator = " ", string finish = "\n", ostream& out = cout){
for(auto i: a) out << i << separator;
out << finish;
}
template <class T>
void remove_dup(vector<T> &a){
sort(ALL(a));
a.resize(unique(ALL(a)) - a.begin());
}
ll Bruno(int n, int A[]){
vector<bool> sigma;
for(int j = 0; j < 7; ++j){
int cnt = 0;
for(int i = 0; i<60; ++i) if (!GETBIT(i, j) && A[i]) cnt ^= 1;
sigma.push_back(cnt);
}
ll X = 0;
for(int i = 0; i<60; ++i){
if (A[i] == A[i+60]) {
if (A[i]) X += MASK(i);
}
else{
bool check = true;
for(int j = 0; j< 7; ++j) if (sigma[j] != A[120 + j]) {
check = false;
}
int u = i;
if (!check) u += 60;
if (A[u]) X += MASK(i);
}
}
return X;
}
// int main(void){
// ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
// return 0;
// }
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |