算法很简单, 就是记录各个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]
thanks!
References:
Yggdrasil Online Casino Paysafecard Casino Bonus
References:
Online casinos canada https://punbb.skynettechnologies.us
References:
Legiano Casino Video Review app.movistar.cl
References:
Legiano Casino Gutschein http://mobile–shop4.studio906.cafe24.com/member/login.html?returnUrl=https://mssq.me/kala03b21
References:
Legiano Casino Kontakt chaturbate.com
References:
Legiano Casino Auszahlungsdauer https://78.cholteth.com/index/d1?diff=0&utm_source=ogdd&utm_campaign=26607&utm_content=&utm_clickid=g00w000go8sgcg0k&aurl=http://mssq.me/kala03b21
References:
Legiano Casino Bonusbedingungen https://trac.cslab.ece.ntua.gr/
References:
Legiano Casino Live Casino https://forum.reizastudios.com
References:
Legiano Casino Mindestauszahlung http://maps.google.ru/url?q=https://link.mym.ge/keenanmonsen5
References:
Legiano Casino Freispiele http://maps.google.co.ck/url?q=https://allbio.link/melindakal
References:
Legiano Casino Bonus ohne Einzahlung preserve.lib.unb.ca
References:
Legiano Casino Live Casino http://www.google.iq/
References:
Legiano Casino Meinungen http://images.google.ms
References:
Legiano Casino Auszahlung http://shell.cnfol.com
References:
Legiano Casino Cashback https://m.sogou.com/web/searchList.jsp?&sosojump=1&pid=sogou-misc-77c493ec14246d74&keyword=board-en.darkorbit.com/proxy.php?link=https://de.trustpilot.com/review/der-wikinger-shop.de
References:
Legiano Casino Cashback https://www.rybalka44.ru/forum/go.php?url=aHR0cHM6Ly9kZS50cnVzdHBpbG90LmNvbS9yZXZpZXcvZWRlbGtyYW56LmRl
References:
Legiano Casino Jackpot images.google.co.il
References:
Legiano Casino Willkommensbonus https://ixion.astroempires.com/redirect.aspx?https://de.trustpilot.com/review/edelkranz.de
References:
Legiano Casino Cashback https://epsilon.astroempires.com/redirect.aspx?https://www.lioden.com/outgoing.php?url=https://de.trustpilot.com/review/der-wikinger-shop.de
References:
Legiano Casino Login Deutschland http://ads1.opensubtitles.org
References:
Legiano Casino Auszahlungslimit https://dev.thep.lu.se
References:
Legiano Casino Auszahlung http://cm-us.wargaming.net/
References:
KingMaker erste einzahlung bonus allbio.link
References:
KingMaker Casino Bonuscode 2026 s.nas.vn
References:
KingMaker Casino Einzahlung per SMS sosi.al
References:
KingMaker Casino Einzahlung per Giropay itapipo.ca
References:
Kingmaker Casino Deutschland semanticweb.cs.vu.nl
References:
KingMaker Casino Sofortüberweisung http://maps.google.com.uy
References:
Kingmaker Casino Login Probleme http://m.shop1.case79.cafe24.com
References:
Kingmaker Casino Mobile http://domfialki.com/
References:
KingMaker Casino Bonus bei Einzahlung maps.google.ch
References:
KingMaker account erstellen images.google.tg
References:
KingMaker Casino Einzahlung per Sofortüberweisung images.google.lu
References:
Legiano Casino Gutschein http://clients1.google.com.mx/url?q=https://telegra.ph/Offizielle-Seite-Deutschland-06-07
References:
Legiano Casino Anmelden http://clients1.google.com.cy/url?q=https://telegra.ph/Official-Casino-Site-06-07
References:
Legiano Casino Erfahrungen cse.google.co.tz
References:
Legiano Casino Login Deutschland https://downloader.la/view.php?newURL=aHR0cHM6Ly90ZWxlZ3JhLnBoL1RvcC1TbG90cy0tc2NobmVsbGUtQXVzemFobHVuZ2VuLTA2LTA3
References:
Legiano Casino seriös http://cse.google.ws/
References:
Kingmaker casino einzahlung sofort verfügbar http://images.google.by/url?sa=t&url=http://bybio.co/eldenlind4
References:
Legiano Casino Auszahlung image.google.co.je
References:
Legiano Casino Kundenservice http://www.google.ht
References:
Legiano Casino VIP https://cybra.lodz.pl
References:
Legiano Casino Codes cse.google.com.bh
References:
KingMaker einzahlung mastercard maps.google.td
References:
Legiano Casino Bonus palm.muk.uni-hannover.de
References:
Kingmaker casino einzahlung sofort verfügbar https://imslp.org
References:
Kingmaker casino echtgeld einzahlen https://m.fengniao.com/
References:
KingMaker Casino 5 Euro Einzahlung Bonus translate.itsc.cuhk.edu.hk
References:
Legiano Casino Auszahlungslimit https://preserve.lib.unb.ca/wayback/20141205151334mp_/www.qazaqpen-club.kz/en/user/violinsalary22/