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 <vector>
#include <string>
#include <math.h>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <bitset>
#include <cstring>
#include <unordered_map>
using namespace std;
typedef long long ll;
ll inv(ll n, ll sz){
if(sz == 0)
return 0;
string a;
for(int i = sz - 1; i >= 0; i--){
if((n >> i) % 2 != 0)
a += "1";
else
a += "0";
}
reverse(a.begin(), a.end());
ll n2 = 0, j = 0;
for(int i = sz - 1; i >= 0; i--){
if(a[j] == '1')
n2 += (1 << i);
j++;
}
return n2;
}
vector<pair<ll, ll>> d[18];
string a;
ll mp[100007][20];
void init(int n, const char s[]) {
for(int sz = 0; sz <= 17; sz++){
for(int i = 0; i < (1 << sz); i++){
if(inv(i, sz) > i){
d[sz].push_back({i, inv(i, sz)});
}
}
for(int i = 0; i <= n; i++)
mp[i][sz] = -1;
}
for(int i = 0; i < n; i++)
a.push_back(s[i]);
return;
}
int query(int l, int k) {
for(int i = 0; i < (1 << k); i++)
if(a[l + i] != a[l + inv(i, k)])
return 0;
return 1;
}
/*
ykkubxafnylfriivjjqphltuagfkfcoigfcukuisdgufezomndodalbusgesraatkgnskdsiedfysodmsemmtjuoiezoaqljdodegogedjfpfwntljpgdhswtmqtwtpnbaawfumskuiwjodtsrlhblpunzqjkrzaakamjzyumkzfdjxwdkadgbwffjmldsfbhaltfnykbmvnxdkpfzsswpnmyyqpalsalaeqmqqivzqyhjgiiwfugmpxxsmkkgecuvrnlkujbyllhecpjsneluvsyckueeexhbtuhikfzuvwlfbeatpvvkwbuhvlmzuavlqauhnmjphsvkfuheoufonvpaexkcocsxuhucvofavrsoguyouabgocprmmtacdcuzddctoyvomxudzogdcyomtrsxttbydtyoctprydhunhaksxzayugpxaknqpbaczjkbgjbqybqcxqcklxzmxvmhnmjiphgfgzbjcmhgfxcptnfggtncdokdejtieklevpwyqysdwwyseqewvgsijsahpamatbbpytjmjbjrjckblzanlgklnkupofhykyfywplzzgxaagyilppybzbvaikutapuzykwmlqbeybpdxbkkpjkyzeaelkzhadthbymlxransdokuqxggxagkpzxqqixeirkaciiwhzczkiedwgaezargziiaimyntocxsrcvzzwrwmitpsgncjefhorfjmjbursjzwamvtdoatgrjjzcnzujsafhsvvuwjceuaxjvgjrfdjsczksotkdjzhqbvrnqqgfpxehuvastysoexlbtesugqkuhspsrfhwibzbdngsxondjhjbcuzwthikhahgvgthklxjwrhphsmnfexzbsczubhhtthxrpkiitbccqvrrefjbuwdcgutjbnbiomhdhdbhyhabmhmyrhjtpqyrxluxqksoqxlglocutuwlwsicxqwliqxtgixlscgomqaasnegaznezyvlk
665 1
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |