Skip to content

Instantly share code, notes, and snippets.

@psucodervn
psucodervn / gist:0b37aae859ced65793ecbbeefd2fa4d7
Created August 20, 2018 12:56
Access kubenetes dashboard
# Create service account
kubectl create serviceaccount cluster-admin-dashboard-sa
# Bind ClusterAdmin role to the service account
kubectl create clusterrolebinding cluster-admin-dashboard-sa \
--clusterrole=cluster-admin \
--serviceaccount=default:cluster-admin-dashboard-sa
# Parse the token
TOKEN=$(kubectl describe secret $(kubectl -n kube-system get secret | awk '/^cluster-admin-dashboard-sa-token-/{print $1}') | awk '$1=="token:"{print $2}')
int n = in.readInt();
int q = in.readInt();
int[] a = IOUtils.readIntArray(in, n);
double log2 = Math.log(2);
int logN = (int) (Math.log(n) / log2);
int[][] m = new int[n][logN + 1];
for (int i = 0; i < n; ++i) m[i][0] = i;
for (int j = 1; 1 << j < n; ++j) {
for (int i = 0; i + (1 << j) - 1 < n; ++i) {