# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
528959 |
2022-02-21T20:38:33 Z |
Lobo |
Toys (CEOI18_toy) |
C++17 |
|
163 ms |
262148 KB |
#include<bits/stdc++.h>
using namespace std;
const long long inf = (long long) 1e18 + 10;
const int inf1 = (int) 1e9 + 10;
#define int long long
#define dbl long double
#define endl '\n'
#define sc second
#define fr first
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
#define maxn
vector<int> dv, ans;
void br(int s, int n, int id) {
// cout << s << " " << n << " " << id << endl;
if(n == 1) {
ans.pb(s);
}
if(id == dv.size()) return;
br(s,n,id+1);
if(n%dv[id] == 0) br(s+dv[id]-1,n/dv[id],id);
}
void solve() {
int n;
cin >> n;
dv.pb(n);
for(int i = 2; i*i <= n; i++) {
if(n%i == 0) {
dv.pb(i);
if(n/i != i) dv.pb(n/i);
}
}
sort(all(dv));
dv.erase(unique(all(dv)),dv.end());
br(0,n,0);
sort(all(ans));
ans.erase(unique(all(ans)),ans.end());
cout << ans.size() << endl;
for(auto x : ans) cout << x << " ";
cout << endl;
}
int32_t main() {
ios::sync_with_stdio(false); cin.tie(0);
// freopen("in.in", "r", stdin);
//freopen("out.out", "w", stdout);
int tt = 1;
// cin >> tt;
while(tt--) solve();
}
Compilation message
toy.cpp: In function 'void br(long long int, long long int, long long int)':
toy.cpp:24:11: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
24 | if(id == dv.size()) return;
| ~~~^~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
163 ms |
262148 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
163 ms |
262148 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
163 ms |
262148 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
163 ms |
262148 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
163 ms |
262148 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |