Submission #581704

#TimeUsernameProblemLanguageResultExecution timeMemory
581704Memito08Toys (CEOI18_toy)C++14
0 / 100
0 ms212 KiB
#include <bits/stdc++.h> using namespace std; vector<int> sumas; long long sum = 0; vector<bool> u; void solve(long long n, int act) { if (n == 1 && !u[sum]) { sumas.push_back(sum); u[sum] = 1; return; } for (int i = act ; i*i <= n ; i++) { if (n % i == 0) { sum += i-1; solve(n/i,i); sum -= i-1; } } if (n > 1) { sum += n-1; solve(1,n); sum -= n-1; } } int main() { long long n; cin >> n; u.assign(n, 0); solve(n, 2); sort(sumas.begin(),sumas.end()); for (int i = 0 ; i < sumas.size() ; i++) { cout << sumas[i]; if (i != sumas.size()-1) cout << " "; } cout << "\n"; return 0; }

Compilation message (stderr)

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