Submission #538007

# Submission time Handle Problem Language Result Execution time Memory
538007 2022-03-16T02:44:20 Z jamielim Toys (CEOI18_toy) C++14
39 / 100
5000 ms 704 KB
#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define ALL(x) x.begin(),x.end()
#define SZ(x) (int)x.size()
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ii,ii> i4;
const int MOD=1000000007;
const int INF=1012345678;
const ll LLINF=1012345678012345678LL;
const double PI=3.1415926536;
const double EPS=1e-14;

bool prime[100005];
int n;

int main(){
	scanf("%d",&n);
	vector<pair<int,ll> > v;
	v.pb(n,0);
	for(int i=2;i<=100005;i++){
		for(int j=0;j<SZ(v);j++){ // it should include the new elements
			pair<int,ll> x=v[j];
			if(x.fi%i==0){
				v.pb(x.fi/i,i-1+x.se);
			}
		}
	}
	if(SZ(v)==1)v.pb(1,n-1);
	set<ll> ans;
	for(pair<int,ll> i:v){
		if(i.fi==1)ans.insert(i.se);
	}
	printf("%d\n",SZ(ans));
	for(auto it=ans.begin();it!=ans.end();++it){
		printf("%lld ",(*it));
	}
}

Compilation message

toy.cpp: In function 'int main()':
toy.cpp:23:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |  scanf("%d",&n);
      |  ~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
