Submission #383423

# Submission time Handle Problem Language Result Execution time Memory
383423 2021-03-29T21:35:55 Z rumen_m Toys (CEOI18_toy) C++17
0 / 100
1 ms 364 KB
# include <bits/stdc++.h>
using namespace std;
vector <int> nums;
void solve(int n, int sum, int l)
{
    if(n==1){nums.push_back(sum);return;}
    for(int i=1;i*i<=n;i++)
    {
        if(n%i==0)
        {
            if(i>=l)
            {
                solve(n/i,sum+i-1,i);
            }
            if(n/i>=l)
            {
                solve(i,sum+n/i-1,n/i);
            }
        }
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin>>n;
    solve(n,0,2);
    sort(nums.begin(),nums.end());
    cout<<nums.size()<<endl;
    for(int i = 0;i<nums.size();i++)
        cout<<nums[i]<<" ";
    cout<<endl;
}

Compilation message

toy.cpp: In function 'int main()':
toy.cpp:31:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     for(int i = 0;i<nums.size();i++)
      |                   ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -