# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
321006 | phathnv | Fibonacci representations (CEOI18_fib) | C++11 | 1 ms | 364 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>
#define mp make_pair
#define X first
#define Y second
#define taskname "Toys"
using namespace std;
typedef long long ll;
typedef pair <int, int> ii;
int n;
vector <int> divisors;
vector < set<int> > res;
map <int, int> pos;
void readInput(){
ios_base::sync_with_stdio(0);
cin >> n;
}
void solve(){
for(int i = 1; i * i <= n; i++){
if (n % i)
continue;
divisors.push_back(i);
if (i * i != n)
divisors.push_back(n / i);
}
sort(divisors.begin(), divisors.end());
res.resize(divisors.size());
for(int i = 0; i < (int) divisors.size(); i++)
pos[divisors[i]] = i;
for(int i = 0; i < (int) divisors.size(); i++){
res[i].insert(divisors[i] - 1);
for(int j = i + 1; j < (int) divisors.size(); j++){
if (divisors[j] % divisors[i])
continue;
for(int x : res[i])
res[j].insert(x + divisors[j] / divisors[i] - 1);
}
}
cout << res.back().size() << '\n';
for(int x : res.back())
cout << x << ' ';
}
int main(){
if (fopen(taskname".inp", "r")){
freopen(taskname".inp", "r", stdin);
freopen(taskname".out", "w", stdout);
}
readInput();
solve();
return 0;
}
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... |