算法很简单, 就是记录各个feature的累积和数组, 数组稍作处理, 只要能够比较 [让能够相减得出答案的两个数组] 的”形状”.
比如
111 111 000 110 221<= 110 111 332 110 010 342 120 001 342 120 100 443<= 110 010 453 120
中间一列的221和443的”形状”一样, 也就是相减能得到答案, 所以稍作处理都减去最右边的数即可, 方便比较.
问题是者离散化以后也有100000的数据怎么记录, 好吧我开始用的二叉树后来发现想错了..
无耻的Google以后发现对数组Hash的方法.. 很汗颜 太洋气了.. 跑2xxMS
代码:
[cpp]#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int hashcode(int *a, int k) {
int p = 0;
for (int i = 0; i < k; i++)
p = ((p << 2) + (a[i] >> 4)) ^ (a[i] << 10);
p %= 99983;
if (p < 0)
p += 99983;
return p;
}
int main() {
int N, K;
scanf("%d%d", &N, &K);
int hash[100000];
memset(hash, 0xff, sizeof(hash));
int (*c)[30];
c = (int(*)[30]) malloc(sizeof(int) * 30 * 100001);
memset(c[0], 0x00, sizeof(c[0]));
hash[hashcode(c[0],K)]=0;
int result = 0;
for (int i = 1; i <= N; i++) {
int data;
scanf("%d", &data);
for (int j = 0; j < K; j++) {
c[i][j]=c[i-1][j];
c[i][j] += (data >> j) & 1;
}
for (int j = K – 1; j >= 0; j–)
c[i][j] -= c[i][0];
int hc = hashcode(c[i], K);
for (;; hc++) {
if (hash[hc] == -1)
break;
bool bingo = true;
for (int j = 0; j < K; j++)
if (c[i][j] != c[hash[hc]][j]) {
bingo = false;
break;
}
if (bingo)
break;
}
if (hash[hc] == -1)
hash[hc] = i;
else
result = (i – hash[hc]) > result ? (i – hash[hc]) : result;
}
printf("%d\n", result);
return 0;
}[/cpp]
References:
Kingmaker Casino PayPal https://cgl.ethz.ch
References:
Legiano Casino Download http://images.google.ps/url?sa=t&url=https://telegra.ph/leguano-spinwyn-black-41-06-07
References:
Legiano Casino Live Casino toolbarqueries.google.lv
References:
Legiano Casino Login blog.fc2.com
References:
Hit n spin casino promo code http://rezkyrizani.xtgem.com/
References:
Monro Casino Bonusbedingungen forumsad.ru
References:
Hitnspin casino gewinne scivideoblog.com
References:
Hitnspin casino gutscheincode http://referless.com/
References:
Hit n spin casino 25 euro code https://lj.rossia.org/
References:
Monro Casino Treueprogramm http://maps.google.com/url?q=https://de2wa.com/norinekirtley
References:
Hitnspin http://images.google.com.ph/
References:
Casino hitnspin https://www.jugendherberge.de/
References:
Hitnspin casino auszahlungsdauer https://m.bydyhos.cn/op/link/?url=http://www.pixiv.net/jump.php?https://de.trustpilot.com/review/der-wikinger-shop.de
References:
Hitspin casino https://www.kaskus.co.id/redirect?url=http://link.avito.ru/go?to=https://de.trustpilot.com/review/der-wikinger-shop.de
References:
Hit n spin casino deutsch https://mineland.net/
References:
Hitnspin willkommensbonus http://toolsyep.com/de/open-graph-vorschau/?u=https://www.haphong.edu.vn/profile/lauoezmccarthy70144/profile
References:
Hitnspin casino auszahlungsdauer http://lginis.yoo7.com
References:
Hitnspin casino freispiele https://kak2z.ru
References:
Hitnspin casino spielautomaten https://runningtracker.tuxfamily.org/
References:
Hitnspin casino betrug longurl.eti.pw
References:
Hitnspin bonus ohne einzahlung https://illustrators.ru
References:
Hit n spin http://omga.su/
References:
Hitnspin bonus code https://ore.spongepowered.org/linkout?remoteUrl=http://warblog.hys.cz/user/prisonchin4/
References:
Monro Casino No Deposit Bonus http://nou-rau.uem.br/
References:
Lollybet Aktionscode clients1.google.cf
References:
Lollybet Casino Bonus ohne Umsatzbedingungen http://it.rojadirecta.eu
References:
Lollybet Casino Verifizierung oluchi.yn.lt
References:
Lollybet Meinung https://board-en.drakensang.com
References:
Lollybet Live Casino https://fixbios.com/proxy.php?link=https://rentry.co/z3azvt6n
References:
Lollybet Casino Bonus ohne Umsatzbedingungen https://61.cholteth.com/
References:
Lollybet Casino Willkommensbonus http://images.google.com.ly
References:
Lollybet Casino Treueprogramm http://shourl.free.fr/notice.php?site=demo.sunflowermachinery.com/noelialatimer6
References:
Lollybet Casino Bonusbedingungen http://maps.google.gg/url?q=https://rtraveler.ru/away/?next=https://lollybet.com.de/
References:
Hitnspin casino auszahlungsdauer http://clients1.google.lt
References:
Hitnspin bonus ohne einzahlung http://cse.google.com.bz
References:
Hitnspin casino bonus code http://clients1.google.vu/url?q=https://nomadwiki.space/wiki/HitNSpin_Support_Hilfe_Kontakt
References:
Hitnspin casino einzahlung http://clients1.google.cz
References:
Hitnspin freispiele http://2.ownskin.com/
References:
Hitnspin casino auszahlung erfahrungen http://cse.google.cv/url?q=https://www.haphong.edu.vn/profile/abdihsulindahl16617/profile
References:
Hitnspin casino live cse.google.com.bz
References:
Hitnspin casino einzahlung http://best5.ru
References:
Hitnspin casino erfahrungen http://alt1.toolbarqueries.google.com.tr/url?q=https://dobryakschool.ru/user/brarobin5/
References:
Hitnspin casino aktionscode clients1.google.com.pk
References:
Hitnspin casino login http://clients1.google.bt/url?q=http://warblog.hys.cz/user/stewplane7/
References:
Hit n spin http://maps.google.kz/
References:
Hitnspin casino freispiele http://images.google.at/
References:
Online payid pokies git.wieerwill.dev
References:
Online pokies real money payid pracaeuropa.pl
References:
Payid withdrawal pokies https://kaymanuell.com
References:
Online pokies australia payid real money https://kds.ne.kr/bbs/board.php?bo_table=free&wr_id=96510