Submission #463440

# Submission time Handle Problem Language Result Execution time Memory
463440 2021-08-11T07:02:12 Z BT21tata Toys (CEOI18_toy) C++17
59 / 100
5000 ms 10492 KB
#include<bits/stdc++.h>
// #pragma GCC target ("avx,avx2,fma")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
typedef long long ll;
typedef long double ld;
#define SPEED ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0)
#define rall(v) (v).rbegin(),(v).rend()
#define all(v) (v).begin(),(v).end()
#define OK cerr<<"OK"<<endl<<flush
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define F first
#define S second
#define y0 jahdakdh
#define y1 jahsadakdakdh
#define endl '\n'
using namespace std;
const ll MOD=1e9+7;
mt19937 rng(std::chrono::system_clock::now().time_since_epoch().count());

set<int> a[100005];

set<int> f(int n)
{
    set<int> ans;
    for(int i=2; i*i<=n; i++)
        if(n%i==0)
        {
            if(n/i<=100000)
            {
                if(!a[n/i].size()) a[n/i]=f(n/i);
                for(int u : a[n/i]) ans.insert(u+i-1);
            }
            else
            {
                set<int> w=f(n/i);
                for(int u : w) ans.insert(u+i-1);    
            }
        }
    ans.insert(n-1);
    return ans;
} 