3 Correct 2 ms 212 KB Output is correct
4 Correct 3 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 3 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 4 ms 212 KB Output is correct
9 Correct 3 ms 212 KB Output is correct
10 Correct 3 ms 212 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 5 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 3 ms 212 KB Output is correct
15 Correct 3 ms 212 KB Output is correct
16 Correct 7 ms 304 KB Output is correct
17 Correct 2 ms 212 KB Output is correct
18 Correct 6 ms 212 KB Output is correct
19 Correct 2 ms 212 KB Output is correct
20 Correct 7 ms 212 KB Output is correct
21 Correct 6 ms 212 KB Output is correct
22 Correct 12 ms 304 KB Output is correct
23 Correct 3 ms 212 KB Output is correct
24 Correct 19 ms 212 KB Output is correct
25 Correct 14 ms 308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
3 Correct 2 ms 212 KB Output is correct
4 Correct 3 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 3 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 4 ms 212 KB Output is correct
9 Correct 3 ms 212 KB Output is correct
10 Correct 3 ms 212 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 5 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 3 ms 212 KB Output is correct
15 Correct 3 ms 212 KB Output is correct
16 Correct 7 ms 304 KB Output is correct
17 Correct 2 ms 212 KB Output is correct
18 Correct 6 ms 212 KB Output is correct
19 Correct 2 ms 212 KB Output is correct
20 Correct 7 ms 212 KB Output is correct
21 Correct 6 ms 212 KB Output is correct
22 Correct 12 ms 304 KB Output is correct
23 Correct 3 ms 212 KB Output is correct
24 Correct 19 ms 212 KB Output is correct
25 Correct 14 ms 308 KB Output is correct
26 Correct 989 ms 348 KB Output is correct
27 Correct 885 ms 460 KB Output is correct
28 Correct 412 ms 320 KB Output is correct
29 Correct 297 ms 312 KB Output is correct
30 Correct 184 ms 296 KB Output is correct
31 Correct 1533 ms 416 KB Output is correct
32 Correct 1075 ms 408 KB Output is correct
33 Correct 959 ms 348 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 3 ms 212 KB Output is correct
36 Correct 196 ms 212 KB Output is correct
37 Correct 730 ms 348 KB Output is correct
38 Correct 203 ms 296 KB Output is correct
39 Correct 18 ms 308 KB Output is correct
40 Correct 658 ms 340 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 69 ms 308 KB Output is correct
44 Correct 4 ms 212 KB Output is correct
45 Correct 187 ms 212 KB Output is correct
46 Correct 17 ms 212 KB Output is correct
47 Correct 572 ms 340 KB Output is correct
48 Correct 6 ms 212 KB Output is correct
49 Correct 140 ms 312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
3 Correct 2 ms 212 KB Output is correct
4 Correct 3 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 3 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 4 ms 212 KB Output is correct
9 Correct 3 ms 212 KB Output is correct
10 Correct 3 ms 212 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 5 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 3 ms 212 KB Output is correct
15 Correct 3 ms 212 KB Output is correct
16 Correct 7 ms 304 KB Output is correct
17 Correct 2 ms 212 KB Output is correct
18 Correct 6 ms 212 KB Output is correct
19 Correct 2 ms 212 KB Output is correct
20 Correct 7 ms 212 KB Output is correct
21 Correct 6 ms 212 KB Output is correct
22 Correct 12 ms 304 KB Output is correct
23 Correct 3 ms 212 KB Output is correct
24 Correct 19 ms 212 KB Output is correct
25 Correct 14 ms 308 KB Output is correct
26 Correct 989 ms 348 KB Output is correct
27 Correct 885 ms 460 KB Output is correct
28 Correct 412 ms 320 KB Output is correct
29 Correct 297 ms 312 KB Output is correct
30 Correct 184 ms 296 KB Output is correct
31 Correct 1533 ms 416 KB Output is correct
32 Correct 1075 ms 408 KB Output is correct
33 Correct 959 ms 348 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 3 ms 212 KB Output is correct
36 Correct 196 ms 212 KB Output is correct
37 Correct 730 ms 348 KB Output is correct
38 Correct 203 ms 296 KB Output is correct
39 Correct 18 ms 308 KB Output is correct
40 Correct 658 ms 340 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 69 ms 308 KB Output is correct
44 Correct 4 ms 212 KB Output is correct
45 Correct 187 ms 212 KB Output is correct
46 Correct 17 ms 212 KB Output is correct
47 Correct 572 ms 340 KB Output is correct
48 Correct 6 ms 212 KB Output is correct
49 Correct 140 ms 312 KB Output is correct
50 Correct 4995 ms 696 KB Output is correct
51 Correct 4493 ms 704 KB Output is correct
52 Execution timed out 5098 ms 596 KB Time limit exceeded
53 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
3 Correct 2 ms 212 KB Output is correct
4 Correct 3 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 3 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 4 ms 212 KB Output is correct
9 Correct 3 ms 212 KB Output is correct
10 Correct 3 ms 212 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 5 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 3 ms 212 KB Output is correct
15 Correct 3 ms 212 KB Output is correct
16 Correct 7 ms 304 KB Output is correct
17 Correct 2 ms 212 KB Output is correct
18 Correct 6 ms 212 KB Output is correct
19 Correct 2 ms 212 KB Output is correct
20 Correct 7 ms 212 KB Output is correct
21 Correct 6 ms 212 KB Output is correct
22 Correct 12 ms 304 KB Output is correct
23 Correct 3 ms 212 KB Output is correct
24 Correct 19 ms 212 KB Output is correct
25 Correct 14 ms 308 KB Output is correct
26 Correct 989 ms 348 KB Output is correct
27 Correct 885 ms 460 KB Output is correct
28 Correct 412 ms 320 KB Output is correct
29 Correct 297 ms 312 KB Output is correct
30 Correct 184 ms 296 KB Output is correct
31 Correct 1533 ms 416 KB Output is correct
32 Correct 1075 ms 408 KB Output is correct
33 Correct 959 ms 348 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 3 ms 212 KB Output is correct
36 Correct 196 ms 212 KB Output is correct
37 Correct 730 ms 348 KB Output is correct
38 Correct 203 ms 296 KB Output is correct
39 Correct 18 ms 308 KB Output is correct
40 Correct 658 ms 340 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 69 ms 308 KB Output is correct
44 Correct 4 ms 212 KB Output is correct
45 Correct 187 ms 212 KB Output is correct
46 Correct 17 ms 212 KB Output is correct
47 Correct 572 ms 340 KB Output is correct
48 Correct 6 ms 212 KB Output is correct
49 Correct 140 ms 312 KB Output is correct
50 Correct 4995 ms 696 KB Output is correct
51 Correct 4493 ms 704 KB Output is correct
52 Execution timed out 5098 ms 596 KB Time limit exceeded
53 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
3 Correct 2 ms 212 KB Output is correct
4 Correct 3 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 3 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 4 ms 212 KB Output is correct
9 Correct 3 ms 212 KB Output is correct
10 Correct 3 ms 212 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 5 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 3 ms 212 KB Output is correct
15 Correct 3 ms 212 KB Output is correct
16 Correct 7 ms 304 KB Output is correct
17 Correct 2 ms 212 KB Output is correct
18 Correct 6 ms 212 KB Output is correct
19 Correct 2 ms 212 KB Output is correct
20 Correct 7 ms 212 KB Output is correct
21 Correct 6 ms 212 KB Output is correct
22 Correct 12 ms 304 KB Output is correct
23 Correct 3 ms 212 KB Output is correct
24 Correct 19 ms 212 KB Output is correct
25 Correct 14 ms 308 KB Output is correct
26 Correct 989 ms 348 KB Output is correct
27 Correct 885 ms 460 KB Output is correct
28 Correct 412 ms 320 KB Output is correct
29 Correct 297 ms 312 KB Output is correct
30 Correct 184 ms 296 KB Output is correct
31 Correct 1533 ms 416 KB Output is correct
32 Correct 1075 ms 408 KB Output is correct
33 Correct 959 ms 348 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 3 ms 212 KB Output is correct
36 Correct 196 ms 212 KB Output is correct
37 Correct 730 ms 348 KB Output is correct
38 Correct 203 ms 296 KB Output is correct
39 Correct 18 ms 308 KB Output is correct
40 Correct 658 ms 340 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 69 ms 308 KB Output is correct
44 Correct 4 ms 212 KB Output is correct
45 Correct 187 ms 212 KB Output is correct
46 Correct 17 ms 212 KB Output is correct
47 Correct 572 ms 340 KB Output is correct
48 Correct 6 ms 212 KB Output is correct
49 Correct 140 ms 312 KB Output is correct
50 Correct 4995 ms 696 KB Output is correct
51 Correct 4493 ms 704 KB Output is correct
52 Execution timed out 5098 ms 596 KB Time limit exceeded
53 Halted 0 ms 0 KB -