Submission #75377

# Submission time Handle Problem Language Result Execution time Memory
75377 2018-09-09T13:24:15 Z doowey Toys (CEOI18_toy) C++14
79 / 100
5000 ms 86972 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

typedef long double db;
typedef pair<int,int> pii;

#define fi first
#define se second
#define mp make_pair
#define fastIO std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define TEST freopen("in.txt","r",stdin);
#define ones(a) __builtin_popcount(a);
#define pq priority_queue

vector<int> divis;

void divide(int n){
  for(int i = 1;i * i <= n;i  ++ ){
    if(n % i == 0){
      divis.push_back(i);
      if(i*i < n)
        divis.push_back(n/i);
    }
  }
  sort(divis.begin(), divis.end());
}
  

int main(){
  fastIO;
  int n;
  cin >> n;
  divide(n);
  int tot = divis.size();
  set<int> options[tot];
  options[0].insert(0);
  int fr, sr;
  for(int i = 0;i < tot;i ++ ){
    fr = divis[i];
    for(int j = i + 1;j < tot; j ++ ){
      sr = divis[j];
      if(sr % fr != 0)
        continue;
      sr /= fr;
      sr -- ;
      for(auto x : options[i])
        options[j].insert(x + sr);
    }
  }
  vector<int>answer;
  for(auto x : options[tot - 1]){
      answer.push_back(x);
  }
  cout << answer.size() << "\n";
  for(auto x : answer)  
    cout << x << " ";
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 396 KB Output is correct
4 Correct 2 ms 464 KB Output is correct
5 Correct 2 ms 468 KB Output is correct
6 Correct 2 ms 604 KB Output is correct
7 Correct 2 ms 716 KB Output is correct
8 Correct 2 ms 716 KB Output is correct
9 Correct 2 ms 716 KB Output is correct
10 Correct 2 ms 716 KB Output is correct
11 Correct 2 ms 716 KB Output is correct
12 Correct 3 ms 716 KB Output is correct
13 Correct 2 ms 720 KB Output is correct
14 Correct 2 ms 744 KB Output is correct
15 Correct 2 ms 744 KB Output is correct
16 Correct 2 ms 748 KB Output is correct
17 Correct 3 ms 756 KB Output is correct
18 Correct 2 ms 764 KB Output is correct
19 Correct 2 ms 892 KB Output is correct
20 Correct 2 ms 892 KB Output is correct
21 Correct 2 ms 892 KB Output is correct
22 Correct 2 ms 892 KB Output is correct
23 Correct 2 ms 892 KB Output is correct
24 Correct 2 ms 892 KB Output is correct
25 Correct 2 ms 892 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 396 KB Output is correct
4 Correct 2 ms 464 KB Output is correct
5 Correct 2 ms 468 KB Output is correct
6 Correct 2 ms 604 KB Output is correct
7 Correct 2 ms 716 KB Output is correct
8 Correct 2 ms 716 KB Output is correct
9 Correct 2 ms 716 KB Output is correct
10 Correct 2 ms 716 KB Output is correct
11 Correct 2 ms 716 KB Output is correct
12 Correct 3 ms 716 KB Output is correct
13 Correct 2 ms 720 KB Output is correct
14 Correct 2 ms 744 KB Output is correct
15 Correct 2 ms 744 KB Output is correct
16 Correct 2 ms 748 KB Output is correct
17 Correct 3 ms 756 KB Output is correct
18 Correct 2 ms 764 KB Output is correct
19 Correct 2 ms 892 KB Output is correct
20 Correct 2 ms 892 KB Output is correct
21 Correct 2 ms 892 KB Output is correct
22 Correct 2 ms 892 KB Output is correct
23 Correct 2 ms 892 KB Output is correct
24 Correct 2 ms 892 KB Output is correct
25 Correct 2 ms 892 KB Output is correct
26 Correct 3 ms 892 KB Output is correct
27 Correct 3 ms 892 KB Output is correct
28 Correct 2 ms 892 KB Output is correct
29 Correct 2 ms 892 KB Output is correct
30 Correct 2 ms 892 KB Output is correct
31 Correct 3 ms 892 KB Output is correct
32 Correct 3 ms 892 KB Output is correct
33 Correct 3 ms 892 KB Output is correct
34 Correct 2 ms 892 KB Output is correct
35 Correct 2 ms 892 KB Output is correct
36 Correct 3 ms 892 KB Output is correct
37 Correct 3 ms 892 KB Output is correct
38 Correct 2 ms 892 KB Output is correct
39 Correct 2 ms 892 KB Output is correct
40 Correct 2 ms 892 KB Output is correct
41 Correct 2 ms 892 KB Output is correct
42 Correct 2 ms 896 KB Output is correct
43 Correct 2 ms 900 KB Output is correct
44 Correct 2 ms 908 KB Output is correct
45 Correct 2 ms 912 KB Output is correct
46 Correct 2 ms 912 KB Output is correct
47 Correct 3 ms 916 KB Output is correct
48 Correct 2 ms 920 KB Output is correct
49 Correct 2 ms 924 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 396 KB Output is correct
4 Correct 2 ms 464 KB Output is correct
5 Correct 2 ms 468 KB Output is correct
6 Correct 2 ms 604 KB Output is correct
7 Correct 2 ms 716 KB Output is correct
8 Correct 2 ms 716 KB Output is correct
9 Correct 2 ms 716 KB Output is correct
10 Correct 2 ms 716 KB Output is correct
11 Correct 2 ms 716 KB Output is correct
12 Correct 3 ms 716 KB Output is correct
13 Correct 2 ms 720 KB Output is correct
14 Correct 2 ms 744 KB Output is correct
15 Correct 2 ms 744 KB Output is correct
16 Correct 2 ms 748 KB Output is correct
17 Correct 3 ms 756 KB Output is correct
18 Correct 2 ms 764 KB Output is correct
19 Correct 2 ms 892 KB Output is correct
20 Correct 2 ms 892 KB Output is correct
21 Correct 2 ms 892 KB Output is correct
22 Correct 2 ms 892 KB Output is correct
23 Correct 2 ms 892 KB Output is correct
24 Correct 2 ms 892 KB Output is correct
25 Correct 2 ms 892 KB Output is correct
26 Correct 3 ms 892 KB Output is correct
27 Correct 3 ms 892 KB Output is correct
28 Correct 2 ms 892 KB Output is correct
29 Correct 2 ms 892 KB Output is correct
30 Correct 2 ms 892 KB Output is correct
31 Correct 3 ms 892 KB Output is correct
32 Correct 3 ms 892 KB Output is correct
33 Correct 3 ms 892 KB Output is correct
34 Correct 2 ms 892 KB Output is correct
35 Correct 2 ms 892 KB Output is correct
36 Correct 3 ms 892 KB Output is correct
37 Correct 3 ms 892 KB Output is correct
38 Correct 2 ms 892 KB Output is correct
39 Correct 2 ms 892 KB Output is correct
40 Correct 2 ms 892 KB Output is correct
41 Correct 2 ms 892 KB Output is correct
42 Correct 2 ms 896 KB Output is correct
43 Correct 2 ms 900 KB Output is correct
44 Correct 2 ms 908 KB Output is correct
45 Correct 2 ms 912 KB Output is correct
46 Correct 2 ms 912 KB Output is correct
47 Correct 3 ms 916 KB Output is correct
48 Correct 2 ms 920 KB Output is correct
49 Correct 2 ms 924 KB Output is correct
50 Correct 5 ms 1188 KB Output is correct
51 Correct 5 ms 1192 KB Output is correct
52 Correct 5 ms 1204 KB Output is correct
53 Correct 5 ms 1204 KB Output is correct
54 Correct 4 ms 1204 KB Output is correct
55 Correct 7 ms 1344 KB Output is correct
56 Correct 7 ms 1344 KB Output is correct
57 Correct 6 ms 1344 KB Output is correct
58 Correct 2 ms 1344 KB Output is correct
59 Correct 2 ms 1344 KB Output is correct
60 Correct 2 ms 1344 KB Output is correct
61 Correct 4 ms 1344 KB Output is correct
62 Correct 3 ms 1344 KB Output is correct
63 Correct 2 ms 1344 KB Output is correct
64 Correct 2 ms 1344 KB Output is correct
65 Correct 4 ms 1344 KB Output is correct
66 Correct 2 ms 1344 KB Output is correct
67 Correct 2 ms 1344 KB Output is correct
68 Correct 2 ms 1344 KB Output is correct
69 Correct 2 ms 1344 KB Output is correct
70 Correct 3 ms 1344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 396 KB Output is correct
4 Correct 2 ms 464 KB Output is correct
5 Correct 2 ms 468 KB Output is correct
6 Correct 2 ms 604 KB Output is correct
7 Correct 2 ms 716 KB Output is correct
8 Correct 2 ms 716 KB Output is correct
9 Correct 2 ms 716 KB Output is correct
10 Correct 2 ms 716 KB Output is correct
11 Correct 2 ms 716 KB Output is correct
12 Correct 3 ms 716 KB Output is correct
13 Correct 2 ms 720 KB Output is correct
14 Correct 2 ms 744 KB Output is correct
15 Correct 2 ms 744 KB Output is correct
16 Correct 2 ms 748 KB Output is correct
17 Correct 3 ms 756 KB Output is correct
18 Correct 2 ms 764 KB Output is correct
19 Correct 2 ms 892 KB Output is correct
20 Correct 2 ms 892 KB Output is correct
21 Correct 2 ms 892 KB Output is correct
22 Correct 2 ms 892 KB Output is correct
23 Correct 2 ms 892 KB Output is correct
24 Correct 2 ms 892 KB Output is correct
25 Correct 2 ms 892 KB Output is correct
26 Correct 3 ms 892 KB Output is correct
27 Correct 3 ms 892 KB Output is correct
28 Correct 2 ms 892 KB Output is correct
29 Correct 2 ms 892 KB Output is correct
30 Correct 2 ms 892 KB Output is correct
31 Correct 3 ms 892 KB Output is correct
32 Correct 3 ms 892 KB Output is correct
33 Correct 3 ms 892 KB Output is correct
34 Correct 2 ms 892 KB Output is correct
35 Correct 2 ms 892 KB Output is correct
36 Correct 3 ms 892 KB Output is correct
37 Correct 3 ms 892 KB Output is correct
38 Correct 2 ms 892 KB Output is correct
39 Correct 2 ms 892 KB Output is correct
40 Correct 2 ms 892 KB Output is correct
41 Correct 2 ms 892 KB Output is correct
42 Correct 2 ms 896 KB Output is correct
43 Correct 2 ms 900 KB Output is correct
44 Correct 2 ms 908 KB Output is correct
45 Correct 2 ms 912 KB Output is correct
46 Correct 2 ms 912 KB Output is correct
47 Correct 3 ms 916 KB Output is correct
48 Correct 2 ms 920 KB Output is correct
49 Correct 2 ms 924 KB Output is correct
50 Correct 5 ms 1188 KB Output is correct
51 Correct 5 ms 1192 KB Output is correct
52 Correct 5 ms 1204 KB Output is correct
53 Correct 5 ms 1204 KB Output is correct
54 Correct 4 ms 1204 KB Output is correct
55 Correct 7 ms 1344 KB Output is correct
56 Correct 7 ms 1344 KB Output is correct
57 Correct 6 ms 1344 KB Output is correct
58 Correct 2 ms 1344 KB Output is correct
59 Correct 2 ms 1344 KB Output is correct
60 Correct 2 ms 1344 KB Output is correct
61 Correct 4 ms 1344 KB Output is correct
62 Correct 3 ms 1344 KB Output is correct
63 Correct 2 ms 1344 KB Output is correct
64 Correct 2 ms 1344 KB Output is correct
65 Correct 4 ms 1344 KB Output is correct
66 Correct 2 ms 1344 KB Output is correct
67 Correct 2 ms 1344 KB Output is correct
68 Correct 2 ms 1344 KB Output is correct
69 Correct 2 ms 1344 KB Output is correct
70 Correct 3 ms 1344 KB Output is correct
71 Correct 704 ms 19332 KB Output is correct
72 Correct 455 ms 19332 KB Output is correct
73 Correct 677 ms 19332 KB Output is correct
74 Correct 328 ms 19332 KB Output is correct
75 Correct 391 ms 19332 KB Output is correct
76 Correct 1162 ms 25792 KB Output is correct
77 Correct 923 ms 25792 KB Output is correct
78 Correct 869 ms 25792 KB Output is correct
79 Correct 824 ms 25792 KB Output is correct
80 Correct 2 ms 25792 KB Output is correct
81 Correct 2 ms 25792 KB Output is correct
82 Correct 5 ms 25792 KB Output is correct
83 Correct 70 ms 25792 KB Output is correct
84 Correct 114 ms 25792 KB Output is correct
85 Correct 19 ms 25792 KB Output is correct
86 Correct 2 ms 25792 KB Output is correct
87 Correct 92 ms 25792 KB Output is correct
88 Correct 2 ms 25792 KB Output is correct
89 Correct 2 ms 25792 KB Output is correct
90 Correct 2 ms 25792 KB Output is correct
91 Correct 28 ms 25792 KB Output is correct
92 Correct 138 ms 25792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 396 KB Output is correct
4 Correct 2 ms 464 KB Output is correct
5 Correct 2 ms 468 KB Output is correct
6 Correct 2 ms 604 KB Output is correct
7 Correct 2 ms 716 KB Output is correct
8 Correct 2 ms 716 KB Output is correct
9 Correct 2 ms 716 KB Output is correct
10 Correct 2 ms 716 KB Output is correct
11 Correct 2 ms 716 KB Output is correct
12 Correct 3 ms 716 KB Output is correct
13 Correct 2 ms 720 KB Output is correct
14 Correct 2 ms 744 KB Output is correct
15 Correct 2 ms 744 KB Output is correct
16 Correct 2 ms 748 KB Output is correct
17 Correct 3 ms 756 KB Output is correct
18 Correct 2 ms 764 KB Output is correct
19 Correct 2 ms 892 KB Output is correct
20 Correct 2 ms 892 KB Output is correct
21 Correct 2 ms 892 KB Output is correct
22 Correct 2 ms 892 KB Output is correct
23 Correct 2 ms 892 KB Output is correct
24 Correct 2 ms 892 KB Output is correct
25 Correct 2 ms 892 KB Output is correct
26 Correct 3 ms 892 KB Output is correct
27 Correct 3 ms 892 KB Output is correct
28 Correct 2 ms 892 KB Output is correct
29 Correct 2 ms 892 KB Output is correct
30 Correct 2 ms 892 KB Output is correct
31 Correct 3 ms 892 KB Output is correct
32 Correct 3 ms 892 KB Output is correct
33 Correct 3 ms 892 KB Output is correct
34 Correct 2 ms 892 KB Output is correct
35 Correct 2 ms 892 KB Output is correct
36 Correct 3 ms 892 KB Output is correct
37 Correct 3 ms 892 KB Output is correct
38 Correct 2 ms 892 KB Output is correct
39 Correct 2 ms 892 KB Output is correct
40 Correct 2 ms 892 KB Output is correct
41 Correct 2 ms 892 KB Output is correct
42 Correct 2 ms 896 KB Output is correct
43 Correct 2 ms 900 KB Output is correct
44 Correct 2 ms 908 KB Output is correct
45 Correct 2 ms 912 KB Output is correct
46 Correct 2 ms 912 KB Output is correct
47 Correct 3 ms 916 KB Output is correct
48 Correct 2 ms 920 KB Output is correct
49 Correct 2 ms 924 KB Output is correct
50 Correct 5 ms 1188 KB Output is correct
51 Correct 5 ms 1192 KB Output is correct
52 Correct 5 ms 1204 KB Output is correct
53 Correct 5 ms 1204 KB Output is correct
54 Correct 4 ms 1204 KB Output is correct
55 Correct 7 ms 1344 KB Output is correct
56 Correct 7 ms 1344 KB Output is correct
57 Correct 6 ms 1344 KB Output is correct
58 Correct 2 ms 1344 KB Output is correct
59 Correct 2 ms 1344 KB Output is correct
60 Correct 2 ms 1344 KB Output is correct
61 Correct 4 ms 1344 KB Output is correct
62 Correct 3 ms 1344 KB Output is correct
63 Correct 2 ms 1344 KB Output is correct
64 Correct 2 ms 1344 KB Output is correct
65 Correct 4 ms 1344 KB Output is correct
66 Correct 2 ms 1344 KB Output is correct
67 Correct 2 ms 1344 KB Output is correct
68 Correct 2 ms 1344 KB Output is correct
69 Correct 2 ms 1344 KB Output is correct
70 Correct 3 ms 1344 KB Output is correct
71 Correct 704 ms 19332 KB Output is correct
72 Correct 455 ms 19332 KB Output is correct
73 Correct 677 ms 19332 KB Output is correct
74 Correct 328 ms 19332 KB Output is correct
75 Correct 391 ms 19332 KB Output is correct
76 Correct 1162 ms 25792 KB Output is correct
77 Correct 923 ms 25792 KB Output is correct
78 Correct 869 ms 25792 KB Output is correct
79 Correct 824 ms 25792 KB Output is correct
80 Correct 2 ms 25792 KB Output is correct
81 Correct 2 ms 25792 KB Output is correct
82 Correct 5 ms 25792 KB Output is correct
83 Correct 70 ms 25792 KB Output is correct
84 Correct 114 ms 25792 KB Output is correct
85 Correct 19 ms 25792 KB Output is correct
86 Correct 2 ms 25792 KB Output is correct
87 Correct 92 ms 25792 KB Output is correct
88 Correct 2 ms 25792 KB Output is correct
89 Correct 2 ms 25792 KB Output is correct
90 Correct 2 ms 25792 KB Output is correct
91 Correct 28 ms 25792 KB Output is correct
92 Correct 138 ms 25792 KB Output is correct
93 Correct 4596 ms 78504 KB Output is correct
94 Correct 2645 ms 78504 KB Output is correct
95 Correct 2978 ms 78504 KB Output is correct
96 Correct 2492 ms 78504 KB Output is correct
97 Correct 2197 ms 78504 KB Output is correct
98 Correct 4950 ms 86660 KB Output is correct
99 Execution timed out 5038 ms 86972 KB Time limit exceeded
100 Halted 0 ms 0 KB -