Submission #536832

#TimeUsernameProblemLanguageResultExecution timeMemory
536832jamezzzToys (CEOI18_toy)C++17
79 / 100
5041 ms62688 KiB
#include <bits/stdc++.h> using namespace std; #define sf scanf #define pf printf #define pb push_back #define sz(x) (int)x.size() #define all(x) x.begin(), x.end() #define disc(x) sort(all(x));x.resize(unique(all(x))-x.begin()); typedef pair<int,int> ii; int n; set<ii> vis; set<int> ans; void dp(int x,int c){ if(vis.find({x,c})!=vis.end())return; for(int i=2;i*i<=x;++i){ if(x%i==0)dp(x/i,c+i-1); } ans.insert(c+x-1); vis.insert({x,c}); } int main(){ sf("%d",&n); dp(n,0); pf("%d\n",sz(ans)); for(int i:ans)pf("%d ",i); pf("\n"); }

Compilation message (stderr)

toy.cpp: In function 'int main()':
toy.cpp:26:4: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |  sf("%d",&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...