Submission #130055

#TimeUsernameProblemLanguageResultExecution timeMemory
130055OptxPrimeToys (CEOI18_toy)C++11
100 / 100
462 ms17016 KiB
#include <iostream> #include <cmath> #include<vector> #include <algorithm> #include <utility> #include<stack> #include<queue> #include<map> #include <fstream> #include<set> using namespace std; #define pb push_back #define mp make_pair #define ll long long //#define maxn 100005 vector<int> ans; void rec( int rem, int sum, int from ) { ans.pb( sum + rem-1 ); for( int i=from; (i*i) <= rem;i++ ){ if( rem%i==0 ){ rec( rem/i, sum+i-1, i ); } } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin>>n; rec( n, 0,2 ); sort( ans.begin(), ans.end() ); ans.erase( unique( ans.begin(), ans.end() ), ans.end() ); cout <<ans.size()<<endl; for( int i=0;i<ans.size();i++ ) cout<<ans[i]<< " "; cout<<endl; return 0; }

Compilation message (stderr)

toy.cpp: In function 'int main()':
toy.cpp:42:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for( int i=0;i<ans.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...