[我巨爽]Apr 17: 一日刷水留念
APIO 2014 upsolved.

作死……

Ruchiose posted @ Apr 23, 2014 02:58:14 PM in sigh with tags 作死 , 719 阅读
void preprocess_fibonacci()
{
	Hash.clear();
	Fib[0] = 0; Fib[1] = 1; cir = 2;
	Hash.insert(1); // (0,1)
	while (1)
		{
			Fib[cir] = (Fib[cir - 1] + Fib[cir - 2]) % P;
			i64 hashvalue = (((i64)Fib[cir - 1]) << 16) + Fib[cir];
			if (Hash.count(hashvalue)) break;
			Hash.insert(hashvalue);
			cir++;
		}
	cir--;
	//printf("%d\n", cir);
}
 
P的范围是20W所以只左移16位就冲突掉了……
 
我是傻逼……
以后不敢出题了囧……

登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter