Submission #78131

# Submission time Handle Problem Language Result Execution time Memory
78131 2018-10-02T14:32:38 Z igzi Toys (CEOI18_toy) C++17
100 / 100
981 ms 51980 KB
#include <bits/stdc++.h>

using namespace std;

long long n,k,r,i,j,a[200],b[200],p,m;
vector <pair<long long,long long>> v;
vector <long long> s;

vector <long long> resi(int n,int p){
  vector <long long> ans,tmp;
  if(p>n) return ans;
  for(int i=p;i*i<=n;i++){
      if(n%i) continue;
      tmp=resi(n/i,i);
      for(int j=0;j<tmp.size();j++){
          ans.push_back(tmp[j]+i-1);
      }
  }
  ans.push_back(n-1);
}


int main() {
    cin>>n;
    if(n==1){
        cout<<1<<endl<<0;
        return 0;
    }
    s=(resi(n,2));
    sort(s.begin(),s.end());
    r=1;
    for(i=1;i<s.size();i++){
        if(s[i]!=s[i-1]) r++;
    }
    cout<<r<<endl;
    cout<<s[0]<<" ";
    for(i=1;i<s.size();i++){
        if(s[i]!=s[i-1]) cout<<s[i]<<" ";
    }
    return 0;
}

Compilation message