int main()
{
    SPEED;
    int n;
    cin>>n;
    set<int> s=f(n);
    cout<<s.size()<<endl;
    for(int u : s) cout<<u<<' ';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4940 KB Output is correct
2 Correct 3 ms 4940 KB Output is correct
3 Correct 3 ms 4940 KB Output is correct
4 Correct 3 ms 4940 KB Output is correct
5 Correct 3 ms 4940 KB Output is correct
6 Correct 3 ms 4940 KB Output is correct
7 Correct 3 ms 4940 KB Output is correct
8 Correct 3 ms 4940 KB Output is correct
9 Correct 3 ms 4940 KB Output is correct
10 Correct 3 ms 4940 KB Output is correct
11 Correct 3 ms 4940 KB Output is correct
12 Correct 3 ms 4940 KB Output is correct
13 Correct 4 ms 4912 KB Output is correct
14 Correct 3 ms 4940 KB Output is correct
15 Correct 3 ms 4940 KB Output is correct
16 Correct 3 ms 4940 KB Output is correct
17 Correct 3 ms 4940 KB Output is correct
18 Correct 3 ms 4940 KB Output is correct
19 Correct 3 ms 4940 KB Output is correct
20 Correct 3 ms 4940 KB Output is correct
21 Correct 3 ms 4940 KB Output is correct
22 Correct 3 ms 5008 KB Output is correct
23 Correct 3 ms 4940 KB Output is correct
24 Correct 3 ms 4940 KB Output is correct
25 Correct 3 ms 4940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4940 KB Output is correct
2 Correct 3 ms 4940 KB Output is correct
3 Correct 3 ms 4940 KB Output is correct
4 Correct 3 ms 4940 KB Output is correct
5 Correct 3 ms 4940 KB Output is correct
6 Correct 3 ms 4940 KB Output is correct
7 Correct 3 ms 4940 KB Output is correct
8 Correct 3 ms 4940 KB Output is correct
9 Correct 3 ms 4940 KB Output is correct
10 Correct 3 ms 4940 KB Output is correct
11 Correct 3 ms 4940 KB Output is correct
12 Correct 3 ms 4940 KB Output is correct
13 Correct 4 ms 4912 KB Output is correct
14 Correct 3 ms 4940 KB Output is correct
15 Correct 3 ms 4940 KB Output is correct
16 Correct 3 ms 4940 KB Output is correct
17 Correct 3 ms 4940 KB Output is correct
18 Correct 3 ms 4940 KB Output is correct
19 Correct 3 ms 4940 KB Output is correct
20 Correct 3 ms 4940 KB Output is correct
21 Correct 3 ms 4940 KB Output is correct
22 Correct 3 ms 5008 KB Output is correct
23 Correct 3 ms 4940 KB Output is correct
24 Correct 3 ms 4940 KB Output is correct
25 Correct 3 ms 4940 KB Output is correct
26 Correct 3 ms 5068 KB Output is correct
27 Correct 3 ms 5068 KB Output is correct
28 Correct 3 ms 4940 KB Output is correct
29 Correct 3 ms 4940 KB Output is correct
30 Correct 3 ms 4940 KB Output is correct
31 Correct 4 ms 5068 KB Output is correct
32 Correct 3 ms 5068 KB Output is correct
33 Correct 3 ms 5068 KB Output is correct
34 Correct 3 ms 4940 KB Output is correct
35 Correct 3 ms 4940 KB Output is correct
36 Correct 4 ms 4940 KB Output is correct
37 Correct 3 ms 4940 KB Output is correct
38 Correct 3 ms 4940 KB Output is correct
39 Correct 3 ms 4940 KB Output is correct
40 Correct 3 ms 4940 KB Output is correct
41 Correct 3 ms 4940 KB Output is correct
42 Correct 3 ms 4940 KB Output is correct
43 Correct 3 ms 4940 KB Output is correct
44 Correct 3 ms 4940 KB Output is correct
45 Correct 3 ms 4940 KB Output is correct
46 Correct 3 ms 4940 KB Output is correct
47 Correct 3 ms 4940 KB Output is correct
48 Correct 3 ms 4940 KB Output is correct
49 Correct 3 ms 4940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4940 KB Output is correct
2 Correct 3 ms 4940 KB Output is correct
3 Correct 3 ms 4940 KB Output is correct
4 Correct 3 ms 4940 KB Output is correct
5 Correct 3 ms 4940 KB Output is correct
6 Correct 3 ms 4940 KB Output is correct
7 Correct 3 ms 4940 KB Output is correct
8 Correct 3 ms 4940 KB Output is correct
9 Correct 3 ms 4940 KB Output is correct
10 Correct 3 ms 4940 KB Output is correct
11 Correct 3 ms 4940 KB Output is correct
12 Correct 3 ms 4940 KB Output is correct
13 Correct 4 ms 4912 KB Output is correct
14 Correct 3 ms 4940 KB Output is correct
15 Correct 3 ms 4940 KB Output is correct
16 Correct 3 ms 4940 KB Output is correct
17 Correct 3 ms 4940 KB Output is correct
18 Correct 3 ms 4940 KB Output is correct
19 Correct 3 ms 4940 KB Output is correct
20 Correct 3 ms 4940 KB Output is correct
21 Correct 3 ms 4940 KB Output is correct
22 Correct 3 ms 5008 KB Output is correct
23 Correct 3 ms 4940 KB Output is correct
24 Correct 3 ms 4940 KB Output is correct
25 Correct 3 ms 4940 KB Output is correct
26 Correct 3 ms 5068 KB Output is correct
27 Correct 3 ms 5068 KB Output is correct
28 Correct 3 ms 4940 KB Output is correct
29 Correct 3 ms 4940 KB Output is correct
30 Correct 3 ms 4940 KB Output is correct
31 Correct 4 ms 5068 KB Output is correct
32 Correct 3 ms 5068 KB Output is correct
33 Correct 3 ms 5068 KB Output is correct
34 Correct 3 ms 4940 KB Output is correct
35 Correct 3 ms 4940 KB Output is correct
36 Correct 4 ms 4940 KB Output is correct
37 Correct 3 ms 4940 KB Output is correct
38 Correct 3 ms 4940 KB Output is correct
39 Correct 3 ms 4940 KB Output is correct
40 Correct 3 ms 4940 KB Output is correct
41 Correct 3 ms 4940 KB Output is correct
42 Correct 3 ms 4940 KB Output is correct
43 Correct 3 ms 4940 KB Output is correct
44 Correct 3 ms 4940 KB Output is correct
45 Correct 3 ms 4940 KB Output is correct
46 Correct 3 ms 4940 KB Output is correct
47 Correct 3 ms 4940 KB Output is correct
48 Correct 3 ms 4940 KB Output is correct
49 Correct 3 ms 4940 KB Output is correct
50 Correct 5 ms 5196 KB Output is correct
51 Correct 4 ms 5196 KB Output is correct
52 Correct 5 ms 5196 KB Output is correct
53 Correct 4 ms 5188 KB Output is correct
54 Correct 4 ms 5068 KB Output is correct
55 Correct 6 ms 5324 KB Output is correct
56 Correct 6 ms 5324 KB Output is correct
57 Correct 5 ms 5324 KB Output is correct
58 Correct 3 ms 4896 KB Output is correct
59 Correct 3 ms 4940 KB Output is correct
60 Correct 3 ms 4940 KB Output is correct
61 Correct 4 ms 5196 KB Output is correct
62 Correct 4 ms 5068 KB Output is correct
63 Correct 3 ms 5068 KB Output is correct
64 Correct 3 ms 4940 KB Output is correct
65 Correct 4 ms 5196 KB Output is correct
66 Correct 3 ms 4940 KB Output is correct
67 Correct 3 ms 4940 KB Output is correct
68 Correct 3 ms 4940 KB Output is correct
69 Correct 3 ms 4940 KB Output is correct
70 Correct 4 ms 5068 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4940 KB Output is correct
2 Correct 3 ms 4940 KB Output is correct
3 Correct 3 ms 4940 KB Output is correct
4 Correct 3 ms 4940 KB Output is correct
5 Correct 3 ms 4940 KB Output is correct
6 Correct 3 ms 4940 KB Output is correct
7 Correct 3 ms 4940 KB Output is correct
8 Correct 3 ms 4940 KB Output is correct
9 Correct 3 ms 4940 KB Output is correct
10 Correct 3 ms 4940 KB Output is correct
11 Correct 3 ms 4940 KB Output is correct
12 Correct 3 ms 4940 KB Output is correct
13 Correct 4 ms 4912 KB Output is correct
14 Correct 3 ms 4940 KB Output is correct
15 Correct 3 ms 4940 KB Output is correct
16 Correct 3 ms 4940 KB Output is correct
17 Correct 3 ms 4940 KB Output is correct
18 Correct 3 ms 4940 KB Output is correct
19 Correct 3 ms 4940 KB Output is correct
20 Correct 3 ms 4940 KB Output is correct
21 Correct 3 ms 4940 KB Output is correct
22 Correct 3 ms 5008 KB Output is correct
23 Correct 3 ms 4940 KB Output is correct
24 Correct 3 ms 4940 KB Output is correct
25 Correct 3 ms 4940 KB Output is correct
26 Correct 3 ms 5068 KB Output is correct
27 Correct 3 ms 5068 KB Output is correct
28 Correct 3 ms 4940 KB Output is correct
29 Correct 3 ms 4940 KB Output is correct
30 Correct 3 ms 4940 KB Output is correct
31 Correct 4 ms 5068 KB Output is correct
32 Correct 3 ms 5068 KB Output is correct
33 Correct 3 ms 5068 KB Output is correct
34 Correct 3 ms 4940 KB Output is correct
35 Correct 3 ms 4940 KB Output is correct
36 Correct 4 ms 4940 KB Output is correct
37 Correct 3 ms 4940 KB Output is correct
38 Correct 3 ms 4940 KB Output is correct
39 Correct 3 ms 4940 KB Output is correct
40 Correct 3 ms 4940 KB Output is correct
41 Correct 3 ms 4940 KB Output is correct
42 Correct 3 ms 4940 KB Output is correct
43 Correct 3 ms 4940 KB Output is correct
44 Correct 3 ms 4940 KB Output is correct
45 Correct 3 ms 4940 KB Output is correct
46 Correct 3 ms 4940 KB Output is correct
47 Correct 3 ms 4940 KB Output is correct
48 Correct 3 ms 4940 KB Output is correct
49 Correct 3 ms 4940 KB Output is correct
50 Correct 5 ms 5196 KB Output is correct
51 Correct 4 ms 5196 KB Output is correct
52 Correct 5 ms 5196 KB Output is correct
53 Correct 4 ms 5188 KB Output is correct
54 Correct 4 ms 5068 KB Output is correct
55 Correct 6 ms 5324 KB Output is correct
56 Correct 6 ms 5324 KB Output is correct
57 Correct 5 ms 5324 KB Output is correct
58 Correct 3 ms 4896 KB Output is correct
59 Correct 3 ms 4940 KB Output is correct
60 Correct 3 ms 4940 KB Output is correct
61 Correct 4 ms 5196 KB Output is correct
62 Correct 4 ms 5068 KB Output is correct
63 Correct 3 ms 5068 KB Output is correct
64 Correct 3 ms 4940 KB Output is correct
65 Correct 4 ms 5196 KB Output is correct
66 Correct 3 ms 4940 KB Output is correct
67 Correct 3 ms 4940 KB Output is correct
68 Correct 3 ms 4940 KB Output is correct
69 Correct 3 ms 4940 KB Output is correct
70 Correct 4 ms 5068 KB Output is correct
71 Correct 4160 ms 9492 KB Output is correct
72 Correct 1838 ms 8596 KB Output is correct
73 Correct 3970 ms 9560 KB Output is correct
74 Correct 1088 ms 8216 KB Output is correct
75 Correct 1523 ms 8640 KB Output is correct
76 Execution timed out 5057 ms 10492 KB Time limit exceeded
77 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4940 KB Output is correct
2 Correct 3 ms 4940 KB Output is correct
3 Correct 3 ms 4940 KB Output is correct
4 Correct 3 ms 4940 KB Output is correct
5 Correct 3 ms 4940 KB Output is correct
6 Correct 3 ms 4940 KB Output is correct
7 Correct 3 ms 4940 KB Output is correct
8 Correct 3 ms 4940 KB Output is correct
9 Correct 3 ms 4940 KB Output is correct
10 Correct 3 ms 4940 KB Output is correct
11 Correct 3 ms 4940 KB Output is correct
12 Correct 3 ms 4940 KB Output is correct
13 Correct 4 ms 4912 KB Output is correct
14 Correct 3 ms 4940 KB Output is correct
15 Correct 3 ms 4940 KB Output is correct
16 Correct 3 ms 4940 KB Output is correct
17 Correct 3 ms 4940 KB Output is correct
18 Correct 3 ms 4940 KB Output is correct
19 Correct 3 ms 4940 KB Output is correct
20 Correct 3 ms 4940 KB Output is correct
21 Correct 3 ms 4940 KB Output is correct
22 Correct 3 ms 5008 KB Output is correct
23 Correct 3 ms 4940 KB Output is correct
24 Correct 3 ms 4940 KB Output is correct
25 Correct 3 ms 4940 KB Output is correct
26 Correct 3 ms 5068 KB Output is correct
27 Correct 3 ms 5068 KB Output is correct
28 Correct 3 ms 4940 KB Output is correct
29 Correct 3 ms 4940 KB Output is correct
30 Correct 3 ms 4940 KB Output is correct
31 Correct 4 ms 5068 KB Output is correct
32 Correct 3 ms 5068 KB Output is correct
33 Correct 3 ms 5068 KB Output is correct
34 Correct 3 ms 4940 KB Output is correct
35 Correct 3 ms 4940 KB Output is correct
36 Correct 4 ms 4940 KB Output is correct
37 Correct 3 ms 4940 KB Output is correct
38 Correct 3 ms 4940 KB Output is correct
39 Correct 3 ms 4940 KB Output is correct
40 Correct 3 ms 4940 KB Output is correct
41 Correct 3 ms 4940 KB Output is correct
42 Correct 3 ms 4940 KB Output is correct
43 Correct 3 ms 4940 KB Output is correct
44 Correct 3 ms 4940 KB Output is correct
45 Correct 3 ms 4940 KB Output is correct
46 Correct 3 ms 4940 KB Output is correct
47 Correct 3 ms 4940 KB Output is correct
48 Correct 3 ms 4940 KB Output is correct
49 Correct 3 ms 4940 KB Output is correct
50 Correct 5 ms 5196 KB Output is correct
51 Correct 4 ms 5196 KB Output is correct
52 Correct 5 ms 5196 KB Output is correct
53 Correct 4 ms 5188 KB Output is correct
54 Correct 4 ms 5068 KB Output is correct
55 Correct 6 ms 5324 KB Output is correct
56 Correct 6 ms 5324 KB Output is correct
57 Correct 5 ms 5324 KB Output is correct
58 Correct 3 ms 4896 KB Output is correct
59 Correct 3 ms 4940 KB Output is correct
60 Correct 3 ms 4940 KB Output is correct
61 Correct 4 ms 5196 KB Output is correct
62 Correct 4 ms 5068 KB Output is correct
63 Correct 3 ms 5068 KB Output is correct
64 Correct 3 ms 4940 KB Output is correct
65 Correct 4 ms 5196 KB Output is correct
66 Correct 3 ms 4940 KB Output is correct
67 Correct 3 ms 4940 KB Output is correct
68 Correct 3 ms 4940 KB Output is correct
69 Correct 3 ms 4940 KB Output is correct
70 Correct 4 ms 5068 KB Output is correct
71 Correct 4160 ms 9492 KB Output is correct
72 Correct 1838 ms 8596 KB Output is correct
73 Correct 3970 ms 9560 KB Output is correct
74 Correct 1088 ms 8216 KB Output is correct
75 Correct 1523 ms 8640 KB Output is correct
76 Execution timed out 5057 ms 10492 KB Time limit exceeded
77 Halted 0 ms 0 KB -