Submission #920768

#TimeUsernameProblemLanguageResultExecution timeMemory
920768Faisal_SaqibToys (CEOI18_toy)C++17
100 / 100
3226 ms90356 KiB
#pragma GCC optimize ("O3") #pragma GCC optimize ("unroll-loops") #include <iostream> #include <map> #include <set> using namespace std; map<int,set<int>> mp; void pos(int&x) { auto it=mp.find(x); if(it!=mp.end()) return; set<int> cur={x-1}; for(long long d=2;(d*d)<=x;d++) { if(x%d==0) { x/=d; pos(x); auto nxt=mp[x]; for(auto&j:nxt) cur.insert(j+(d-1)); x*=d; if((d*d)!=x) { d=x/d; x/=d; pos(x); auto nxt=mp[x]; for(auto&j:nxt) cur.insert(j+(d-1)); x*=d; d=x/d; } } } mp[x]=cur; } int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(0); int n; cin>>n; scanf("%d",&n); pos(n); auto tlp=mp[n]; printf("%d\n",tlp.size()); for(auto&i:tlp) printf("%d ",i); printf("\n"); }

Compilation message (stderr)

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