이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
signed main(){
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
auto split=[&](int n){
set<int> ans;
ans.insert(n-1);
for(int len = 2; len <= 33; len++){
function<void(int, int, int, int)> f=[&](int cur, int have, int sum, int last){
if(have == len){
if(cur == n) ans.insert(sum);
return;
}
if(have == len-1){
int x = n / cur;
if(n % cur != 0 or x <= 1) return;
ans.insert(sum + x - 1);
return;
}
long long atleast = cur * (1LL<<(len - have));
if(atleast > n) return;
for(int x = last; ; x++){
atleast = cur * x * (1LL<<(len - have - 1));
if(atleast > n) return;
f(cur*x, have + 1, sum + x - 1, x);
}
};
f(1, 0, 0, 2);
}
return ans;
};
int n; cin >> n;
int N = n;
vector<pair<int, int>> factors;
for(int i = 2; i * i <= n; i++){
pair<int, int> s = {i, 0};
while(n > 0 && n % i == 0){
n/= i;
s.ss++;
}
if(s.ss > 0) factors.push_back(s);
}
set<int> st = split(N);
cout << st.size() << '\n';
for(auto x : st){
cout << x << ' ';
}
cout << '\n';
return 0;
}
| # | 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... |