#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int arr[N] , fib[21] , n , mx;
void input(){
cin >> n;
for(int i = 0 ; i < n ; i++){
cin >> arr[i];
mx = max(mx , arr[i]);
}
}
void pre(){
fib[0] = 1;
fib[1] = 2;
for(int i = 2 ; i < 21 ; i++)
fib[i] = fib[i - 1] + fib[i - 2];
}
int cal(int sum){
int cnt = 0;
for(int mask = 0 ; mask < (1 << 21) ; mask++){
int sm = 0;
for(int i = 0 ; i < 21 ; i++)
if(mask & (1 << i))
sm += fib[i];
cnt += (sm == sum);
}
return cnt;
}
void sub1(){
pre();
int sum = 0;
for(int i = 0 ; i < n ; i++){
sum += fib[arr[i] - 1];
cout << cal(sum) << ' ';
}
cout << '\n';
}
int main(){
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
input();
if(n <= 15 && mx <= 15){
sub1();
return 0;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1275 ms |
304 KB |
Output is correct |
2 |
Correct |
1900 ms |
308 KB |
Output is correct |
3 |
Correct |
1937 ms |
312 KB |
Output is correct |
4 |
Correct |
123 ms |
312 KB |
Output is correct |
5 |
Correct |
1723 ms |
308 KB |
Output is correct |
6 |
Correct |
1833 ms |
308 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1275 ms |
304 KB |
Output is correct |
2 |
Correct |
1900 ms |
308 KB |
Output is correct |
3 |
Correct |
1937 ms |
312 KB |
Output is correct |
4 |
Correct |
123 ms |
312 KB |
Output is correct |
5 |
Correct |
1723 ms |
308 KB |
Output is correct |
6 |
Correct |
1833 ms |
308 KB |
Output is correct |
7 |
Incorrect |
1 ms |
216 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1275 ms |
304 KB |
Output is correct |
2 |
Correct |
1900 ms |
308 KB |
Output is correct |
3 |
Correct |
1937 ms |
312 KB |
Output is correct |
4 |
Correct |
123 ms |
312 KB |
Output is correct |
5 |
Correct |
1723 ms |
308 KB |
Output is correct |
6 |
Correct |
1833 ms |
308 KB |
Output is correct |
7 |
Incorrect |
1 ms |
216 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1275 ms |
304 KB |
Output is correct |
2 |
Correct |
1900 ms |
308 KB |
Output is correct |
3 |
Correct |
1937 ms |
312 KB |
Output is correct |
4 |
Correct |
123 ms |
312 KB |
Output is correct |
5 |
Correct |
1723 ms |
308 KB |
Output is correct |
6 |
Correct |
1833 ms |
308 KB |
Output is correct |
7 |
Incorrect |
1 ms |
216 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |