Submission #585008

#TimeUsernameProblemLanguageResultExecution timeMemory
585008krit3379Toys (CEOI18_toy)C++17
100 / 100
2276 ms86536 KiB
#include<bits/stdc++.h> using namespace std; #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #define N 100005 map<int,set<int>> mp; void sol(int n){ if(mp.count(n))return ; int i,sq=sqrt(n); for(i=1;i<=sq;i++){ if(n%i==0){ sol(i); for(auto x:mp[i])mp[n].insert(n/i-1+x); if(i!=1){ sol(n/i); for(auto x:mp[n/i])mp[n].insert(i-1+x); } } } } int main(){ int n,i,sum; scanf("%d",&n); mp[1].insert(0); sol(n); printf("%d\n",mp[n].size()); for(auto x:mp[n])printf("%d ",x); return 0; }

Compilation message (stderr)

toy.cpp: In function 'int main()':
toy.cpp:29:14: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::set<int>::size_type' {aka 'long unsigned int'} [-Wformat=]
   29 |     printf("%d\n",mp[n].size());
      |             ~^    ~~~~~~~~~~~~
      |              |              |
      |              int            std::set<int>::size_type {aka long unsigned int}
      |             %ld
toy.cpp:25:11: warning: unused variable 'i' [-Wunused-variable]
   25 |     int n,i,sum;
      |           ^
toy.cpp:25:13: warning: unused variable 'sum' [-Wunused-variable]
   25 |     int n,i,sum;
      |             ^~~
toy.cpp:26:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |     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...