Submission #943377

#TimeUsernameProblemLanguageResultExecution timeMemory
943377vjudge1Toys (CEOI18_toy)C++17
100 / 100
2664 ms90180 KiB
#include <bits/stdc++.h> #define int long long #define ff first #define ss second #define pb push_back #define all(x) x.begin(),x.end() using namespace std; signed main(){ ios_base::sync_with_stdio(); cin.tie(0);cout.tie(0); int n; cin>>n; vector <int> v; for(int i=1;i*i<=n;i++){ if(n%i==0){ v.pb(i); if(i!=n/i)v.pb(n/i); } } sort(all(v)); set <int> res; map <int,set <int> > sum; sum[1].insert(0); for(int i=0;i<v.size();i++){ for(int j=0;j<i;j++){ if(v[i]%v[j]==0){ for(auto x : sum[v[j]])sum[v[i]].insert(x+v[i]/v[j]-1); } } } for(auto x : sum[n])res.insert(x); cout<<res.size()<<"\n"; for(auto x : res)cout<<x<<" "; cout<<"\n"; } /* */

Compilation message (stderr)

toy.cpp: In function 'int main()':
toy.cpp:24:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     for(int i=0;i<v.size();i++){
      |                 ~^~~~~~~~~
#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...