# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
582569 | 2022-06-24T06:06:10 Z | 박상훈(#8369) | Fibonacci representations (CEOI18_fib) | C++17 | 0 ms | 212 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); ll ans = 1; st.insert(0); for (int i=1;i<=n;i++){ int x; scanf("%d", &x); auto iter = st.insert(x); ans = (ans * (x-*prev(iter))/2 ) % MOD; if (next(iter)!=st.end()){ //printf(" %d %d %d\n", *prev(iter), x, *next(iter)); ans = (ans * INV( (*next(iter)-*prev(iter)) /2 ) ) % MOD; ans = (ans * (*next(iter)-x)/2) % MOD; } printf("%lld\n", ans); } 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 | 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 | 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 | - |