Submission #654058

#TimeUsernameProblemLanguageResultExecution timeMemory
654058MasterTasterToys (CEOI18_toy)C++14
0 / 100
1 ms292 KiB
#include <iostream> #include <vector> #include <algorithm> #include <map> #define ll long long #define pb push_back using namespace std; ll n; vector<ll> svi, ress; void dfs(ll x, vector<ll> &d, int i, ll sum) { if (x==1) return; ress.pb(sum+x-1); vector<ll> dd; for (; i<d.size(); i++) if (x%d[i]==0) dd.pb(d[i]); for (int i=0; i<dd.size(); i++) { if (x/dd[i]>=dd[i]) dfs(x/dd[i], dd, i, sum+dd[i]-1); } } map<ll, bool> bio; int main() { cin>>n; if (n==1) { cout<<1<<endl<<0; exit(0); } for (ll i=2; i*i<=n; i++) if (n%i==0) svi.pb(i); dfs(n, svi, 0, 0); vector<ll> r=ress; //for (int i=0; i<ress.size(); i++) if (!bio[ress[i]]) { bio[ress[i]]=true; r.pb(ress[i]); } cout<<r.size()<<endl; sort(r.begin(), r.end()); for (int i=0; i<r.size(); i++) cout<<r[i]<<" "; }

Compilation message (stderr)

toy.cpp: In function 'void dfs(long long int, std::vector<long long int>&, int, long long int)':
toy.cpp:20:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     for (; i<d.size(); i++)
      |            ~^~~~~~~~~
toy.cpp:23:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for (int i=0; i<dd.size(); i++)
      |                   ~^~~~~~~~~~
toy.cpp: In function 'int main()':
toy.cpp:46:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |     for (int i=0; i<r.size(); i++) cout<<r[i]<<" ";
      |                   ~^~~~~~~~~
#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...