Submission #225918

#TimeUsernameProblemLanguageResultExecution timeMemory
225918kshitij_sodaniToys (CEOI18_toy)C++17
100 / 100
2829 ms91384 KiB
#include <iostream> #include <bits/stdc++.h> #include <cstdio> using namespace std; #define pb push_back #define a first #define b second typedef long long llo; set<llo> fin; set<llo> fac2[100000]; /*llo rec(llo nn,llo su=0,llo ma=0){ if(kk[{nn,su}]==0){ kk[{nn,su}]=1; if(nn==1){ fin.insert(su); } else{ for(llo kk=fac2[ss[nn]].size()-1;kk>=0;kk--){ llo jj=fac2[ss[nn]][kk]; if(jj==1){ continue; } rec(nn/jj,su+jj-1); } } } }*/ int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); llo n; cin>>n; vector<llo> fac; fac.clear(); llo i=1; while(i*i<=n){ if(n%i==0){ fac.pb(i); if(i*i<n){ fac.pb(n/i); } // cout<<n<<" "<<i<<endl; } i+=1; } llo k=-1; sort(fac.begin(),fac.end()); //n^(2/3) finding factors fac2[0].insert(0); for(llo kk=0;kk<fac.size();kk++){ for(llo ll=0;ll<kk;ll++){ if(fac[kk]%fac[ll]>0){ continue; } llo add=fac[kk]/fac[ll]-1; for(auto jj:fac2[ll]){ fac2[kk].insert(jj+add); } } i+=1; } cout<<fac2[fac.size()-1].size()<<endl; for(auto ans2:fac2[fac.size()-1]){ cout<<ans2<<" "; } cout<<endl;; return 0; }

Compilation message (stderr)

toy.cpp: In function 'int main()':
toy.cpp:56:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(llo kk=0;kk<fac.size();kk++){
               ~~^~~~~~~~~~~
toy.cpp:50:6: warning: unused variable 'k' [-Wunused-variable]
  llo k=-1;
      ^
#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...