Submission #483230

# Submission time Handle Problem Language Result Execution time Memory
483230 2021-10-28T10:19:41 Z Monarchuwu Fibonacci representations (CEOI18_fib) C++17
5 / 100
55 ms 492 KB
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
int f[25];
int n, a[25];

// f[15] = 1e3, f[15] * 15 = 15e3
int X[15'000];

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    f[1] = 1, f[2] = 2;
    for (int i = 3; i <= 20; ++i) f[i] = f[i - 1] + f[i - 2];

    for (int mask = 1, sum; mask < (1 << 20); ++mask) {
        sum = 0;
        for (int i = 0; i < 20; ++i)
            if ((1 << i) & mask) sum += f[i + 1];
        if (sum < 15'000) ++X[sum];
    }

    cin >> n;
    for (int i = 1, prf(0); i <= n; ++i) {
        cin >> a[i];
        prf += f[a[i]];
        cout << X[prf] << '\n';
    }
}
/**  /\_/\
 *  (= ._.)
 *  / >0  \>1
**/
# Verdict Execution time Memory Grader output
1 Correct 54 ms 332 KB Output is correct
2 Correct 54 ms 348 KB Output is correct
3 Correct 54 ms 348 KB Output is correct
4 Correct 54 ms 332 KB Output is correct
5 Correct 54 ms 360 KB Output is correct
6 Correct 54 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 54 ms 332 KB Output is correct
2 Correct 54 ms 348 KB Output is correct
3 Correct 54 ms 348 KB Output is correct
4 Correct 54 ms 332 KB Output is correct
5 Correct 54 ms 360 KB Output is correct
6 Correct 54 ms 332 KB Output is correct
7 Incorrect 54 ms 332 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 55 ms 452 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 54 ms 332 KB Output is correct
2 Correct 54 ms 348 KB Output is correct
3 Correct 54 ms 348 KB Output is correct
4 Correct 54 ms 332 KB Output is correct
5 Correct 54 ms 360 KB Output is correct
6 Correct 54 ms 332 KB Output is correct
7 Incorrect 54 ms 332 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 55 ms 492 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 54 ms 332 KB Output is correct
2 Correct 54 ms 348 KB Output is correct
3 Correct 54 ms 348 KB Output is correct
4 Correct 54 ms 332 KB Output is correct
5 Correct 54 ms 360 KB Output is correct
6 Correct 54 ms 332 KB Output is correct
7 Incorrect 54 ms 332 KB Output isn't correct
8 Halted 0 ms 0 KB -