Submission #585016

#TimeUsernameProblemLanguageResultExecution timeMemory
585016hibikiToys (CEOI18_toy)C++11
100 / 100
1990 ms86640 KiB
#include<bits/stdc++.h> using namespace std; #define pb push_back #define sz(x) (int)x.size() int n; map<int, set<int> > mp; void find(int nw) { if(mp.count(nw)) return ; mp[nw].insert(nw - 1); for(int j = 2; j * j <= nw; j++) { if(nw % j == 0) { int a = j; int b = nw / j; find(a); for(auto _: mp[a]) mp[nw].insert(b - 1 + _); find(b); for(auto _: mp[b]) mp[nw].insert(a - 1 + _); } } // printf("%d\n",nw); // for(auto _: mp[nw]) // printf("%d ",_); // printf("\n"); } int main() { mp[1].insert(0); mp[2].insert(1); scanf("%d",&n); find(n); printf("%d\n",sz(mp[n])); for(auto _: mp[n]) printf("%d ",_); printf("\n"); return 0; }

Compilation message (stderr)

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