Submission #679133

#TimeUsernameProblemLanguageResultExecution timeMemory
679133KiprasToys (CEOI18_toy)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> typedef long long ll; using namespace std; ll sum = 0; ll mult=1; ll n; set<ll> res; vector<ll> divv; map<pair<ll, ll>, bool> hasBeen; void gen(ll k){ //cout<<k<<" "<<sum<<" "<<mult<<endl; if(hasBeen[{mult, sum}]){ return; } hasBeen[{mult, sum}]=1; if(mult==n){ res.insert(sum); return; } for(auto i : divv){ //cout<<i<<" "<<mult*i<<" "<<n%(mult*i)<<endl; if(mult*i<=n&&n%(mult*i)==0){ sum+=i-1; mult*=i; gen(k+1); sum-=i-1; mult/=i; } } } int main() { ios_base::sync_with_stdio(0);cin.tie(nullptr); cin>>n; for(int i = 1; i*i <= n; i++){ if(n%i==0){ divv.push_back(i); if(n/i!=i)divv.push_back(n/i);, } } gen(0); cout<<res.size()<<"\n"; for(auto i : res){ cout<<i<<" "; } return 0; }

Compilation message (stderr)

toy.cpp: In function 'int main()':
toy.cpp:55:13: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   55 |             if(n/i!=i)divv.push_back(n/i);,
      |             ^~
toy.cpp:55:43: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   55 |             if(n/i!=i)divv.push_back(n/i);,
      |                                           ^
toy.cpp:55:43: error: expected primary-expression before ',' token
toy.cpp:56:9: error: expected primary-expression before '}' token
   56 |         }
      |         ^