toy.cpp: In function 'std::vector<long long int> resi(int, int)':
toy.cpp:15:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for(int j=0;j<tmp.size();j++){
                   ~^~~~~~~~~~~
toy.cpp: In function 'int main()':
toy.cpp:32:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(i=1;i<s.size();i++){
             ~^~~~~~~~~
toy.cpp:37:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(i=1;i<s.size();i++){
             ~^~~~~~~~~
toy.cpp: In function 'std::vector<long long int> resi(int, int)':
toy.cpp:20:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 512 KB Output is correct
3 Correct 2 ms 512 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 2 ms 512 KB Output is correct
6 Correct 3 ms 532 KB Output is correct
7 Correct 2 ms 580 KB Output is correct
8 Correct 2 ms 632 KB Output is correct
9 Correct 2 ms 632 KB Output is correct
10 Correct 2 ms 660 KB Output is correct
11 Correct 2 ms 660 KB Output is correct
12 Correct 2 ms 660 KB Output is correct
13 Correct 2 ms 660 KB Output is correct
14 Correct 2 ms 720 KB Output is correct
15 Correct 2 ms 720 KB Output is correct
16 Correct 2 ms 720 KB Output is correct
17 Correct 2 ms 720 KB Output is correct
18 Correct 2 ms 720 KB Output is correct
19 Correct 2 ms 720 KB Output is correct
20 Correct 2 ms 720 KB Output is correct
21 Correct 2 ms 720 KB Output is correct
22 Correct 2 ms 720 KB Output is correct
23 Correct 2 ms 772 KB Output is correct
24 Correct 2 ms 772 KB Output is correct
25 Correct 2 ms 772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 512 KB Output is correct
3 Correct 2 ms 512 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 2 ms 512 KB Output is correct
6 Correct 3 ms 532 KB Output is correct
7 Correct 2 ms 580 KB Output is correct
8 Correct 2 ms 632 KB Output is correct
9 Correct 2 ms 632 KB Output is correct
10 Correct 2 ms 660 KB Output is correct
11 Correct 2 ms 660 KB Output is correct
12 Correct 2 ms 660 KB Output is correct
13 Correct 2 ms 660 KB Output is correct
14 Correct 2 ms 720 KB Output is correct
15 Correct 2 ms 720 KB Output is correct
16 Correct 2 ms 720 KB Output is correct
17 Correct 2 ms 720 KB Output is correct
18 Correct 2 ms 720 KB Output is correct
19 Correct 2 ms 720 KB Output is correct
20 Correct 2 ms 720 KB Output is correct
21 Correct 2 ms 720 KB Output is correct
22 Correct 2 ms 720 KB Output is correct
23 Correct 2 ms 772 KB Output is correct
24 Correct 2 ms 772 KB Output is correct
25 Correct 2 ms 772 KB Output is correct
26 Correct 2 ms 896 KB Output is correct
27 Correct 2 ms 896 KB Output is correct
28 Correct 2 ms 896 KB Output is correct
29 Correct 2 ms 896 KB Output is correct
30 Correct 2 ms 912 KB Output is correct
31 Correct 2 ms 1052 KB Output is correct
32 Correct 3 ms 1052 KB Output is correct
33 Correct 2 ms 1052 KB Output is correct
34 Correct 2 ms 1052 KB Output is correct
35 Correct 2 ms 1052 KB Output is correct
36 Correct 2 ms 1052 KB Output is correct
37 Correct 2 ms 1052 KB Output is correct
38 Correct 2 ms 1052 KB Output is correct
39 Correct 2 ms 1052 KB Output is correct
40 Correct 2 ms 1124 KB Output is correct
41 Correct 2 ms 1124 KB Output is correct
42 Correct 2 ms 1124 KB Output is correct
43 Correct 2 ms 1124 KB Output is correct
44 Correct 2 ms 1124 KB Output is correct
45 Correct 2 ms 1124 KB Output is correct
46 Correct 2 ms 1124 KB Output is correct
47 Correct 2 ms 1124 KB Output is correct
48 Correct 2 ms 1124 KB Output is correct
49 Correct 2 ms 1124 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 512 KB Output is correct
3 Correct 2 ms 512 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 2 ms 512 KB Output is correct
6 Correct 3 ms 532 KB Output is correct
7 Correct 2 ms 580 KB Output is correct
8 Correct 2 ms 632 KB Output is correct
9 Correct 2 ms 632 KB Output is correct
10 Correct 2 ms 660 KB Output is correct
11 Correct 2 ms 660 KB Output is correct
12 Correct 2 ms 660 KB Output is correct
13 Correct 2 ms 660 KB Output is correct
14 Correct 2 ms 720 KB Output is correct
15 Correct 2 ms 720 KB Output is correct
16 Correct 2 ms 720 KB Output is correct
17 Correct 2 ms 720 KB Output is correct
18 Correct 2 ms 720 KB Output is correct
19 Correct 2 ms 720 KB Output is correct
20 Correct 2 ms 720 KB Output is correct
21 Correct 2 ms 720 KB Output is correct
22 Correct 2 ms 720 KB Output is correct
23 Correct 2 ms 772 KB Output is correct
24 Correct 2 ms 772 KB Output is correct
25 Correct 2 ms 772 KB Output is correct
26 Correct 2 ms 896 KB Output is correct
27 Correct 2 ms 896 KB Output is correct
28 Correct 2 ms 896 KB Output is correct
29 Correct 2 ms 896 KB Output is correct
30 Correct 2 ms 912 KB Output is correct
31 Correct 2 ms 1052 KB Output is correct
32 Correct 3 ms 1052 KB Output is correct
33 Correct 2 ms 1052 KB Output is correct
34 Correct 2 ms 1052 KB Output is correct
35 Correct 2 ms 1052 KB Output is correct
36 Correct 2 ms 1052 KB Output is correct
37 Correct 2 ms 1052 KB Output is correct
38 Correct 2 ms 1052 KB Output is correct
39 Correct 2 ms 1052 KB Output is correct
40 Correct 2 ms 1124 KB Output is correct
41 Correct 2 ms 1124 KB Output is correct
42 Correct 2 ms 1124 KB Output is correct
43 Correct 2 ms 1124 KB Output is correct
44 Correct 2 ms 1124 KB Output is correct
45 Correct 2 ms 1124 KB Output is correct
46 Correct 2 ms 1124 KB Output is correct
47 Correct 2 ms 1124 KB Output is correct
48 Correct 2 ms 1124 KB Output is correct
49 Correct 2 ms 1124 KB Output is correct
50 Correct 3 ms 1124 KB Output is correct
51 Correct 3 ms 1124 KB Output is correct
52 Correct 3 ms 1124 KB Output is correct
53 Correct 2 ms 1124 KB Output is correct
54 Correct 2 ms 1184 KB Output is correct
55 Correct 3 ms 1184 KB Output is correct
56 Correct 3 ms 1184 KB Output is correct
57 Correct 3 ms 1184 KB Output is correct
58 Correct 2 ms 1184 KB Output is correct
59 Correct 2 ms 1184 KB Output is correct
60 Correct 2 ms 1184 KB Output is correct
61 Correct 3 ms 1224 KB Output is correct
62 Correct 2 ms 1232 KB Output is correct
63 Correct 2 ms 1232 KB Output is correct
64 Correct 2 ms 1232 KB Output is correct
65 Correct 2 ms 1232 KB Output is correct
66 Correct 2 ms 1232 KB Output is correct
67 Correct 2 ms 1232 KB Output is correct
68 Correct 2 ms 1232 KB Output is correct
69 Correct 2 ms 1232 KB Output is correct
70 Correct 2 ms 1232 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 512 KB Output is correct
3 Correct 2 ms 512 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 2 ms 512 KB Output is correct
6 Correct 3 ms 532 KB Output is correct
7 Correct 2 ms 580 KB Output is correct
8 Correct 2 ms 632 KB Output is correct
9 Correct 2 ms 632 KB Output is correct
10 Correct 2 ms 660 KB Output is correct
11 Correct 2 ms 660 KB Output is correct
12 Correct 2 ms 660 KB Output is correct
13 Correct 2 ms 660 KB Output is correct
14 Correct 2 ms 720 KB Output is correct
15 Correct 2 ms 720 KB Output is correct
16 Correct 2 ms 720 KB Output is correct
17 Correct 2 ms 720 KB Output is correct
18 Correct 2 ms 720 KB Output is correct
19 Correct 2 ms 720 KB Output is correct
20 Correct 2 ms 720 KB Output is correct
21 Correct 2 ms 720 KB Output is correct
22 Correct 2 ms 720 KB Output is correct
23 Correct 2 ms 772 KB Output is correct
24 Correct 2 ms 772 KB Output is correct
25 Correct 2 ms 772 KB Output is correct
26 Correct 2 ms 896 KB Output is correct
27 Correct 2 ms 896 KB Output is correct
28 Correct 2 ms 896 KB Output is correct
29 Correct 2 ms 896 KB Output is correct
30 Correct 2 ms 912 KB Output is correct
31 Correct 2 ms 1052 KB Output is correct
32 Correct 3 ms 1052 KB Output is correct
33 Correct 2 ms 1052 KB Output is correct
34 Correct 2 ms 1052 KB Output is correct
35 Correct 2 ms 1052 KB Output is correct
36 Correct 2 ms 1052 KB Output is correct
37 Correct 2 ms 1052 KB Output is correct
38 Correct 2 ms 1052 KB Output is correct
39 Correct 2 ms 1052 KB Output is correct
40 Correct 2 ms 1124 KB Output is correct
41 Correct 2 ms 1124 KB Output is correct
42 Correct 2 ms 1124 KB Output is correct
43 Correct 2 ms 1124 KB Output is correct
44 Correct 2 ms 1124 KB Output is correct
45 Correct 2 ms 1124 KB Output is correct
46 Correct 2 ms 1124 KB Output is correct
47 Correct 2 ms 1124 KB Output is correct
48 Correct 2 ms 1124 KB Output is correct
49 Correct 2 ms 1124 KB Output is correct
50 Correct 3 ms 1124 KB Output is correct
51 Correct 3 ms 1124 KB Output is correct
52 Correct 3 ms 1124 KB Output is correct
53 Correct 2 ms 1124 KB Output is correct
54 Correct 2 ms 1184 KB Output is correct
55 Correct 3 ms 1184 KB Output is correct
56 Correct 3 ms 1184 KB Output is correct
57 Correct 3 ms 1184 KB Output is correct
58 Correct 2 ms 1184 KB Output is correct
59 Correct 2 ms 1184 KB Output is correct
60 Correct 2 ms 1184 KB Output is correct
61 Correct 3 ms 1224 KB Output is correct
62 Correct 2 ms 1232 KB Output is correct
63 Correct 2 ms 1232 KB Output is correct
64 Correct 2 ms 1232 KB Output is correct
65 Correct 2 ms 1232 KB Output is correct
66 Correct 2 ms 1232 KB Output is correct
67 Correct 2 ms 1232 KB Output is correct
68 Correct 2 ms 1232 KB Output is correct
69 Correct 2 ms 1232 KB Output is correct
70 Correct 2 ms 1232 KB Output is correct
71 Correct 81 ms 6064 KB Output is correct
72 Correct 54 ms 6064 KB Output is correct
73 Correct 87 ms 6256 KB Output is correct
74 Correct 39 ms 6256 KB Output is correct
75 Correct 50 ms 6256 KB Output is correct
76 Correct 188 ms 11232 KB Output is correct
77 Correct 201 ms 11912 KB Output is correct
78 Correct 125 ms 11912 KB Output is correct
79 Correct 127 ms 11912 KB Output is correct
80 Correct 2 ms 11912 KB Output is correct
81 Correct 2 ms 11912 KB Output is correct
82 Correct 3 ms 11912 KB Output is correct
83 Correct 21 ms 11912 KB Output is correct
84 Correct 20 ms 11912 KB Output is correct
85 Correct 6 ms 11912 KB Output is correct
86 Correct 2 ms 11912 KB Output is correct
87 Correct 22 ms 11912 KB Output is correct
88 Correct 2 ms 11912 KB Output is correct
89 Correct 2 ms 11912 KB Output is correct
90 Correct 3 ms 11912 KB Output is correct
91 Correct 7 ms 11912 KB Output is correct
92 Correct 18 ms 11912 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 512 KB Output is correct
3 Correct 2 ms 512 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 2 ms 512 KB Output is correct
6 Correct 3 ms 532 KB Output is correct
7 Correct 2 ms 580 KB Output is correct
8 Correct 2 ms 632 KB Output is correct
9 Correct 2 ms 632 KB Output is correct
10 Correct 2 ms 660 KB Output is correct
11 Correct 2 ms 660 KB Output is correct
12 Correct 2 ms 660 KB Output is correct
13 Correct 2 ms 660 KB Output is correct
14 Correct 2 ms 720 KB Output is correct
15 Correct 2 ms 720 KB Output is correct
16 Correct 2 ms 720 KB Output is correct
17 Correct 2 ms 720 KB Output is correct
18 Correct 2 ms 720 KB Output is correct
19 Correct 2 ms 720 KB Output is correct
20 Correct 2 ms 720 KB Output is correct
21 Correct 2 ms 720 KB Output is correct
22 Correct 2 ms 720 KB Output is correct
23 Correct 2 ms 772 KB Output is correct
24 Correct 2 ms 772 KB Output is correct
25 Correct 2 ms 772 KB Output is correct
26 Correct 2 ms 896 KB Output is correct
27 Correct 2 ms 896 KB Output is correct
28 Correct 2 ms 896 KB Output is correct
29 Correct 2 ms 896 KB Output is correct
30 Correct 2 ms 912 KB Output is correct
31 Correct 2 ms 1052 KB Output is correct
32 Correct 3 ms 1052 KB Output is correct
33 Correct 2 ms 1052 KB Output is correct
34 Correct 2 ms 1052 KB Output is correct
35 Correct 2 ms 1052 KB Output is correct
36 Correct 2 ms 1052 KB Output is correct
37 Correct 2 ms 1052 KB Output is correct
38 Correct 2 ms 1052 KB Output is correct
39 Correct 2 ms 1052 KB Output is correct
40 Correct 2 ms 1124 KB Output is correct
41 Correct 2 ms 1124 KB Output is correct
42 Correct 2 ms 1124 KB Output is correct
43 Correct 2 ms 1124 KB Output is correct
44 Correct 2 ms 1124 KB Output is correct
45 Correct 2 ms 1124 KB Output is correct
46 Correct 2 ms 1124 KB Output is correct
47 Correct 2 ms 1124 KB Output is correct
48 Correct 2 ms 1124 KB Output is correct
49 Correct 2 ms 1124 KB Output is correct
50 Correct 3 ms 1124 KB Output is correct
51 Correct 3 ms 1124 KB Output is correct
52 Correct 3 ms 1124 KB Output is correct
53 Correct 2 ms 1124 KB Output is correct
54 Correct 2 ms 1184 KB Output is correct
55 Correct 3 ms 1184 KB Output is correct
56 Correct 3 ms 1184 KB Output is correct
57 Correct 3 ms 1184 KB Output is correct
58 Correct 2 ms 1184 KB Output is correct
59 Correct 2 ms 1184 KB Output is correct
60 Correct 2 ms 1184 KB Output is correct
61 Correct 3 ms 1224 KB Output is correct
62 Correct 2 ms 1232 KB Output is correct
63 Correct 2 ms 1232 KB Output is correct
64 Correct 2 ms 1232 KB Output is correct
65 Correct 2 ms 1232 KB Output is correct
66 Correct 2 ms 1232 KB Output is correct
67 Correct 2 ms 1232 KB Output is correct
68 Correct 2 ms 1232 KB Output is correct
69 Correct 2 ms 1232 KB Output is correct
70 Correct 2 ms 1232 KB Output is correct
71 Correct 81 ms 6064 KB Output is correct
72 Correct 54 ms 6064 KB Output is correct
73 Correct 87 ms 6256 KB Output is correct
74 Correct 39 ms 6256 KB Output is correct
75 Correct 50 ms 6256 KB Output is correct
76 Correct 188 ms 11232 KB Output is correct
77 Correct 201 ms 11912 KB Output is correct
78 Correct 125 ms 11912 KB Output is correct
79 Correct 127 ms 11912 KB Output is correct
80 Correct 2 ms 11912 KB Output is correct
81 Correct 2 ms 11912 KB Output is correct
82 Correct 3 ms 11912 KB Output is correct
83 Correct 21 ms 11912 KB Output is correct
84 Correct 20 ms 11912 KB Output is correct
85 Correct 6 ms 11912 KB Output is correct
86 Correct 2 ms 11912 KB Output is correct
87 Correct 22 ms 11912 KB Output is correct
88 Correct 2 ms 11912 KB Output is correct
89 Correct 2 ms 11912 KB Output is correct
90 Correct 3 ms 11912 KB Output is correct
91 Correct 7 ms 11912 KB Output is correct
92 Correct 18 ms 11912 KB Output is correct
93 Correct 591 ms 24032 KB Output is correct
94 Correct 248 ms 24032 KB Output is correct
95 Correct 341 ms 24032 KB Output is correct
96 Correct 283 ms 24032 KB Output is correct
97 Correct 280 ms 24032 KB Output is correct
98 Correct 751 ms 44140 KB Output is correct
99 Correct 896 ms 49236 KB Output is correct
100 Correct 743 ms 49236 KB Output is correct
101 Correct 981 ms 51980 KB Output is correct
102 Correct 815 ms 51980 KB Output is correct
103 Correct 411 ms 51980 KB Output is correct
104 Correct 2 ms 51980 KB Output is correct
105 Correct 2 ms 51980 KB Output is correct
106 Correct 5 ms 51980 KB Output is correct
107 Correct 101 ms 51980 KB Output is correct
108 Correct 160 ms 51980 KB Output is correct
109 Correct 16 ms 51980 KB Output is correct
110 Correct 3 ms 51980 KB Output is correct
111 Correct 75 ms 51980 KB Output is correct
112 Correct 2 ms 51980 KB Output is correct
113 Correct 2 ms 51980 KB Output is correct
114 Correct 6 ms 51980 KB Output is correct
115 Correct 2 ms 51980 KB Output is correct
116 Correct 11 ms 51980 KB Output is correct
117 Correct 81 ms 51980 KB Output is correct