APIO 2014 upsolved.
作死……
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); }
[我巨爽]Apr 17: 一日刷水留念