Submission #650491

# Submission time Handle Problem Language Result Execution time Memory
650491 2022-10-14T06:28:12 Z fatemetmhr Toys (CEOI18_toy) C++17
100 / 100
1718 ms 133704 KB
//  ~Be name khoda~  //

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define pb       push_back
#define mp       make_pair
#define all(x)   x.begin(), x.end()
#define fi       first
#define se       second
#define cl       clear
#define endll    '\n'

const int maxn  =  1e6   + 10;
const int maxn5 =  1e6   + 10;
const int maxnt =  1.2e6 + 10;
const int maxn3 =  1e3   + 10;
const int mod   =  1e9   +  7;
const ll  inf   =  2e18;

set <int> av[maxn5];
map <int, int> ind;
int newnode = 0;

inline void solve(int n){
	ind[n] = newnode++;
	int vn = ind[n];
	av[vn].insert(n - 1);
	for(int i = 2; i * i <= n; i++) if(n % i == 0){
		if(ind.find(n / i) == ind.end()) solve(n / i);
		int vi = ind[n / i];
		for(auto it = av[vi].begin(); it != av[vi].end(); it++)
			av[vn].insert((*it) + i - 1);
	}
	return;
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	
	int n; cin >> n;
	solve(n);
	int vn = ind[n];
	cout << av[vn].size() << '\n';
	for(auto it = av[vn].begin(); it != av[vn].end(); it++) cout << *it << ' ';
	cout << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 22 ms 47224 KB Output is correct
2 Correct 22 ms 47232 KB Output is correct
3 Correct 24 ms 47180 KB Output is correct
4 Correct 23 ms 47204 KB Output is correct
5 Correct 25 ms 47316 KB Output is correct
6 Correct 24 ms 47188 KB Output is correct
7 Correct 26 ms 47264 KB Output is correct
8 Correct 27 ms 47276 KB Output is correct
9 Correct 24 ms 47208 KB Output is correct
10 Correct 24 ms 47188 KB Output is correct
11 Correct 25 ms 47212 KB Output is correct
12 Correct 25 ms 47188 KB Output is correct
13 Correct 26 ms 47188 KB Output is correct
14 Correct 23 ms 47188 KB Output is correct
15 Correct 25 ms 47320 KB Output is correct
16 Correct 23 ms 47204 KB Output is correct
17 Correct 23 ms 47188 KB Output is correct
18 Correct 23 ms 47232 KB Output is correct
19 Correct 23 ms 47228 KB Output is correct
20 Correct 28 ms 47188 KB Output is correct
21 Correct 27 ms 47232 KB Output is correct
22 Correct 24 ms 47188 KB Output is correct
23 Correct 23 ms 47268 KB Output is correct
24 Correct 23 ms 47188 KB Output is correct
25 Correct 22 ms 47188 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 47224 KB Output is correct
2 Correct 22 ms 47232 KB Output is correct
3 Correct 24 ms 47180 KB Output is correct
4 Correct 23 ms 47204 KB Output is correct
5 Correct 25 ms 47316 KB Output is correct
6 Correct 24 ms 47188 KB Output is correct
7 Correct 26 ms 47264 KB Output is correct
8 Correct 27 ms 47276 KB Output is correct
9 Correct 24 ms 47208 KB Output is correct
10 Correct 24 ms 47188 KB Output is correct
11 Correct 25 ms 47212 KB Output is correct
12 Correct 25 ms 47188 KB Output is correct
13 Correct 26 ms 47188 KB Output is correct
14 Correct 23 ms 47188 KB Output is correct
15 Correct 25 ms 47320 KB Output is correct
16 Correct 23 ms 47204 KB Output is correct
17 Correct 23 ms 47188 KB Output is correct
18 Correct 23 ms 47232 KB Output is correct
19 Correct 23 ms 47228 KB Output is correct
20 Correct 28 ms 47188 KB Output is correct
21 Correct 27 ms 47232 KB Output is correct
22 Correct 24 ms 47188 KB Output is correct
23 Correct 23 ms 47268 KB Output is correct
24 Correct 23 ms 47188 KB Output is correct
25 Correct 22 ms 47188 KB Output is correct
26 Correct 26 ms 47264 KB Output is correct
27 Correct 25 ms 47248 KB Output is correct
28 Correct 24 ms 47292 KB Output is correct
29 Correct 29 ms 47216 KB Output is correct
30 Correct 26 ms 47296 KB Output is correct
31 Correct 24 ms 47308 KB Output is correct
32 Correct 25 ms 47248 KB Output is correct
33 Correct 24 ms 47292 KB Output is correct
34 Correct 27 ms 47220 KB Output is correct
35 Correct 23 ms 47232 KB Output is correct
36 Correct 25 ms 47232 KB Output is correct
37 Correct 27 ms 47308 KB Output is correct
38 Correct 29 ms 47292 KB Output is correct
39 Correct 24 ms 47188 KB Output is correct
40 Correct 28 ms 47272 KB Output is correct
41 Correct 24 ms 47232 KB Output is correct
42 Correct 24 ms 47280 KB Output is correct
43 Correct 25 ms 47188 KB Output is correct
44 Correct 22 ms 47248 KB Output is correct
45 Correct 24 ms 47288 KB Output is correct
46 Correct 24 ms 47188 KB Output is correct
47 Correct 24 ms 47316 KB Output is correct
48 Correct 24 ms 47192 KB Output is correct
49 Correct 24 ms 47196 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 47224 KB Output is correct
2 Correct 22 ms 47232 KB Output is correct
3 Correct 24 ms 47180 KB Output is correct
4 Correct 23 ms 47204 KB Output is correct
5 Correct 25 ms 47316 KB Output is correct
6 Correct 24 ms 47188 KB Output is correct
7 Correct 26 ms 47264 KB Output is correct
8 Correct 27 ms 47276 KB Output is correct
9 Correct 24 ms 47208 KB Output is correct
10 Correct 24 ms 47188 KB Output is correct
11 Correct 25 ms 47212 KB Output is correct
12 Correct 25 ms 47188 KB Output is correct
13 Correct 26 ms 47188 KB Output is correct
14 Correct 23 ms 47188 KB Output is correct
15 Correct 25 ms 47320 KB Output is correct
16 Correct 23 ms 47204 KB Output is correct
17 Correct 23 ms 47188 KB Output is correct
18 Correct 23 ms 47232 KB Output is correct
19 Correct 23 ms 47228 KB Output is correct
20 Correct 28 ms 47188 KB Output is correct
21 Correct 27 ms 47232 KB Output is correct
22 Correct 24 ms 47188 KB Output is correct
23 Correct 23 ms 47268 KB Output is correct
24 Correct 23 ms 47188 KB Output is correct
25 Correct 22 ms 47188 KB Output is correct
26 Correct 26 ms 47264 KB Output is correct
27 Correct 25 ms 47248 KB Output is correct
28 Correct 24 ms 47292 KB Output is correct
29 Correct 29 ms 47216 KB Output is correct
30 Correct 26 ms 47296 KB Output is correct
31 Correct 24 ms 47308 KB Output is correct
32 Correct 25 ms 47248 KB Output is correct
33 Correct 24 ms 47292 KB Output is correct
34 Correct 27 ms 47220 KB Output is correct
35 Correct 23 ms 47232 KB Output is correct
36 Correct 25 ms 47232 KB Output is correct
37 Correct 27 ms 47308 KB Output is correct
38 Correct 29 ms 47292 KB Output is correct
39 Correct 24 ms 47188 KB Output is correct
40 Correct 28 ms 47272 KB Output is correct
41 Correct 24 ms 47232 KB Output is correct
42 Correct 24 ms 47280 KB Output is correct
43 Correct 25 ms 47188 KB Output is correct
44 Correct 22 ms 47248 KB Output is correct
45 Correct 24 ms 47288 KB Output is correct
46 Correct 24 ms 47188 KB Output is correct
47 Correct 24 ms 47316 KB Output is correct
48 Correct 24 ms 47192 KB Output is correct
49 Correct 24 ms 47196 KB Output is correct
50 Correct 23 ms 47436 KB Output is correct
51 Correct 26 ms 47504 KB Output is correct
52 Correct 27 ms 47504 KB Output is correct
53 Correct 26 ms 47436 KB Output is correct
54 Correct 25 ms 47324 KB Output is correct
55 Correct 26 ms 47672 KB Output is correct
56 Correct 31 ms 47564 KB Output is correct
57 Correct 24 ms 47532 KB Output is correct
58 Correct 23 ms 47268 KB Output is correct
59 Correct 23 ms 47256 KB Output is correct
60 Correct 24 ms 47316 KB Output is correct
61 Correct 27 ms 47444 KB Output is correct
62 Correct 31 ms 47344 KB Output is correct
63 Correct 26 ms 47336 KB Output is correct
64 Correct 24 ms 47244 KB Output is correct
65 Correct 27 ms 47572 KB Output is correct
66 Correct 23 ms 47188 KB Output is correct
67 Correct 24 ms 47288 KB Output is correct
68 Correct 24 ms 47184 KB Output is correct
69 Correct 23 ms 47188 KB Output is correct
70 Correct 25 ms 47364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 47224 KB Output is correct
2 Correct 22 ms 47232 KB Output is correct
3 Correct 24 ms 47180 KB Output is correct
4 Correct 23 ms 47204 KB Output is correct
5 Correct 25 ms 47316 KB Output is correct
6 Correct 24 ms 47188 KB Output is correct
7 Correct 26 ms 47264 KB Output is correct
8 Correct 27 ms 47276 KB Output is correct
9 Correct 24 ms 47208 KB Output is correct
10 Correct 24 ms 47188 KB Output is correct
11 Correct 25 ms 47212 KB Output is correct
12 Correct 25 ms 47188 KB Output is correct
13 Correct 26 ms 47188 KB Output is correct
14 Correct 23 ms 47188 KB Output is correct
15 Correct 25 ms 47320 KB Output is correct
16 Correct 23 ms 47204 KB Output is correct
17 Correct 23 ms 47188 KB Output is correct
18 Correct 23 ms 47232 KB Output is correct
19 Correct 23 ms 47228 KB Output is correct
20 Correct 28 ms 47188 KB Output is correct
21 Correct 27 ms 47232 KB Output is correct
22 Correct 24 ms 47188 KB Output is correct
23 Correct 23 ms 47268 KB Output is correct
24 Correct 23 ms 47188 KB Output is correct
25 Correct 22 ms 47188 KB Output is correct
26 Correct 26 ms 47264 KB Output is correct
27 Correct 25 ms 47248 KB Output is correct
28 Correct 24 ms 47292 KB Output is correct
29 Correct 29 ms 47216 KB Output is correct
30 Correct 26 ms 47296 KB Output is correct
31 Correct 24 ms 47308 KB Output is correct
32 Correct 25 ms 47248 KB Output is correct
33 Correct 24 ms 47292 KB Output is correct
34 Correct 27 ms 47220 KB Output is correct
35 Correct 23 ms 47232 KB Output is correct
36 Correct 25 ms 47232 KB Output is correct
37 Correct 27 ms 47308 KB Output is correct
38 Correct 29 ms 47292 KB Output is correct
39 Correct 24 ms 47188 KB Output is correct
40 Correct 28 ms 47272 KB Output is correct
41 Correct 24 ms 47232 KB Output is correct
42 Correct 24 ms 47280 KB Output is correct
43 Correct 25 ms 47188 KB Output is correct
44 Correct 22 ms 47248 KB Output is correct
45 Correct 24 ms 47288 KB Output is correct
46 Correct 24 ms 47188 KB Output is correct
47 Correct 24 ms 47316 KB Output is correct
48 Correct 24 ms 47192 KB Output is correct
49 Correct 24 ms 47196 KB Output is correct
50 Correct 23 ms 47436 KB Output is correct
51 Correct 26 ms 47504 KB Output is correct
52 Correct 27 ms 47504 KB Output is correct
53 Correct 26 ms 47436 KB Output is correct
54 Correct 25 ms 47324 KB Output is correct
55 Correct 26 ms 47672 KB Output is correct
56 Correct 31 ms 47564 KB Output is correct
57 Correct 24 ms 47532 KB Output is correct
58 Correct 23 ms 47268 KB Output is correct
59 Correct 23 ms 47256 KB Output is correct
60 Correct 24 ms 47316 KB Output is correct
61 Correct 27 ms 47444 KB Output is correct
62 Correct 31 ms 47344 KB Output is correct
63 Correct 26 ms 47336 KB Output is correct
64 Correct 24 ms 47244 KB Output is correct
65 Correct 27 ms 47572 KB Output is correct
66 Correct 23 ms 47188 KB Output is correct
67 Correct 24 ms 47288 KB Output is correct
68 Correct 24 ms 47184 KB Output is correct
69 Correct 23 ms 47188 KB Output is correct
70 Correct 25 ms 47364 KB Output is correct
71 Correct 276 ms 65392 KB Output is correct
72 Correct 192 ms 61004 KB Output is correct
73 Correct 258 ms 63420 KB Output is correct
74 Correct 157 ms 58008 KB Output is correct
75 Correct 164 ms 58692 KB Output is correct
76 Correct 452 ms 71704 KB Output is correct
77 Correct 422 ms 68856 KB Output is correct
78 Correct 418 ms 67540 KB Output is correct
79 Correct 350 ms 66964 KB Output is correct
80 Correct 33 ms 47188 KB Output is correct
81 Correct 34 ms 47256 KB Output is correct
82 Correct 37 ms 47536 KB Output is correct
83 Correct 67 ms 50468 KB Output is correct
84 Correct 78 ms 51240 KB Output is correct
85 Correct 37 ms 48460 KB Output is correct
86 Correct 30 ms 47272 KB Output is correct
87 Correct 84 ms 51884 KB Output is correct
88 Correct 29 ms 47180 KB Output is correct
89 Correct 28 ms 47184 KB Output is correct
90 Correct 29 ms 47180 KB Output is correct
91 Correct 41 ms 48972 KB Output is correct
92 Correct 96 ms 53372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 47224 KB Output is correct
2 Correct 22 ms 47232 KB Output is correct
3 Correct 24 ms 47180 KB Output is correct
4 Correct 23 ms 47204 KB Output is correct
5 Correct 25 ms 47316 KB Output is correct
6 Correct 24 ms 47188 KB Output is correct
7 Correct 26 ms 47264 KB Output is correct
8 Correct 27 ms 47276 KB Output is correct
9 Correct 24 ms 47208 KB Output is correct
10 Correct 24 ms 47188 KB Output is correct
11 Correct 25 ms 47212 KB Output is correct
12 Correct 25 ms 47188 KB Output is correct
13 Correct 26 ms 47188 KB Output is correct
14 Correct 23 ms 47188 KB Output is correct
15 Correct 25 ms 47320 KB Output is correct
16 Correct 23 ms 47204 KB Output is correct
17 Correct 23 ms 47188 KB Output is correct
18 Correct 23 ms 47232 KB Output is correct
19 Correct 23 ms 47228 KB Output is correct
20 Correct 28 ms 47188 KB Output is correct
21 Correct 27 ms 47232 KB Output is correct
22 Correct 24 ms 47188 KB Output is correct
23 Correct 23 ms 47268 KB Output is correct
24 Correct 23 ms 47188 KB Output is correct
25 Correct 22 ms 47188 KB Output is correct
26 Correct 26 ms 47264 KB Output is correct
27 Correct 25 ms 47248 KB Output is correct
28 Correct 24 ms 47292 KB Output is correct
29 Correct 29 ms 47216 KB Output is correct
30 Correct 26 ms 47296 KB Output is correct
31 Correct 24 ms 47308 KB Output is correct
32 Correct 25 ms 47248 KB Output is correct
33 Correct 24 ms 47292 KB Output is correct
34 Correct 27 ms 47220 KB Output is correct
35 Correct 23 ms 47232 KB Output is correct
36 Correct 25 ms 47232 KB Output is correct
37 Correct 27 ms 47308 KB Output is correct
38 Correct 29 ms 47292 KB Output is correct
39 Correct 24 ms 47188 KB Output is correct
40 Correct 28 ms 47272 KB Output is correct
41 Correct 24 ms 47232 KB Output is correct
42 Correct 24 ms 47280 KB Output is correct
43 Correct 25 ms 47188 KB Output is correct
44 Correct 22 ms 47248 KB Output is correct
45 Correct 24 ms 47288 KB Output is correct
46 Correct 24 ms 47188 KB Output is correct
47 Correct 24 ms 47316 KB Output is correct
48 Correct 24 ms 47192 KB Output is correct
49 Correct 24 ms 47196 KB Output is correct
50 Correct 23 ms 47436 KB Output is correct
51 Correct 26 ms 47504 KB Output is correct
52 Correct 27 ms 47504 KB Output is correct
53 Correct 26 ms 47436 KB Output is correct
54 Correct 25 ms 47324 KB Output is correct
55 Correct 26 ms 47672 KB Output is correct
56 Correct 31 ms 47564 KB Output is correct
57 Correct 24 ms 47532 KB Output is correct
58 Correct 23 ms 47268 KB Output is correct
59 Correct 23 ms 47256 KB Output is correct
60 Correct 24 ms 47316 KB Output is correct
61 Correct 27 ms 47444 KB Output is correct
62 Correct 31 ms 47344 KB Output is correct
63 Correct 26 ms 47336 KB Output is correct
64 Correct 24 ms 47244 KB Output is correct
65 Correct 27 ms 47572 KB Output is correct
66 Correct 23 ms 47188 KB Output is correct
67 Correct 24 ms 47288 KB Output is correct
68 Correct 24 ms 47184 KB Output is correct
69 Correct 23 ms 47188 KB Output is correct
70 Correct 25 ms 47364 KB Output is correct
71 Correct 276 ms 65392 KB Output is correct
72 Correct 192 ms 61004 KB Output is correct
73 Correct 258 ms 63420 KB Output is correct
74 Correct 157 ms 58008 KB Output is correct
75 Correct 164 ms 58692 KB Output is correct
76 Correct 452 ms 71704 KB Output is correct
77 Correct 422 ms 68856 KB Output is correct
78 Correct 418 ms 67540 KB Output is correct
79 Correct 350 ms 66964 KB Output is correct
80 Correct 33 ms 47188 KB Output is correct
81 Correct 34 ms 47256 KB Output is correct
82 Correct 37 ms 47536 KB Output is correct
83 Correct 67 ms 50468 KB Output is correct
84 Correct 78 ms 51240 KB Output is correct
85 Correct 37 ms 48460 KB Output is correct
86 Correct 30 ms 47272 KB Output is correct
87 Correct 84 ms 51884 KB Output is correct
88 Correct 29 ms 47180 KB Output is correct
89 Correct 28 ms 47184 KB Output is correct
90 Correct 29 ms 47180 KB Output is correct
91 Correct 41 ms 48972 KB Output is correct
92 Correct 96 ms 53372 KB Output is correct
93 Correct 1521 ms 124184 KB Output is correct
94 Correct 831 ms 98916 KB Output is correct
95 Correct 932 ms 101560 KB Output is correct
96 Correct 823 ms 95688 KB Output is correct
97 Correct 739 ms 91212 KB Output is correct
98 Correct 1660 ms 132108 KB Output is correct
99 Correct 1718 ms 133704 KB Output is correct
100 Correct 1550 ms 130184 KB Output is correct
101 Correct 1468 ms 124240 KB Output is correct
102 Correct 1312 ms 116376 KB Output is correct
103 Correct 1141 ms 109372 KB Output is correct
104 Correct 23 ms 47188 KB Output is correct
105 Correct 26 ms 47232 KB Output is correct
106 Correct 28 ms 47820 KB Output is correct
107 Correct 138 ms 56468 KB Output is correct
108 Correct 294 ms 67260 KB Output is correct
109 Correct 49 ms 50124 KB Output is correct
110 Correct 23 ms 47188 KB Output is correct
111 Correct 169 ms 58956 KB Output is correct
112 Correct 24 ms 47172 KB Output is correct
113 Correct 23 ms 47188 KB Output is correct
114 Correct 30 ms 47832 KB Output is correct
115 Correct 26 ms 47180 KB Output is correct
116 Correct 34 ms 48604 KB Output is correct
117 Correct 301 ms 71416 KB Output is correct