Submission #1037810

#TimeUsernameProblemLanguageResultExecution timeMemory
1037810KryzToys (CEOI18_toy)C++17
100 / 100
319 ms4472 KiB
#include <bits/stdc++.h> using namespace std; #define sst string #define REP(i,x,y) for(ll i=x;i<=y;i++) #define freeopen freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); #define mod 1000000007 #define pb push_back #define mk make_pair #define foor(x,vec) for(auto x:vec ){cout<<x<<" ";} #define fi first #define se second #define MAXN 300069 #define ll int #define lld long double #define cha ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define ffl fflush(stdout) #define pii pair<ll,ll> typedef pair<ll, ll> pll; ll n; vector <ll> vec; set <ll> ans; map<ll,ll> vis; void rek(ll node,ll sum,ll sta){ ans.insert(node+sum-1); for(ll i=sta;i*i<=node;i++){ if(node%i==0) rek(node/i,sum+i-1,i); } } int main(){ scanf("%d", &n); if(n==1){ cout<<1<<endl; cout<<0<<endl; return 0; } rek(n,0,2); cout<<ans.size()<<endl; for(auto x : ans){ cout<<x<<" "; } cout<<endl; }

Compilation message (stderr)

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