Submission #1103935

#TimeUsernameProblemLanguageResultExecution timeMemory
1103935ezzzayToys (CEOI18_toy)C++14
100 / 100
1534 ms4424 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define ff first #define ss second #define pb push_back int m,n; vector<int>vc; set<int>st; void fun(int x, int p, int k){ if(x==1){ st.insert(k); return; } for(int i=p;i<vc.size();i++){ if(vc[i]>x)break; if(x%vc[i]==0){ fun(x/vc[i],i,k+vc[i]-1); } } } signed main(){ cin>>n; set<int>ts; for(int i=2;i<=sqrt(n);i++){ if(n%i==0){ ts.insert(i); ts.insert(n/i); } } for(auto a:ts)vc.pb(a); fun(n,0,0); st.insert(n-1); cout<<st.size()<<endl; for(auto a:st)cout<<a<<" "; }

Compilation message (stderr)

toy.cpp: In function 'void fun(long long int, long long int, long long int)':
toy.cpp:15:18: 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]
   15 |     for(int i=p;i<vc.size();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...