# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
133896 | sebinkim | Fibonacci representations (CEOI18_fib) | C++14 | 4016 ms | 1788 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <ll, ll> pll;
const ll mod = 1e9 + 7;
set <pll> S;
ll n;
void erase(set <pll>::iterator it) { S.erase(it); }
void insert(pll p) { S.insert(p); }
void insert(ll t, ll x)
{
auto it = S.lower_bound(pll(x, 2e9));
if(it == S.begin() || prev(it) -> second < x){
pll p(x - 1, x + 1);
if(it != S.begin() && prev(it) -> second + 1 == x){
p.first = prev(it) -> first; erase(prev(it));
}
it = S.lower_bound(pll(x, 2e9));
if(it != S.end() && x + 1 == it -> first){
p.second = it -> second; erase(it);
}
insert(p);
}
else{
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |