Submission #528959

#TimeUsernameProblemLanguageResultExecution timeMemory
528959LoboToys (CEOI18_toy)C++17
0 / 100
163 ms262148 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...