Submission #153176

#TimeUsernameProblemLanguageResultExecution timeMemory
153176nicolaalexandraToys (CEOI18_toy)C++14
39 / 100
5071 ms504 KiB
#include <iostream> #include <set> using namespace std; //ifstream cin ("date.in"); //ofstream cout ("date.out"); multiset <int> v; set <int> sol; int x,nr,d; void back (){ if (v.size() == 1) return; int val = 0; for (auto x:v) val += x-1; sol.insert (val); if (v.size() == 2) return; /// vreau sa reduc dimensiunea cu 1 /// elimin dublurile set <int> s; for (auto x:v) s.insert(x); for (auto x:s) for (auto y:s){ if (y > x) continue; /// le elimin din set si introduc produsul lor if (x == y && v.count(x) < 2) continue; v.erase(v.find(x)); v.erase(v.find(y)); v.insert(x*y); back (); v.insert(x); v.insert(y); v.erase(v.find(x*y)); }} int main (){ cin>>x; int d = 2, nr = x; while (nr != 1 && d <= nr/d){ int e = 0; while (nr % d == 0){ v.insert (d); /// multiset nr /= d; } d++; } if (nr != 1) v.insert (nr); back (); sol.insert (x-1); cout<<sol.size()<<"\n"; for (auto x:sol) cout<<x<<" "; return 0; }

Compilation message (stderr)

toy.cpp: In function 'int main()':
toy.cpp:46:13: warning: unused variable 'e' [-Wunused-variable]
         int e = 0;
             ^
#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...