답안 #463441

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
463441 2021-08-11T07:03:34 Z BT21tata Toys (CEOI18_toy) C++17
79 / 100
5000 ms 62960 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[1000005];

set<int> f(int n)
{
    set<int> ans;
    for(int i=2; i*i<=n; i++)
        if(n%i==0)
        {
            if(n/i<=1000000)
            {
                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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 47180 KB Output is correct
2 Correct 25 ms 47200 KB Output is correct
3 Correct 31 ms 47276 KB Output is correct
4 Correct 27 ms 47180 KB Output is correct
5 Correct 26 ms 47260 KB Output is correct
6 Correct 29 ms 47180 KB Output is correct
7 Correct 27 ms 47260 KB Output is correct
8 Correct 26 ms 47208 KB Output is correct
9 Correct 28 ms 47224 KB Output is correct
10 Correct 26 ms 47180 KB Output is correct
11 Correct 25 ms 47248 KB Output is correct
12 Correct 25 ms 47288 KB Output is correct
13 Correct 25 ms 47256 KB Output is correct
14 Correct 27 ms 47236 KB Output is correct
15 Correct 26 ms 47176 KB Output is correct
16 Correct 25 ms 47248 KB Output is correct
17 Correct 26 ms 47180 KB Output is correct
18 Correct 26 ms 47208 KB Output is correct
19 Correct 25 ms 47180 KB Output is correct
20 Correct 25 ms 47276 KB Output is correct
21 Correct 25 ms 47280 KB Output is correct
22 Correct 26 ms 47268 KB Output is correct
23 Correct 26 ms 47280 KB Output is correct
24 Correct 26 ms 47224 KB Output is correct
25 Correct 26 ms 47180 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 47180 KB Output is correct
2 Correct 25 ms 47200 KB Output is correct
3 Correct 31 ms 47276 KB Output is correct
4 Correct 27 ms 47180 KB Output is correct
5 Correct 26 ms 47260 KB Output is correct
6 Correct 29 ms 47180 KB Output is correct
7 Correct 27 ms 47260 KB Output is correct
8 Correct 26 ms 47208 KB Output is correct
9 Correct 28 ms 47224 KB Output is correct
10 Correct 26 ms 47180 KB Output is correct
11 Correct 25 ms 47248 KB Output is correct
12 Correct 25 ms 47288 KB Output is correct
13 Correct 25 ms 47256 KB Output is correct
14 Correct 27 ms 47236 KB Output is correct
15 Correct 26 ms 47176 KB Output is correct
16 Correct 25 ms 47248 KB Output is correct
17 Correct 26 ms 47180 KB Output is correct
18 Correct 26 ms 47208 KB Output is correct
19 Correct 25 ms 47180 KB Output is correct
20 Correct 25 ms 47276 KB Output is correct
21 Correct 25 ms 47280 KB Output is correct
22 Correct 26 ms 47268 KB Output is correct
23 Correct 26 ms 47280 KB Output is correct
24 Correct 26 ms 47224 KB Output is correct
25 Correct 26 ms 47180 KB Output is correct
26 Correct 25 ms 47328 KB Output is correct
27 Correct 26 ms 47336 KB Output is correct
28 Correct 26 ms 47308 KB Output is correct
29 Correct 25 ms 47180 KB Output is correct
30 Correct 25 ms 47200 KB Output is correct
31 Correct 26 ms 47336 KB Output is correct
32 Correct 26 ms 47344 KB Output is correct
33 Correct 30 ms 47280 KB Output is correct
34 Correct 25 ms 47280 KB Output is correct
35 Correct 25 ms 47160 KB Output is correct
36 Correct 26 ms 47200 KB Output is correct
37 Correct 25 ms 47308 KB Output is correct
38 Correct 25 ms 47256 KB Output is correct
39 Correct 26 ms 47228 KB Output is correct
40 Correct 26 ms 47296 KB Output is correct
41 Correct 25 ms 47200 KB Output is correct
42 Correct 25 ms 47268 KB Output is correct
43 Correct 26 ms 47256 KB Output is correct
44 Correct 25 ms 47172 KB Output is correct
45 Correct 25 ms 47244 KB Output is correct
46 Correct 25 ms 47172 KB Output is correct
47 Correct 25 ms 47292 KB Output is correct
48 Correct 28 ms 47172 KB Output is correct
49 Correct 30 ms 47180 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 47180 KB Output is correct
2 Correct 25 ms 47200 KB Output is correct
3 Correct 31 ms 47276 KB Output is correct
4 Correct 27 ms 47180 KB Output is correct
5 Correct 26 ms 47260 KB Output is correct
6 Correct 29 ms 47180 KB Output is correct
7 Correct 27 ms 47260 KB Output is correct
8 Correct 26 ms 47208 KB Output is correct
9 Correct 28 ms 47224 KB Output is correct
10 Correct 26 ms 47180 KB Output is correct
11 Correct 25 ms 47248 KB Output is correct
12 Correct 25 ms 47288 KB Output is correct
13 Correct 25 ms 47256 KB Output is correct
14 Correct 27 ms 47236 KB Output is correct
15 Correct 26 ms 47176 KB Output is correct
16 Correct 25 ms 47248 KB Output is correct
17 Correct 26 ms 47180 KB Output is correct
18 Correct 26 ms 47208 KB Output is correct
19 Correct 25 ms 47180 KB Output is correct
20 Correct 25 ms 47276 KB Output is correct
21 Correct 25 ms 47280 KB Output is correct
22 Correct 26 ms 47268 KB Output is correct
23 Correct 26 ms 47280 KB Output is correct
24 Correct 26 ms 47224 KB Output is correct
25 Correct 26 ms 47180 KB Output is correct
26 Correct 25 ms 47328 KB Output is correct
27 Correct 26 ms 47336 KB Output is correct
28 Correct 26 ms 47308 KB Output is correct
29 Correct 25 ms 47180 KB Output is correct
30 Correct 25 ms 47200 KB Output is correct
31 Correct 26 ms 47336 KB Output is correct
32 Correct 26 ms 47344 KB Output is correct
33 Correct 30 ms 47280 KB Output is correct
34 Correct 25 ms 47280 KB Output is correct
35 Correct 25 ms 47160 KB Output is correct
36 Correct 26 ms 47200 KB Output is correct
37 Correct 25 ms 47308 KB Output is correct
38 Correct 25 ms 47256 KB Output is correct
39 Correct 26 ms 47228 KB Output is correct
40 Correct 26 ms 47296 KB Output is correct
41 Correct 25 ms 47200 KB Output is correct
42 Correct 25 ms 47268 KB Output is correct
43 Correct 26 ms 47256 KB Output is correct
44 Correct 25 ms 47172 KB Output is correct
45 Correct 25 ms 47244 KB Output is correct
46 Correct 25 ms 47172 KB Output is correct
47 Correct 25 ms 47292 KB Output is correct
48 Correct 28 ms 47172 KB Output is correct
49 Correct 30 ms 47180 KB Output is correct
50 Correct 35 ms 47564 KB Output is correct
51 Correct 42 ms 47452 KB Output is correct
52 Correct 32 ms 47532 KB Output is correct
53 Correct 28 ms 47436 KB Output is correct
54 Correct 26 ms 47416 KB Output is correct
55 Correct 31 ms 47580 KB Output is correct
56 Correct 30 ms 47564 KB Output is correct
57 Correct 28 ms 47544 KB Output is correct
58 Correct 31 ms 47220 KB Output is correct
59 Correct 25 ms 47192 KB Output is correct
60 Correct 26 ms 47316 KB Output is correct
61 Correct 27 ms 47464 KB Output is correct
62 Correct 27 ms 47360 KB Output is correct
63 Correct 27 ms 47284 KB Output is correct
64 Correct 26 ms 47276 KB Output is correct
65 Correct 27 ms 47356 KB Output is correct
66 Correct 26 ms 47200 KB Output is correct
67 Correct 25 ms 47184 KB Output is correct
68 Correct 26 ms 47244 KB Output is correct
69 Correct 26 ms 47308 KB Output is correct
70 Correct 26 ms 47308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 47180 KB Output is correct
2 Correct 25 ms 47200 KB Output is correct
3 Correct 31 ms 47276 KB Output is correct
4 Correct 27 ms 47180 KB Output is correct
5 Correct 26 ms 47260 KB Output is correct
6 Correct 29 ms 47180 KB Output is correct
7 Correct 27 ms 47260 KB Output is correct
8 Correct 26 ms 47208 KB Output is correct
9 Correct 28 ms 47224 KB Output is correct
10 Correct 26 ms 47180 KB Output is correct
11 Correct 25 ms 47248 KB Output is correct
12 Correct 25 ms 47288 KB Output is correct
13 Correct 25 ms 47256 KB Output is correct
14 Correct 27 ms 47236 KB Output is correct
15 Correct 26 ms 47176 KB Output is correct
16 Correct 25 ms 47248 KB Output is correct
17 Correct 26 ms 47180 KB Output is correct
18 Correct 26 ms 47208 KB Output is correct
19 Correct 25 ms 47180 KB Output is correct
20 Correct 25 ms 47276 KB Output is correct
21 Correct 25 ms 47280 KB Output is correct
22 Correct 26 ms 47268 KB Output is correct
23 Correct 26 ms 47280 KB Output is correct
24 Correct 26 ms 47224 KB Output is correct
25 Correct 26 ms 47180 KB Output is correct
26 Correct 25 ms 47328 KB Output is correct
27 Correct 26 ms 47336 KB Output is correct
28 Correct 26 ms 47308 KB Output is correct
29 Correct 25 ms 47180 KB Output is correct
30 Correct 25 ms 47200 KB Output is correct
31 Correct 26 ms 47336 KB Output is correct
32 Correct 26 ms 47344 KB Output is correct
33 Correct 30 ms 47280 KB Output is correct
34 Correct 25 ms 47280 KB Output is correct
35 Correct 25 ms 47160 KB Output is correct
36 Correct 26 ms 47200 KB Output is correct
37 Correct 25 ms 47308 KB Output is correct
38 Correct 25 ms 47256 KB Output is correct
39 Correct 26 ms 47228 KB Output is correct
40 Correct 26 ms 47296 KB Output is correct
41 Correct 25 ms 47200 KB Output is correct
42 Correct 25 ms 47268 KB Output is correct
43 Correct 26 ms 47256 KB Output is correct
44 Correct 25 ms 47172 KB Output is correct
45 Correct 25 ms 47244 KB Output is correct
46 Correct 25 ms 47172 KB Output is correct
47 Correct 25 ms 47292 KB Output is correct
48 Correct 28 ms 47172 KB Output is correct
49 Correct 30 ms 47180 KB Output is correct
50 Correct 35 ms 47564 KB Output is correct
51 Correct 42 ms 47452 KB Output is correct
52 Correct 32 ms 47532 KB Output is correct
53 Correct 28 ms 47436 KB Output is correct
54 Correct 26 ms 47416 KB Output is correct
55 Correct 31 ms 47580 KB Output is correct
56 Correct 30 ms 47564 KB Output is correct
57 Correct 28 ms 47544 KB Output is correct
58 Correct 31 ms 47220 KB Output is correct
59 Correct 25 ms 47192 KB Output is correct
60 Correct 26 ms 47316 KB Output is correct
61 Correct 27 ms 47464 KB Output is correct
62 Correct 27 ms 47360 KB Output is correct
63 Correct 27 ms 47284 KB Output is correct
64 Correct 26 ms 47276 KB Output is correct
65 Correct 27 ms 47356 KB Output is correct
66 Correct 26 ms 47200 KB Output is correct
67 Correct 25 ms 47184 KB Output is correct
68 Correct 26 ms 47244 KB Output is correct
69 Correct 26 ms 47308 KB Output is correct
70 Correct 26 ms 47308 KB Output is correct
71 Correct 976 ms 56784 KB Output is correct
72 Correct 517 ms 54836 KB Output is correct
73 Correct 726 ms 56808 KB Output is correct
74 Correct 308 ms 53716 KB Output is correct
75 Correct 392 ms 54556 KB Output is correct
76 Correct 2163 ms 59856 KB Output is correct
77 Correct 2061 ms 58368 KB Output is correct
78 Correct 1532 ms 57892 KB Output is correct
79 Correct 1387 ms 57684 KB Output is correct
80 Correct 27 ms 47180 KB Output is correct
81 Correct 27 ms 47180 KB Output is correct
82 Correct 40 ms 47444 KB Output is correct
83 Correct 206 ms 48980 KB Output is correct
84 Correct 122 ms 49788 KB Output is correct
85 Correct 62 ms 47840 KB Output is correct
86 Correct 28 ms 47284 KB Output is correct
87 Correct 313 ms 49456 KB Output is correct
88 Correct 26 ms 47176 KB Output is correct
89 Correct 27 ms 47180 KB Output is correct
90 Correct 28 ms 47300 KB Output is correct
91 Correct 55 ms 48168 KB Output is correct
92 Correct 166 ms 50276 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 47180 KB Output is correct
2 Correct 25 ms 47200 KB Output is correct
3 Correct 31 ms 47276 KB Output is correct
4 Correct 27 ms 47180 KB Output is correct
5 Correct 26 ms 47260 KB Output is correct
6 Correct 29 ms 47180 KB Output is correct
7 Correct 27 ms 47260 KB Output is correct
8 Correct 26 ms 47208 KB Output is correct
9 Correct 28 ms 47224 KB Output is correct
10 Correct 26 ms 47180 KB Output is correct
11 Correct 25 ms 47248 KB Output is correct
12 Correct 25 ms 47288 KB Output is correct
13 Correct 25 ms 47256 KB Output is correct
14 Correct 27 ms 47236 KB Output is correct
15 Correct 26 ms 47176 KB Output is correct
16 Correct 25 ms 47248 KB Output is correct
17 Correct 26 ms 47180 KB Output is correct
18 Correct 26 ms 47208 KB Output is correct
19 Correct 25 ms 47180 KB Output is correct
20 Correct 25 ms 47276 KB Output is correct
21 Correct 25 ms 47280 KB Output is correct
22 Correct 26 ms 47268 KB Output is correct
23 Correct 26 ms 47280 KB Output is correct
24 Correct 26 ms 47224 KB Output is correct
25 Correct 26 ms 47180 KB Output is correct
26 Correct 25 ms 47328 KB Output is correct
27 Correct 26 ms 47336 KB Output is correct
28 Correct 26 ms 47308 KB Output is correct
29 Correct 25 ms 47180 KB Output is correct
30 Correct 25 ms 47200 KB Output is correct
31 Correct 26 ms 47336 KB Output is correct
32 Correct 26 ms 47344 KB Output is correct
33 Correct 30 ms 47280 KB Output is correct
34 Correct 25 ms 47280 KB Output is correct
35 Correct 25 ms 47160 KB Output is correct
36 Correct 26 ms 47200 KB Output is correct
37 Correct 25 ms 47308 KB Output is correct
38 Correct 25 ms 47256 KB Output is correct
39 Correct 26 ms 47228 KB Output is correct
40 Correct 26 ms 47296 KB Output is correct
41 Correct 25 ms 47200 KB Output is correct
42 Correct 25 ms 47268 KB Output is correct
43 Correct 26 ms 47256 KB Output is correct
44 Correct 25 ms 47172 KB Output is correct
45 Correct 25 ms 47244 KB Output is correct
46 Correct 25 ms 47172 KB Output is correct
47 Correct 25 ms 47292 KB Output is correct
48 Correct 28 ms 47172 KB Output is correct
49 Correct 30 ms 47180 KB Output is correct
50 Correct 35 ms 47564 KB Output is correct
51 Correct 42 ms 47452 KB Output is correct
52 Correct 32 ms 47532 KB Output is correct
53 Correct 28 ms 47436 KB Output is correct
54 Correct 26 ms 47416 KB Output is correct
55 Correct 31 ms 47580 KB Output is correct
56 Correct 30 ms 47564 KB Output is correct
57 Correct 28 ms 47544 KB Output is correct
58 Correct 31 ms 47220 KB Output is correct
59 Correct 25 ms 47192 KB Output is correct
60 Correct 26 ms 47316 KB Output is correct
61 Correct 27 ms 47464 KB Output is correct
62 Correct 27 ms 47360 KB Output is correct
63 Correct 27 ms 47284 KB Output is correct
64 Correct 26 ms 47276 KB Output is correct
65 Correct 27 ms 47356 KB Output is correct
66 Correct 26 ms 47200 KB Output is correct
67 Correct 25 ms 47184 KB Output is correct
68 Correct 26 ms 47244 KB Output is correct
69 Correct 26 ms 47308 KB Output is correct
70 Correct 26 ms 47308 KB Output is correct
71 Correct 976 ms 56784 KB Output is correct
72 Correct 517 ms 54836 KB Output is correct
73 Correct 726 ms 56808 KB Output is correct
74 Correct 308 ms 53716 KB Output is correct
75 Correct 392 ms 54556 KB Output is correct
76 Correct 2163 ms 59856 KB Output is correct
77 Correct 2061 ms 58368 KB Output is correct
78 Correct 1532 ms 57892 KB Output is correct
79 Correct 1387 ms 57684 KB Output is correct
80 Correct 27 ms 47180 KB Output is correct
81 Correct 27 ms 47180 KB Output is correct
82 Correct 40 ms 47444 KB Output is correct
83 Correct 206 ms 48980 KB Output is correct
84 Correct 122 ms 49788 KB Output is correct
85 Correct 62 ms 47840 KB Output is correct
86 Correct 28 ms 47284 KB Output is correct
87 Correct 313 ms 49456 KB Output is correct
88 Correct 26 ms 47176 KB Output is correct
89 Correct 27 ms 47180 KB Output is correct
90 Correct 28 ms 47300 KB Output is correct
91 Correct 55 ms 48168 KB Output is correct
92 Correct 166 ms 50276 KB Output is correct
93 Execution timed out 5079 ms 62960 KB Time limit exceeded
94 Halted 0 ms 0 KB -