time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
Furlo and Rublo play a game. The table has n piles of coins lying on it, the i-th pile has ai coins. Furlo and Rublo move in turns, Furlo moves first. In one move you are allowed to:
- choose some pile, let's denote the current number of coins in it as x;
- choose some integer y (0 ≤ y < x; x1 / 4 ≤ y ≤ x1 / 2) and decrease the number of coins in this pile to y. In other words, after the described move the pile will have y coins left.
The player who can't make a move, loses.
Your task is to find out, who wins in the given game if both Furlo and Rublo play optimally well.
Input
The first line contains integer n (1 ≤ n ≤ 77777) — the number of piles. The next line contains n integers a1, a2, ..., an(1 ≤ ai ≤ 777777777777) — the sizes of piles. The numbers are separated by single spaces.
Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64dspecifier.
Output
If both players play optimally well and Furlo wins, print "Furlo", otherwise print "Rublo". Print the answers without the quotes.
Examples
input
Copy
1 1
output
Copy
Rublo
input
Copy
2 1 2
output
Copy
Rublo
input
Copy
10 1 2 3 4 5 6 7 8 9 10
output
Copy
Furlo
题意:有n堆石子,每次操作可以选一堆石子(当前石子数量为x)将其石子数量改为y(0 ≤ y < x 且 ≤ y ≤ ),不能操作则输
题解:sg打表,小数据直接按照sg表异或和,否则根据预处理的前缀和计算sg值,再异或和
//#include<bits/stdc++.h>
//#include<unordered_map>
//#include<unordered_set>
#include<iostream>
#include<sstream>
#include<iterator>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<set>
#include<vector>
#include<bitset>
#include<climits>
#include<queue>
#include<iomanip>
#include<cmath>
#include<stack>
#include<map>
#include<ctime>
#include<new>
using namespace std;
#define LL long long
#define ULL unsigned long long
#define MT(a, b) memset(a,b,sizeof(a))
#define lson l, mid, node<<1
#define rson mid + 1, r, node<<1|1
const int INF = 0x3f3f3f3f;
const int O = 1e6;
const int mod = 1e9+7;
const int maxn = 9e5 +5;
const double PI = acos(-1.0);
const double E = 2.718281828459;
const double eps = 1e-8;
const int siz = 4;
int sg[maxn], sum[maxn][siz], vis[siz];
// sum分别记录每一个siz的前缀和,方便计算大数据时,后记mex{}是否含有siz
void init(){
sg[0] = 0;
for(int i=1; i<maxn; i++) {
int r = sqrt(i), l = sqrt(r);
if(l * l * l * l < i) l ++;
MT(vis, 0);
for(int j=l; j<=r && j<i; j++) vis[sg[j]] = 1;
for(int j=0; j<siz; j++) if(!vis[j]) {
sg[i] = j; break;
}
}
MT(sum[0], 0);
for(int j=0; j<siz; j++) {
for(int i=1; i<maxn; i++) {
sum[i][j] = sum[i-1][j] + (sg[i] == j);
}
}
}
int main(){
init();
int n; scanf("%d", &n);
int ans = 0;
while(n --) {
LL x; cin >> x;
if(x < maxn) ans ^= sg[x];
else {
LL r = sqrt(x), l = sqrt(r);
if(l * l * l * l < x) l ++;
for(int j=0; j<siz; j++) {
if(!(sum[r][j] - sum[l-1][j])) {
ans ^= j; break;
}
}
}
}
printf(ans ? "Furlo" : "Rublo");
return 0;
}