Submission #116694

# Submission time Handle Problem Language Result Execution time Memory
116694 2019-06-13T15:31:16 Z johutha Toys (CEOI18_toy) C++14
100 / 100
3198 ms 86600 KB
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>

#define int int64_t

using namespace std;

vector<int> getdivs(int n)
{
  vector<int> res;
  for (int d = 2; d*d <= n; d++)
  {
    if (n % d == 0)
    {
    	res.push_back(d);
    	if (d * d != n) res.push_back(n / d);
    }
  }
  res.push_back(n);
  sort(res.begin(), res.end());
  return res;
}

signed main()
{
  int n;
  cin >> n;
  
  vector<int> divs = getdivs(n);
  
  int dc = divs.size();
  
  vector<set<int>> res(dc);
  
  for (int f = 0; f < dc; f++)
  {
    int fdiv = divs[f];
    for (int sd = 0; sd < f; sd++)
    {
      int sdiv = divs[sd];
      if (fdiv % sdiv == 0)
      {
        int od = fdiv / sdiv;
        for (int nr : res[sd])
        {
          res[f].insert(nr + od - 1);
        }
      }
    }
    res[f].insert(fdiv - 1);
  }
  cout << res[dc - 1].size() << "\n";
  for (int i : res[dc - 1]) cout << i << " ";
  cout << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 2 ms 256 KB Output is correct
24 Correct 2 ms 256 KB Output is correct
25 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 2 ms 256 KB Output is correct
24 Correct 2 ms 256 KB Output is correct
25 Correct 2 ms 256 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 2 ms 384 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 2 ms 384 KB Output is correct
34 Correct 2 ms 384 KB Output is correct
35 Correct 2 ms 256 KB Output is correct
36 Correct 2 ms 384 KB Output is correct
37 Correct 2 ms 384 KB Output is correct
38 Correct 2 ms 384 KB Output is correct
39 Correct 2 ms 256 KB Output is correct
40 Correct 3 ms 384 KB Output is correct
41 Correct 2 ms 384 KB Output is correct
42 Correct 2 ms 384 KB Output is correct
43 Correct 2 ms 384 KB Output is correct
44 Correct 2 ms 256 KB Output is correct
45 Correct 1 ms 384 KB Output is correct
46 Correct 3 ms 256 KB Output is correct
47 Correct 2 ms 384 KB Output is correct
48 Correct 2 ms 256 KB Output is correct
49 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 2 ms 256 KB Output is correct
24 Correct 2 ms 256 KB Output is correct
25 Correct 2 ms 256 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 2 ms 384 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 2 ms 384 KB Output is correct
34 Correct 2 ms 384 KB Output is correct
35 Correct 2 ms 256 KB Output is correct
36 Correct 2 ms 384 KB Output is correct
37 Correct 2 ms 384 KB Output is correct
38 Correct 2 ms 384 KB Output is correct
39 Correct 2 ms 256 KB Output is correct
40 Correct 3 ms 384 KB Output is correct
41 Correct 2 ms 384 KB Output is correct
42 Correct 2 ms 384 KB Output is correct
43 Correct 2 ms 384 KB Output is correct
44 Correct 2 ms 256 KB Output is correct
45 Correct 1 ms 384 KB Output is correct
46 Correct 3 ms 256 KB Output is correct
47 Correct 2 ms 384 KB Output is correct
48 Correct 2 ms 256 KB Output is correct
49 Correct 2 ms 384 KB Output is correct
50 Correct 4 ms 640 KB Output is correct
51 Correct 4 ms 640 KB Output is correct
52 Correct 4 ms 640 KB Output is correct
53 Correct 11 ms 512 KB Output is correct
54 Correct 3 ms 512 KB Output is correct
55 Correct 6 ms 768 KB Output is correct
56 Correct 6 ms 640 KB Output is correct
57 Correct 5 ms 640 KB Output is correct
58 Correct 4 ms 384 KB Output is correct
59 Correct 2 ms 256 KB Output is correct
60 Correct 2 ms 384 KB Output is correct
61 Correct 4 ms 512 KB Output is correct
62 Correct 3 ms 384 KB Output is correct
63 Correct 3 ms 384 KB Output is correct
64 Correct 2 ms 256 KB Output is correct
65 Correct 4 ms 512 KB Output is correct
66 Correct 2 ms 256 KB Output is correct
67 Correct 2 ms 384 KB Output is correct
68 Correct 2 ms 384 KB Output is correct
69 Correct 2 ms 356 KB Output is correct
70 Correct 3 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 2 ms 256 KB Output is correct
24 Correct 2 ms 256 KB Output is correct
25 Correct 2 ms 256 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 2 ms 384 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 2 ms 384 KB Output is correct
34 Correct 2 ms 384 KB Output is correct
35 Correct 2 ms 256 KB Output is correct
36 Correct 2 ms 384 KB Output is correct
37 Correct 2 ms 384 KB Output is correct
38 Correct 2 ms 384 KB Output is correct
39 Correct 2 ms 256 KB Output is correct
40 Correct 3 ms 384 KB Output is correct
41 Correct 2 ms 384 KB Output is correct
42 Correct 2 ms 384 KB Output is correct
43 Correct 2 ms 384 KB Output is correct
44 Correct 2 ms 256 KB Output is correct
45 Correct 1 ms 384 KB Output is correct
46 Correct 3 ms 256 KB Output is correct
47 Correct 2 ms 384 KB Output is correct
48 Correct 2 ms 256 KB Output is correct
49 Correct 2 ms 384 KB Output is correct
50 Correct 4 ms 640 KB Output is correct
51 Correct 4 ms 640 KB Output is correct
52 Correct 4 ms 640 KB Output is correct
53 Correct 11 ms 512 KB Output is correct
54 Correct 3 ms 512 KB Output is correct
55 Correct 6 ms 768 KB Output is correct
56 Correct 6 ms 640 KB Output is correct
57 Correct 5 ms 640 KB Output is correct
58 Correct 4 ms 384 KB Output is correct
59 Correct 2 ms 256 KB Output is correct
60 Correct 2 ms 384 KB Output is correct
61 Correct 4 ms 512 KB Output is correct
62 Correct 3 ms 384 KB Output is correct
63 Correct 3 ms 384 KB Output is correct
64 Correct 2 ms 256 KB Output is correct
65 Correct 4 ms 512 KB Output is correct
66 Correct 2 ms 256 KB Output is correct
67 Correct 2 ms 384 KB Output is correct
68 Correct 2 ms 384 KB Output is correct
69 Correct 2 ms 356 KB Output is correct
70 Correct 3 ms 384 KB Output is correct
71 Correct 424 ms 18512 KB Output is correct
72 Correct 290 ms 14072 KB Output is correct
73 Correct 402 ms 16720 KB Output is correct
74 Correct 217 ms 11084 KB Output is correct
75 Correct 265 ms 11852 KB Output is correct
76 Correct 668 ms 25036 KB Output is correct
77 Correct 653 ms 21940 KB Output is correct
78 Correct 541 ms 20600 KB Output is correct
79 Correct 544 ms 19948 KB Output is correct
80 Correct 2 ms 256 KB Output is correct
81 Correct 2 ms 384 KB Output is correct
82 Correct 5 ms 640 KB Output is correct
83 Correct 57 ms 3676 KB Output is correct
84 Correct 75 ms 4344 KB Output is correct
85 Correct 16 ms 1536 KB Output is correct
86 Correct 2 ms 384 KB Output is correct
87 Correct 74 ms 4984 KB Output is correct
88 Correct 2 ms 384 KB Output is correct
89 Correct 2 ms 384 KB Output is correct
90 Correct 3 ms 384 KB Output is correct
91 Correct 21 ms 2176 KB Output is correct
92 Correct 104 ms 6520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 2 ms 256 KB Output is correct
24 Correct 2 ms 256 KB Output is correct
25 Correct 2 ms 256 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 2 ms 384 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 2 ms 384 KB Output is correct
34 Correct 2 ms 384 KB Output is correct
35 Correct 2 ms 256 KB Output is correct
36 Correct 2 ms 384 KB Output is correct
37 Correct 2 ms 384 KB Output is correct
38 Correct 2 ms 384 KB Output is correct
39 Correct 2 ms 256 KB Output is correct
40 Correct 3 ms 384 KB Output is correct
41 Correct 2 ms 384 KB Output is correct
42 Correct 2 ms 384 KB Output is correct
43 Correct 2 ms 384 KB Output is correct
44 Correct 2 ms 256 KB Output is correct
45 Correct 1 ms 384 KB Output is correct
46 Correct 3 ms 256 KB Output is correct
47 Correct 2 ms 384 KB Output is correct
48 Correct 2 ms 256 KB Output is correct
49 Correct 2 ms 384 KB Output is correct
50 Correct 4 ms 640 KB Output is correct
51 Correct 4 ms 640 KB Output is correct
52 Correct 4 ms 640 KB Output is correct
53 Correct 11 ms 512 KB Output is correct
54 Correct 3 ms 512 KB Output is correct
55 Correct 6 ms 768 KB Output is correct
56 Correct 6 ms 640 KB Output is correct
57 Correct 5 ms 640 KB Output is correct
58 Correct 4 ms 384 KB Output is correct
59 Correct 2 ms 256 KB Output is correct
60 Correct 2 ms 384 KB Output is correct
61 Correct 4 ms 512 KB Output is correct
62 Correct 3 ms 384 KB Output is correct
63 Correct 3 ms 384 KB Output is correct
64 Correct 2 ms 256 KB Output is correct
65 Correct 4 ms 512 KB Output is correct
66 Correct 2 ms 256 KB Output is correct
67 Correct 2 ms 384 KB Output is correct
68 Correct 2 ms 384 KB Output is correct
69 Correct 2 ms 356 KB Output is correct
70 Correct 3 ms 384 KB Output is correct
71 Correct 424 ms 18512 KB Output is correct
72 Correct 290 ms 14072 KB Output is correct
73 Correct 402 ms 16720 KB Output is correct
74 Correct 217 ms 11084 KB Output is correct
75 Correct 265 ms 11852 KB Output is correct
76 Correct 668 ms 25036 KB Output is correct
77 Correct 653 ms 21940 KB Output is correct
78 Correct 541 ms 20600 KB Output is correct
79 Correct 544 ms 19948 KB Output is correct
80 Correct 2 ms 256 KB Output is correct
81 Correct 2 ms 384 KB Output is correct
82 Correct 5 ms 640 KB Output is correct
83 Correct 57 ms 3676 KB Output is correct
84 Correct 75 ms 4344 KB Output is correct
85 Correct 16 ms 1536 KB Output is correct
86 Correct 2 ms 384 KB Output is correct
87 Correct 74 ms 4984 KB Output is correct
88 Correct 2 ms 384 KB Output is correct
89 Correct 2 ms 384 KB Output is correct
90 Correct 3 ms 384 KB Output is correct
91 Correct 21 ms 2176 KB Output is correct
92 Correct 104 ms 6520 KB Output is correct
93 Correct 2642 ms 77396 KB Output is correct
94 Correct 1487 ms 52404 KB Output is correct
95 Correct 1733 ms 54832 KB Output is correct
96 Correct 1529 ms 48816 KB Output is correct
97 Correct 1342 ms 44596 KB Output is correct
98 Correct 3050 ms 85268 KB Output is correct
99 Correct 3198 ms 86600 KB Output is correct
100 Correct 2979 ms 83360 KB Output is correct
101 Correct 2781 ms 77256 KB Output is correct
102 Correct 2510 ms 69500 KB Output is correct
103 Correct 1920 ms 62364 KB Output is correct
104 Correct 2 ms 256 KB Output is correct
105 Correct 3 ms 384 KB Output is correct
106 Correct 8 ms 896 KB Output is correct
107 Correct 187 ms 9592 KB Output is correct
108 Correct 487 ms 20344 KB Output is correct
109 Correct 43 ms 3320 KB Output is correct
110 Correct 2 ms 256 KB Output is correct
111 Correct 269 ms 12232 KB Output is correct
112 Correct 3 ms 384 KB Output is correct
113 Correct 3 ms 384 KB Output is correct
114 Correct 9 ms 868 KB Output is correct
115 Correct 2 ms 256 KB Output is correct
116 Correct 16 ms 1792 KB Output is correct
117 Correct 509 ms 24764 KB Output is correct