#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
#define fi first
#define se second
#define mp make_pair
#define fastIO std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define TEST freopen("in.txt","r",stdin);
#define ones(a) __builtin_popcount(a);
#define pq priority_queue
vector<int> divis;
void divide(int n){
for(int i = 1;i * i <= n;i ++ ){
if(n % i == 0){
divis.push_back(i);
if(i*i < n)
divis.push_back(n/i);
}
}
sort(divis.begin(), divis.end());
}
int main(){
fastIO;
int n;
cin >> n;
divide(n);
int tot = divis.size();
unordered_set<int> options[tot];
options[0].insert(0);
int fr, sr;
for(int i = 0;i < tot;i ++ ){
fr = divis[i];
for(int j = i + 1;j < tot; j ++ ){
sr = divis[j];
if(sr % fr != 0)
continue;
sr /= fr;
sr -- ;
for(auto x : options[i])
options[j].insert(x + sr);
}
}
vector<int>answer;
for(auto x : options[tot - 1]){
answer.push_back(x);
}
cout << answer.size() << "\n";
for(auto x : answer)
cout << x << " ";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
508 KB |
Output is correct |
3 |
Correct |
2 ms |
508 KB |
Output is correct |
4 |
Correct |
2 ms |
508 KB |
Output is correct |
5 |
Correct |
2 ms |
508 KB |
Output is correct |
6 |
Correct |
2 ms |
508 KB |
Output is correct |
7 |
Correct |
2 ms |
548 KB |
Output is correct |
8 |
Incorrect |
2 ms |
676 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
508 KB |
Output is correct |
3 |
Correct |
2 ms |
508 KB |
Output is correct |
4 |
Correct |
2 ms |
508 KB |
Output is correct |
5 |
Correct |
2 ms |
508 KB |
Output is correct |
6 |
Correct |
2 ms |
508 KB |
Output is correct |
7 |
Correct |
2 ms |
548 KB |
Output is correct |
8 |
Incorrect |
2 ms |
676 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
508 KB |
Output is correct |
3 |
Correct |
2 ms |
508 KB |
Output is correct |
4 |
Correct |
2 ms |
508 KB |
Output is correct |
5 |
Correct |
2 ms |
508 KB |
Output is correct |
6 |
Correct |
2 ms |
508 KB |
Output is correct |
7 |
Correct |
2 ms |
548 KB |
Output is correct |
8 |
Incorrect |
2 ms |
676 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
508 KB |
Output is correct |
3 |
Correct |
2 ms |
508 KB |
Output is correct |
4 |
Correct |
2 ms |
508 KB |
Output is correct |
5 |
Correct |
2 ms |
508 KB |
Output is correct |
6 |
Correct |
2 ms |
508 KB |
Output is correct |
7 |
Correct |
2 ms |
548 KB |
Output is correct |
8 |
Incorrect |
2 ms |
676 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
508 KB |
Output is correct |
3 |
Correct |
2 ms |
508 KB |
Output is correct |
4 |
Correct |
2 ms |
508 KB |
Output is correct |
5 |
Correct |
2 ms |
508 KB |
Output is correct |
6 |
Correct |
2 ms |
508 KB |
Output is correct |
7 |
Correct |
2 ms |
548 KB |
Output is correct |
8 |
Incorrect |
2 ms |
676 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |