Submission #666404

# Submission time Handle Problem Language Result Execution time Memory
666404 2022-11-28T13:39:26 Z ktkerem Toys (CEOI18_toy) C++17
100 / 100
2289 ms 86548 KB
/*#pragma GCC target ("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")/**/
#include<bits/stdc++.h>
/**/
typedef int ll;
//typedef long long ll;
typedef unsigned long long ull;
typedef std::string str;
/*typedef __int128 vll;
typedef unsigned __int128 uvll;*/
#define llll std::pair<ll , ll>
#define pb push_back
#define pf push_front
#define halo cout << "hello\n"
#define fi first
#define sec second
#define all(a) a.begin() , a.end()
const ll limit = 1e9+7; 
const ll ous = 1e5 + 7;
const ll dx[4] = {-1 , 0 , 1 , 0} , dy[4] = {0,1,0,-1};
ll n , m;std::vector<ll> ar;
void solve(){
    std::cin >> n;
    std::vector<ll> dv;
    for(ll i = 1;n>=i*i;i++){
        if(n % i == 0){
            dv.pb(i);
            if(n/i != i){
                dv.pb(n/i);
            }
        }
    }
    std::sort(all(dv));
    std::vector<std::set<ll>> v;
    v.resize(dv.size());
    v[0].insert(0);
    for(ll i = 0;dv.size()>i;i++){
        for(ll j = 0;i>j;j++){
            if(dv[i] % dv[j] == 0){
                for(auto k:v[j]){
                    v[i].insert(k + dv[i]/dv[j] - 1);
                }
            }
        }
    }
    std::cout << v[dv.size()-1].size() << "\n";
    for(auto j:v[dv.size()-1]){
        std::cout << j << " ";
    }
    std::cout << "\n";
    return;/**/
}
signed main(){
    ll t=1;
    //std::cin >> t;
    ll o = 1;
    while(t--){ 
        //cout << "Case " << o++ << ":\n";
        solve();
    }
    return 0;
}/**/

Compilation message

toy.cpp:5:78: warning: "/*" within comment [-Wcomment]
    5 | #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")/**/
      |                                                                               
toy.cpp: In function 'void solve()':
toy.cpp:40:27: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'll' {aka 'int'} [-Wsign-compare]
   40 |     for(ll i = 0;dv.size()>i;i++){
      |                  ~~~~~~~~~^~
toy.cpp: In function 'int main()':
toy.cpp:59:8: warning: unused variable 'o' [-Wunused-variable]
   59 |     ll o = 1;
      |        ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 300 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 300 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 296 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 296 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 0 ms 300 KB Output is correct
36 Correct 1 ms 296 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 1 ms 212 KB Output is correct
39 Correct 1 ms 296 KB Output is correct
40 Correct 1 ms 296 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 1 ms 212 KB Output is correct
44 Correct 0 ms 212 KB Output is correct
45 Correct 1 ms 212 KB Output is correct
46 Correct 1 ms 212 KB Output is correct
47 Correct 1 ms 296 KB Output is correct
48 Correct 1 ms 304 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 300 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 296 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 296 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 0 ms 300 KB Output is correct
36 Correct 1 ms 296 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 1 ms 212 KB Output is correct
39 Correct 1 ms 296 KB Output is correct
40 Correct 1 ms 296 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 1 ms 212 KB Output is correct
44 Correct 0 ms 212 KB Output is correct
45 Correct 1 ms 212 KB Output is correct
46 Correct 1 ms 212 KB Output is correct
47 Correct 1 ms 296 KB Output is correct
48 Correct 1 ms 304 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 3 ms 560 KB Output is correct
51 Correct 2 ms 468 KB Output is correct
52 Correct 2 ms 468 KB Output is correct
53 Correct 2 ms 468 KB Output is correct
54 Correct 1 ms 340 KB Output is correct
55 Correct 4 ms 596 KB Output is correct
56 Correct 4 ms 596 KB Output is correct
57 Correct 3 ms 596 KB Output is correct
58 Correct 0 ms 212 KB Output is correct
59 Correct 1 ms 212 KB Output is correct
60 Correct 1 ms 340 KB Output is correct
61 Correct 2 ms 468 KB Output is correct
62 Correct 1 ms 304 KB Output is correct
63 Correct 1 ms 304 KB Output is correct
64 Correct 1 ms 300 KB Output is correct
65 Correct 2 ms 468 KB Output is correct
66 Correct 0 ms 296 KB Output is correct
67 Correct 0 ms 212 KB Output is correct
68 Correct 1 ms 300 KB Output is correct
69 Correct 1 ms 212 KB Output is correct
70 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 300 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 296 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 296 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 0 ms 300 KB Output is correct
36 Correct 1 ms 296 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 1 ms 212 KB Output is correct
39 Correct 1 ms 296 KB Output is correct
40 Correct 1 ms 296 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 1 ms 212 KB Output is correct
44 Correct 0 ms 212 KB Output is correct
45 Correct 1 ms 212 KB Output is correct
46 Correct 1 ms 212 KB Output is correct
47 Correct 1 ms 296 KB Output is correct
48 Correct 1 ms 304 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 3 ms 560 KB Output is correct
51 Correct 2 ms 468 KB Output is correct
52 Correct 2 ms 468 KB Output is correct
53 Correct 2 ms 468 KB Output is correct
54 Correct 1 ms 340 KB Output is correct
55 Correct 4 ms 596 KB Output is correct
56 Correct 4 ms 596 KB Output is correct
57 Correct 3 ms 596 KB Output is correct
58 Correct 0 ms 212 KB Output is correct
59 Correct 1 ms 212 KB Output is correct
60 Correct 1 ms 340 KB Output is correct
61 Correct 2 ms 468 KB Output is correct
62 Correct 1 ms 304 KB Output is correct
63 Correct 1 ms 304 KB Output is correct
64 Correct 1 ms 300 KB Output is correct
65 Correct 2 ms 468 KB Output is correct
66 Correct 0 ms 296 KB Output is correct
67 Correct 0 ms 212 KB Output is correct
68 Correct 1 ms 300 KB Output is correct
69 Correct 1 ms 212 KB Output is correct
70 Correct 1 ms 340 KB Output is correct
71 Correct 311 ms 18444 KB Output is correct
72 Correct 205 ms 13996 KB Output is correct
73 Correct 294 ms 16556 KB Output is correct
74 Correct 162 ms 10960 KB Output is correct
75 Correct 181 ms 11800 KB Output is correct
76 Correct 541 ms 24704 KB Output is correct
77 Correct 440 ms 21884 KB Output is correct
78 Correct 393 ms 20468 KB Output is correct
79 Correct 382 ms 20012 KB Output is correct
80 Correct 1 ms 212 KB Output is correct
81 Correct 1 ms 212 KB Output is correct
82 Correct 3 ms 596 KB Output is correct
83 Correct 38 ms 3504 KB Output is correct
84 Correct 64 ms 4280 KB Output is correct
85 Correct 11 ms 1492 KB Output is correct
86 Correct 1 ms 212 KB Output is correct
87 Correct 68 ms 4920 KB Output is correct
88 Correct 1 ms 212 KB Output is correct
89 Correct 1 ms 212 KB Output is correct
90 Correct 1 ms 212 KB Output is correct
91 Correct 15 ms 2092 KB Output is correct
92 Correct 68 ms 6476 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 300 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 296 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 296 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 0 ms 300 KB Output is correct
36 Correct 1 ms 296 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 1 ms 212 KB Output is correct
39 Correct 1 ms 296 KB Output is correct
40 Correct 1 ms 296 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 1 ms 212 KB Output is correct
44 Correct 0 ms 212 KB Output is correct
45 Correct 1 ms 212 KB Output is correct
46 Correct 1 ms 212 KB Output is correct
47 Correct 1 ms 296 KB Output is correct
48 Correct 1 ms 304 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 3 ms 560 KB Output is correct
51 Correct 2 ms 468 KB Output is correct
52 Correct 2 ms 468 KB Output is correct
53 Correct 2 ms 468 KB Output is correct
54 Correct 1 ms 340 KB Output is correct
55 Correct 4 ms 596 KB Output is correct
56 Correct 4 ms 596 KB Output is correct
57 Correct 3 ms 596 KB Output is correct
58 Correct 0 ms 212 KB Output is correct
59 Correct 1 ms 212 KB Output is correct
60 Correct 1 ms 340 KB Output is correct
61 Correct 2 ms 468 KB Output is correct
62 Correct 1 ms 304 KB Output is correct
63 Correct 1 ms 304 KB Output is correct
64 Correct 1 ms 300 KB Output is correct
65 Correct 2 ms 468 KB Output is correct
66 Correct 0 ms 296 KB Output is correct
67 Correct 0 ms 212 KB Output is correct
68 Correct 1 ms 300 KB Output is correct
69 Correct 1 ms 212 KB Output is correct
70 Correct 1 ms 340 KB Output is correct
71 Correct 311 ms 18444 KB Output is correct
72 Correct 205 ms 13996 KB Output is correct
73 Correct 294 ms 16556 KB Output is correct
74 Correct 162 ms 10960 KB Output is correct
75 Correct 181 ms 11800 KB Output is correct
76 Correct 541 ms 24704 KB Output is correct
77 Correct 440 ms 21884 KB Output is correct
78 Correct 393 ms 20468 KB Output is correct
79 Correct 382 ms 20012 KB Output is correct
80 Correct 1 ms 212 KB Output is correct
81 Correct 1 ms 212 KB Output is correct
82 Correct 3 ms 596 KB Output is correct
83 Correct 38 ms 3504 KB Output is correct
84 Correct 64 ms 4280 KB Output is correct
85 Correct 11 ms 1492 KB Output is correct
86 Correct 1 ms 212 KB Output is correct
87 Correct 68 ms 4920 KB Output is correct
88 Correct 1 ms 212 KB Output is correct
89 Correct 1 ms 212 KB Output is correct
90 Correct 1 ms 212 KB Output is correct
91 Correct 15 ms 2092 KB Output is correct
92 Correct 68 ms 6476 KB Output is correct
93 Correct 1940 ms 77248 KB Output is correct
94 Correct 1040 ms 51988 KB Output is correct
95 Correct 1236 ms 54580 KB Output is correct
96 Correct 1076 ms 48708 KB Output is correct
97 Correct 984 ms 44400 KB Output is correct
98 Correct 2161 ms 85192 KB Output is correct
99 Correct 2289 ms 86548 KB Output is correct
100 Correct 2146 ms 83432 KB Output is correct
101 Correct 1996 ms 77044 KB Output is correct
102 Correct 1737 ms 69340 KB Output is correct
103 Correct 1414 ms 62148 KB Output is correct
104 Correct 1 ms 336 KB Output is correct
105 Correct 1 ms 212 KB Output is correct
106 Correct 5 ms 812 KB Output is correct
107 Correct 134 ms 9392 KB Output is correct
108 Correct 408 ms 20324 KB Output is correct
109 Correct 29 ms 3148 KB Output is correct
110 Correct 1 ms 300 KB Output is correct
111 Correct 174 ms 12068 KB Output is correct
112 Correct 1 ms 212 KB Output is correct
113 Correct 1 ms 212 KB Output is correct
114 Correct 7 ms 852 KB Output is correct
115 Correct 1 ms 300 KB Output is correct
116 Correct 14 ms 1576 KB Output is correct
117 Correct 354 ms 24508 KB Output is correct