Submission #1070368

#TimeUsernameProblemLanguageResultExecution timeMemory
1070368YassirSalamaToys (CEOI18_toy)C++17
59 / 100
1025 ms262144 KiB
#include<bits/stdc++.h> using namespace std; #define pb push_back template<typename T> void dbg(const T& t){ cout<<t<<endl; } template<typename T,typename... Args> void dbg(const T& t,const Args&... args){ cout<<t<<" , "; dbg(args...); } #define dbg(...) cout<<"("<<#__VA_ARGS__<<") : ";dbg(__VA_ARGS__); #define all(v) v.begin(),v.end() signed main(){ int n; cin>>n; int x=n; vector<int> p; for(int i=2;i*i<=n;i++){ while(n%i==0){ p.pb(i); n/=i; } } if(n!=1) p.pb(n); sort(all(p)); set<vector<int>> decomp; decomp.insert({1}); set<vector<int>> c; for(auto pp : p){ c.clear(); for(auto &x:decomp){ for(int i=0;i<x.size();i++){ vector<int> t=x; t[i]*=pp; sort(all(t)); c.insert(t); } vector<int> t=x; t.pb(pp); sort(all(t)); c.insert(t); } decomp=c; } set<int> ans; for(auto x:decomp){ long long s=0; for(auto y:x){ s+=y-1; } ans.insert(s); } cout<<ans.size()<<endl; for(auto x:ans){ cout<<x<<" "; } cout<<endl; }

Compilation message (stderr)

toy.cpp: In function 'int main()':
toy.cpp:34:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |             for(int i=0;i<x.size();i++){
      |                         ~^~~~~~~~~
toy.cpp:18:9: warning: unused variable 'x' [-Wunused-variable]
   18 |     int x=n;
      |         ^
#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...