Submission #78953

#TimeUsernameProblemLanguageResultExecution timeMemory
78953aminraToys (CEOI18_toy)C++14
100 / 100
3694 ms92104 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const int MOD = (int)1e9 + 7; const int MAXN = (int)1e5 + 7; const int infint = (int)1e9; vector<int> dv; set<int> dp[MAXN]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; for (int i = 1; i * i <= n; i++) { if(n % i) continue; dv.push_back(i); if(i * i != n) dv.push_back(n / i); } sort(dv.begin(), dv.end()); dp[0].insert(0); for (int i = 1; i < dv.size(); i++) for (int j = 0; j < i; j++) if(dv[i] % dv[j] == 0) for (auto u : dp[j]) dp[i].insert(u + dv[i] / dv[j] - 1); cout << dp[dv.size() - 1].size() << "\n"; for (auto u : dp[dv.size() - 1]) cout << u << " "; }

Compilation message (stderr)

toy.cpp: In function 'int main()':
toy.cpp:18:6: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
      if(n % i)
      ^~
toy.cpp:20:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   dv.push_back(i);
   ^~
toy.cpp:26:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 1; i < dv.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...