# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
582677 | 2022-06-24T08:55:16 Z | 박상훈(#8369) | Fibonacci representations (CEOI18_fib) | C++17 | 4000 ms | 800 KB |
#include <bits/stdc++.h> typedef long long ll; using namespace std; const int MOD = 1e9+7; multiset<int> st; ll pw(ll a, ll e){ if (!e) return 1; ll ret = pw(a, e/2); if (e&1) return ret*ret%MOD*a%MOD; return ret*ret%MOD; } ll INV(ll x){ return pw(x, MOD - 2); } int main(){ int n; scanf("%d", &n); vector<int> a = {0}; for (int i=1;i<=n;i++){ int x; scanf("%d", &x); a.push_back(x); sort(a.begin(), a.end()); vector<ll> dp1(a.size()), dp2(a.size()); dp1[0] = dp2[0] = 1; for (int i=1;i<(int)a.size();i++){ dp1[i] = dp1[i-1] * ((a[i] - a[i-1] + 1) / 2) % MOD; if (a[i]%2==a[i-1]%2) dp1[i] = (dp1[i] + dp1[i-1] - dp2[i-1] + MOD) % MOD; dp2[i] = dp1[i-1]; } printf("%lld\n", dp1.back()); } return 0; }
Compilation message
# | 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 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
# | 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 | 1 ms | 340 KB | Output is correct |
2 | Execution timed out | 4091 ms | 800 KB | Time limit exceeded |
3 | 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 | - |