Submission #93394

# Submission time Handle Problem Language Result Execution time Memory
93394 2019-01-08T07:53:43 Z Kastanda Toys (CEOI18_toy) C++11
0 / 100
2 ms 376 KB
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
const int N = 2297;
int n;
vector < int > D;
set < int > M[N];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> n;
    for (int i = 1; i <= sqrt(n); i++)
        if (n % i == 0)
            D.pb(i), D.pb(n / i);
    sort(D.begin(), D.end());
    D.resize(unique(D.begin(), D.end()) - D.begin());
    for (int i = 1; i < D.size(); i++)
    {
        M[i].insert(D[i] - 1);
        for (int j = 1; j < i; j++)
            if (D[i] % D[j] == 0)
            {
                int d = D[i] / D[j] - 1;
                for (int a : M[j])
                    M[i].insert(a + d);
            }
    }
    int last = (int)D.size() - 1;
    cout << (int)M[last].size() << "\n";
    for (int a : M[last])
        cout << a << " ";
    return (0);
}

Compilation message

toy.cpp: In function 'int main()':
toy.cpp:18:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 1; i < D.size(); i++)
                     ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -