Submission #424755

# Submission time Handle Problem Language Result Execution time Memory
424755 2021-06-12T09:40:22 Z Rouge_Hugo Toys (CEOI18_toy) C++14
39 / 100
145 ms 81904 KB
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define pb push_back
using namespace std;
int n;const int N=10090;
int y[N];
vector<int>vis[N];
vector<int>v,vv;
void d(int sum,int p)
{
    if(sum>n)return ;
    if(p>n)return ;
    if(vis[p][sum])return;
    vis[p][sum]=1;
    if(p==1)
    {
        y[sum]=1;return;
    }
    for(auto it:v)
    {
        if(p%it)continue;
        d(sum+it-1,p/it);
    }
}
int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>n;
    for(int i=2;i<=n;i++)
    {
        if(n%i)continue;
        v.pb(i);
        for(int j=0;j<=n+1;j++)vis[i].pb(0);
    }
    for(int j=0;j<=n+1;j++)vis[1].pb(0);
    d(0,n);
    for(int i=0;i<=n;i++)
    {
        if(y[i])vv.pb(i);
    }
    cout<<vv.size()<<endl;
    for(auto it:vv)cout<<it<<" ";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 460 KB Output is correct
2 Correct 1 ms 460 KB Output is correct
3 Correct 1 ms 460 KB Output is correct
4 Correct 1 ms 460 KB Output is correct
5 Correct 1 ms 460 KB Output is correct
6 Correct 1 ms 460 KB Output is correct
7 Correct 1 ms 460 KB Output is correct
8 Correct 1 ms 460 KB Output is correct
9 Correct 1 ms 460 KB Output is correct
10 Correct 1 ms 460 KB Output is correct
11 Correct 1 ms 460 KB Output is correct
12 Correct 1 ms 460 KB Output is correct
13 Correct 1 ms 460 KB Output is correct
14 Correct 1 ms 460 KB Output is correct
15 Correct 1 ms 460 KB Output is correct
16 Correct 1 ms 460 KB Output is correct
17 Correct 1 ms 460 KB Output is correct
18 Correct 1 ms 460 KB Output is correct
19 Correct 1 ms 460 KB Output is correct
20 Correct 1 ms 460 KB Output is correct
21 Correct 1 ms 460 KB Output is correct
22 Correct 1 ms 460 KB Output is correct
23 Correct 1 ms 460 KB Output is correct
24 Correct 1 ms 460 KB Output is correct
25 Correct 1 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 460 KB Output is correct
2 Correct 1 ms 460 KB Output is correct
3 Correct 1 ms 460 KB Output is correct
4 Correct 1 ms 460 KB Output is correct
5 Correct 1 ms 460 KB Output is correct
6 Correct 1 ms 460 KB Output is correct
7 Correct 1 ms 460 KB Output is correct
8 Correct 1 ms 460 KB Output is correct
9 Correct 1 ms 460 KB Output is correct
10 Correct 1 ms 460 KB Output is correct
11 Correct 1 ms 460 KB Output is correct
12 Correct 1 ms 460 KB Output is correct
13 Correct 1 ms 460 KB Output is correct
14 Correct 1 ms 460 KB Output is correct
15 Correct 1 ms 460 KB Output is correct
16 Correct 1 ms 460 KB Output is correct
17 Correct 1 ms 460 KB Output is correct
18 Correct 1 ms 460 KB Output is correct
19 Correct 1 ms 460 KB Output is correct
20 Correct 1 ms 460 KB Output is correct
21 Correct 1 ms 460 KB Output is correct
22 Correct 1 ms 460 KB Output is correct
23 Correct 1 ms 460 KB Output is correct
24 Correct 1 ms 460 KB Output is correct
25 Correct 1 ms 460 KB Output is correct
26 Correct 6 ms 2636 KB Output is correct
27 Correct 5 ms 1996 KB Output is correct
28 Correct 2 ms 1356 KB Output is correct
29 Correct 1 ms 844 KB Output is correct
30 Correct 1 ms 844 KB Output is correct
31 Correct 5 ms 2892 KB Output is correct
32 Correct 5 ms 2380 KB Output is correct
33 Correct 4 ms 2380 KB Output is correct
34 Correct 1 ms 588 KB Output is correct
35 Correct 1 ms 716 KB Output is correct
36 Correct 2 ms 1100 KB Output is correct
37 Correct 3 ms 1740 KB Output is correct
38 Correct 3 ms 1740 KB Output is correct
39 Correct 2 ms 1100 KB Output is correct
40 Correct 4 ms 2508 KB Output is correct
41 Correct 1 ms 588 KB Output is correct
42 Correct 1 ms 588 KB Output is correct
43 Correct 2 ms 1612 KB Output is correct
44 Correct 1 ms 716 KB Output is correct
45 Correct 4 ms 2224 KB Output is correct
46 Correct 2 ms 1100 KB Output is correct
47 Correct 4 ms 2252 KB Output is correct
48 Correct 1 ms 844 KB Output is correct
49 Correct 3 ms 1996 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 460 KB Output is correct
2 Correct 1 ms 460 KB Output is correct
3 Correct 1 ms 460 KB Output is correct
4 Correct 1 ms 460 KB Output is correct
5 Correct 1 ms 460 KB Output is correct
6 Correct 1 ms 460 KB Output is correct
7 Correct 1 ms 460 KB Output is correct
8 Correct 1 ms 460 KB Output is correct
9 Correct 1 ms 460 KB Output is correct
10 Correct 1 ms 460 KB Output is correct
11 Correct 1 ms 460 KB Output is correct
12 Correct 1 ms 460 KB Output is correct
13 Correct 1 ms 460 KB Output is correct
14 Correct 1 ms 460 KB Output is correct
15 Correct 1 ms 460 KB Output is correct
16 Correct 1 ms 460 KB Output is correct
17 Correct 1 ms 460 KB Output is correct
18 Correct 1 ms 460 KB Output is correct
19 Correct 1 ms 460 KB Output is correct
20 Correct 1 ms 460 KB Output is correct
21 Correct 1 ms 460 KB Output is correct
22 Correct 1 ms 460 KB Output is correct
23 Correct 1 ms 460 KB Output is correct
24 Correct 1 ms 460 KB Output is correct
25 Correct 1 ms 460 KB Output is correct
26 Correct 6 ms 2636 KB Output is correct
27 Correct 5 ms 1996 KB Output is correct
28 Correct 2 ms 1356 KB Output is correct
29 Correct 1 ms 844 KB Output is correct
30 Correct 1 ms 844 KB Output is correct
31 Correct 5 ms 2892 KB Output is correct
32 Correct 5 ms 2380 KB Output is correct
33 Correct 4 ms 2380 KB Output is correct
34 Correct 1 ms 588 KB Output is correct
35 Correct 1 ms 716 KB Output is correct
36 Correct 2 ms 1100 KB Output is correct
37 Correct 3 ms 1740 KB Output is correct
38 Correct 3 ms 1740 KB Output is correct
39 Correct 2 ms 1100 KB Output is correct
40 Correct 4 ms 2508 KB Output is correct
41 Correct 1 ms 588 KB Output is correct
42 Correct 1 ms 588 KB Output is correct
43 Correct 2 ms 1612 KB Output is correct
44 Correct 1 ms 716 KB Output is correct
45 Correct 4 ms 2224 KB Output is correct
46 Correct 2 ms 1100 KB Output is correct
47 Correct 4 ms 2252 KB Output is correct
48 Correct 1 ms 844 KB Output is correct
49 Correct 3 ms 1996 KB Output is correct
50 Runtime error 145 ms 81904 KB Execution killed with signal 11
51 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 460 KB Output is correct
2 Correct 1 ms 460 KB Output is correct
3 Correct 1 ms 460 KB Output is correct
4 Correct 1 ms 460 KB Output is correct
5 Correct 1 ms 460 KB Output is correct
6 Correct 1 ms 460 KB Output is correct
7 Correct 1 ms 460 KB Output is correct
8 Correct 1 ms 460 KB Output is correct
9 Correct 1 ms 460 KB Output is correct
10 Correct 1 ms 460 KB Output is correct
11 Correct 1 ms 460 KB Output is correct
12 Correct 1 ms 460 KB Output is correct
13 Correct 1 ms 460 KB Output is correct
14 Correct 1 ms 460 KB Output is correct
15 Correct 1 ms 460 KB Output is correct
16 Correct 1 ms 460 KB Output is correct
17 Correct 1 ms 460 KB Output is correct
18 Correct 1 ms 460 KB Output is correct
19 Correct 1 ms 460 KB Output is correct
20 Correct 1 ms 460 KB Output is correct
21 Correct 1 ms 460 KB Output is correct
22 Correct 1 ms 460 KB Output is correct
23 Correct 1 ms 460 KB Output is correct
24 Correct 1 ms 460 KB Output is correct
25 Correct 1 ms 460 KB Output is correct
26 Correct 6 ms 2636 KB Output is correct
27 Correct 5 ms 1996 KB Output is correct
28 Correct 2 ms 1356 KB Output is correct
29 Correct 1 ms 844 KB Output is correct
30 Correct 1 ms 844 KB Output is correct
31 Correct 5 ms 2892 KB Output is correct
32 Correct 5 ms 2380 KB Output is correct
33 Correct 4 ms 2380 KB Output is correct
34 Correct 1 ms 588 KB Output is correct
35 Correct 1 ms 716 KB Output is correct
36 Correct 2 ms 1100 KB Output is correct
37 Correct 3 ms 1740 KB Output is correct
38 Correct 3 ms 1740 KB Output is correct
39 Correct 2 ms 1100 KB Output is correct
40 Correct 4 ms 2508 KB Output is correct
41 Correct 1 ms 588 KB Output is correct
42 Correct 1 ms 588 KB Output is correct
43 Correct 2 ms 1612 KB Output is correct
44 Correct 1 ms 716 KB Output is correct
45 Correct 4 ms 2224 KB Output is correct
46 Correct 2 ms 1100 KB Output is correct
47 Correct 4 ms 2252 KB Output is correct
48 Correct 1 ms 844 KB Output is correct
49 Correct 3 ms 1996 KB Output is correct
50 Runtime error 145 ms 81904 KB Execution killed with signal 11
51 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 460 KB Output is correct
2 Correct 1 ms 460 KB Output is correct
3 Correct 1 ms 460 KB Output is correct
4 Correct 1 ms 460 KB Output is correct
5 Correct 1 ms 460 KB Output is correct
6 Correct 1 ms 460 KB Output is correct
7 Correct 1 ms 460 KB Output is correct
8 Correct 1 ms 460 KB Output is correct
9 Correct 1 ms 460 KB Output is correct
10 Correct 1 ms 460 KB Output is correct
11 Correct 1 ms 460 KB Output is correct
12 Correct 1 ms 460 KB Output is correct
13 Correct 1 ms 460 KB Output is correct
14 Correct 1 ms 460 KB Output is correct
15 Correct 1 ms 460 KB Output is correct
16 Correct 1 ms 460 KB Output is correct
17 Correct 1 ms 460 KB Output is correct
18 Correct 1 ms 460 KB Output is correct
19 Correct 1 ms 460 KB Output is correct
20 Correct 1 ms 460 KB Output is correct
21 Correct 1 ms 460 KB Output is correct
22 Correct 1 ms 460 KB Output is correct
23 Correct 1 ms 460 KB Output is correct
24 Correct 1 ms 460 KB Output is correct
25 Correct 1 ms 460 KB Output is correct
26 Correct 6 ms 2636 KB Output is correct
27 Correct 5 ms 1996 KB Output is correct
28 Correct 2 ms 1356 KB Output is correct
29 Correct 1 ms 844 KB Output is correct
30 Correct 1 ms 844 KB Output is correct
31 Correct 5 ms 2892 KB Output is correct
32 Correct 5 ms 2380 KB Output is correct
33 Correct 4 ms 2380 KB Output is correct
34 Correct 1 ms 588 KB Output is correct
35 Correct 1 ms 716 KB Output is correct
36 Correct 2 ms 1100 KB Output is correct
37 Correct 3 ms 1740 KB Output is correct
38 Correct 3 ms 1740 KB Output is correct
39 Correct 2 ms 1100 KB Output is correct
40 Correct 4 ms 2508 KB Output is correct
41 Correct 1 ms 588 KB Output is correct
42 Correct 1 ms 588 KB Output is correct
43 Correct 2 ms 1612 KB Output is correct
44 Correct 1 ms 716 KB Output is correct
45 Correct 4 ms 2224 KB Output is correct
46 Correct 2 ms 1100 KB Output is correct
47 Correct 4 ms 2252 KB Output is correct
48 Correct 1 ms 844 KB Output is correct
49 Correct 3 ms 1996 KB Output is correct
50 Runtime error 145 ms 81904 KB Execution killed with signal 11
51 Halted 0 ms 0 KB -