Submission #942767

#TimeUsernameProblemLanguageResultExecution timeMemory
942767vjudge1Toys (CEOI18_toy)C++17
19 / 100
1 ms600 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;v.pb(0); for(int i=2;i*i<=n;i++){ while(n%i==0){ v.pb(i); n/=i; } } if(n>1)v.pb(n); vector <int> sum[v.size()]; sum[0].pb(0); for(int i=1;i<v.size();i++){ int x=v[i]; for(int j=i-1;j>=0;j--){ for(auto val : sum[j])sum[i].pb(x-1+val); x*=v[j]; } } sort(all(sum[v.size()-1])); int p=-1; vector <int> res; for(auto x : sum[v.size()-1]){ if(x!=p)res.pb(x); p=x; } cout<<res.size()<<"\n"; for(auto x : res)cout<<x<<" "; } /* */

Compilation message (stderr)

toy.cpp: In function 'int main()':
toy.cpp:23: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]
   23 |     for(int i=1;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...