#include<bits/stdc++.h>
#define eb emplace_back
#define iter(a) a.begin(), a.end()
#define lsort(a) sort(iter(a))
#define uni(a) a.resize(unique(iter(a)) - a.begin())
#define printv(a, b) {\
for(auto pv : a) b << pv << " ";\
b << "\n";\
}
using namespace std;
typedef long long ll;
ll MOD = 1000000007;
ll inv(ll a){
ll b = MOD - 2;
ll ans = 1;
while(b > 0){
if(b & 1) ans = ans * a % MOD;
a = a * a % MOD;
b >>= 1;
}
return ans;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
assert(n <= 15);
vector<ll> fib(22);
fib[0] = 1;
fib[1] = 1;
for(int i = 2; i <= 21; i++){
fib[i] = fib[i - 1] + fib[i - 2];
}
ll sum = 0;
for(int i = 0; i < n; i++){
int x;
cin >> x;
assert(x <= 15);
sum += fib[x];
ll ans = 0;
for(int j = 0; j < (1 << 21); j++){
ll now = 0;
for(int k = 0; k < 21; k++){
if(1 << k & j) now += fib[k + 1];
}
if(now == sum) ans++;
}
cout << ans << "\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1284 ms |
284 KB |
Output is correct |
2 |
Correct |
1954 ms |
292 KB |
Output is correct |
3 |
Correct |
1924 ms |
296 KB |
Output is correct |
4 |
Correct |
128 ms |
204 KB |
Output is correct |
5 |
Correct |
1794 ms |
304 KB |
Output is correct |
6 |
Correct |
1905 ms |
292 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1284 ms |
284 KB |
Output is correct |
2 |
Correct |
1954 ms |
292 KB |
Output is correct |
3 |
Correct |
1924 ms |
296 KB |
Output is correct |
4 |
Correct |
128 ms |
204 KB |
Output is correct |
5 |
Correct |
1794 ms |
304 KB |
Output is correct |
6 |
Correct |
1905 ms |
292 KB |
Output is correct |
7 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1284 ms |
284 KB |
Output is correct |
2 |
Correct |
1954 ms |
292 KB |
Output is correct |
3 |
Correct |
1924 ms |
296 KB |
Output is correct |
4 |
Correct |
128 ms |
204 KB |
Output is correct |
5 |
Correct |
1794 ms |
304 KB |
Output is correct |
6 |
Correct |
1905 ms |
292 KB |
Output is correct |
7 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1284 ms |
284 KB |
Output is correct |
2 |
Correct |
1954 ms |
292 KB |
Output is correct |
3 |
Correct |
1924 ms |
296 KB |
Output is correct |
4 |
Correct |
128 ms |
204 KB |
Output is correct |
5 |
Correct |
1794 ms |
304 KB |
Output is correct |
6 |
Correct |
1905 ms |
292 KB |
Output is correct |
7 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
8 |
Halted |
0 ms |
0 KB |
- |