#include <bits/stdc++.h>
#include <iostream>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define rep(i,a,b) for(int i = a; i < b; i++)
#define pb push_back
int n;
const int maxf = 20;
const int p2f = 1048576;
vi f(maxf);
void getf() {
f[0] = 1; f[1] = 2;
rep(i,2,maxf) f[i] = f[i - 2] + f[i - 1];
}
ll ways(int x) {
int ways = 0;
rep(ss, 0, p2f) {
ll s = 0;
rep(i,0,maxf) {
if (ss & (1<<i)) s += f[i];
}
if (s == x) ways++;
}
return ways;
}
int main()
{
cin >> n;
getf();
int des = 0;
rep(i,0,n) {
int x; cin >> x; des += f[x-1];
cout << ways(des) << endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
753 ms |
284 KB |
Output is correct |
2 |
Correct |
1140 ms |
204 KB |
Output is correct |
3 |
Correct |
1131 ms |
292 KB |
Output is correct |
4 |
Correct |
75 ms |
204 KB |
Output is correct |
5 |
Correct |
1091 ms |
204 KB |
Output is correct |
6 |
Correct |
1151 ms |
268 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
753 ms |
284 KB |
Output is correct |
2 |
Correct |
1140 ms |
204 KB |
Output is correct |
3 |
Correct |
1131 ms |
292 KB |
Output is correct |
4 |
Correct |
75 ms |
204 KB |
Output is correct |
5 |
Correct |
1091 ms |
204 KB |
Output is correct |
6 |
Correct |
1151 ms |
268 KB |
Output is correct |
7 |
Execution timed out |
4058 ms |
204 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2403 ms |
284 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
753 ms |
284 KB |
Output is correct |
2 |
Correct |
1140 ms |
204 KB |
Output is correct |
3 |
Correct |
1131 ms |
292 KB |
Output is correct |
4 |
Correct |
75 ms |
204 KB |
Output is correct |
5 |
Correct |
1091 ms |
204 KB |
Output is correct |
6 |
Correct |
1151 ms |
268 KB |
Output is correct |
7 |
Execution timed out |
4058 ms |
204 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
344 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
753 ms |
284 KB |
Output is correct |
2 |
Correct |
1140 ms |
204 KB |
Output is correct |
3 |
Correct |
1131 ms |
292 KB |
Output is correct |
4 |
Correct |
75 ms |
204 KB |
Output is correct |
5 |
Correct |
1091 ms |
204 KB |
Output is correct |
6 |
Correct |
1151 ms |
268 KB |
Output is correct |
7 |
Execution timed out |
4058 ms |
204 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |