Submission #920743

#TimeUsernameProblemLanguageResultExecution timeMemory
920743Faisal_SaqibToys (CEOI18_toy)C++17
59 / 100
5023 ms1160 KiB
#include <iostream> #include <set> using namespace std; set<int> pos(long long&x) { if(x==1) return {0}; set<int> cur={x-1}; for(long long d=2;(d*d)<=x;d++) { if(x%d==0) { long long rem=x/d; auto nxt=pos(rem); for(auto j:nxt) cur.insert(j+(d-1)); if((d*d)!=x) { d=x/d; long long rem=x/d; auto nxt=pos(rem); for(auto j:nxt) cur.insert(j+(d-1)); d=x/d; } } } return cur; } int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(0); long long n; cin>>n; auto tlp=pos(n); cout<<tlp.size()<<'\n'; for(auto j:tlp) { cout<<j<<' '; } cout<<'\n'; }

Compilation message (stderr)

toy.cpp: In function 'std::set<int> pos(long long int&)':
toy.cpp:8:17: warning: narrowing conversion of '(x - 1)' from 'long long int' to 'int' [-Wnarrowing]
    8 |  set<int> cur={x-1};
      |                ~^~
toy.cpp:8:17: warning: narrowing conversion of '(x - 1)' from 'long long int' to 'int' [-Wnarrowing]
#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...