# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
494376 | jasen_penchev | Brperm (RMI20_brperm) | C++14 | 0 ms | 0 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 "brperm.h"
#include <iostream>
#include <string>
#define endl '\n'
using namespace std;
const int LOG = 20;
const int MAXN = 500000;
string str = "";
int diff[MAXN + 5];
int mem[LOG + 5][(1ll << LOG) + 5];
void init(int n, const char s[])
{
for (int i = 0; i < n; ++ i)
{
str += s[i];
}
for (int k = 0; k < 20; ++ k)
{
for (int i = 0; i < (1ll << k); ++ i)
{
int idx = 0;
for (int j = 0; j < k; ++ j)
{
if ((i & (1ll << j))) idx += (1ll << (k - j - 1));
}