답안 #538009

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
538009 2022-03-16T02:54:55 Z jamielim Toys (CEOI18_toy) C++14
39 / 100
5000 ms 648 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);
	set<ll> ans;
	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){
				ans.insert(i-1+x.se);
			}else if(x.fi%i==0){
				v.pb(x.fi/i,i-1+x.se);
			}
		}
	}
	if(SZ(v)==1)v.pb(1,n-1);
	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);
      |  ~~~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 2 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 2 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 4 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 2 ms 212 KB Output is correct
15 Correct 2 ms 212 KB Output is correct
16 Correct 4 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 4 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 4 ms 212 KB Output is correct
21 Correct 4 ms 212 KB Output is correct
22 Correct 7 ms 212 KB Output is correct
23 Correct 2 ms 212 KB Output is correct
24 Correct 14 ms 212 KB Output is correct
25 Correct 9 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 2 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 2 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 4 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 2 ms 212 KB Output is correct
15 Correct 2 ms 212 KB Output is correct
16 Correct 4 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 4 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 4 ms 212 KB Output is correct
21 Correct 4 ms 212 KB Output is correct
22 Correct 7 ms 212 KB Output is correct
23 Correct 2 ms 212 KB Output is correct
24 Correct 14 ms 212 KB Output is correct
25 Correct 9 ms 212 KB Output is correct
26 Correct 809 ms 344 KB Output is correct
27 Correct 672 ms 344 KB Output is correct
28 Correct 308 ms 332 KB Output is correct
29 Correct 224 ms 300 KB Output is correct
30 Correct 132 ms 312 KB Output is correct
31 Correct 1157 ms 392 KB Output is correct
32 Correct 843 ms 344 KB Output is correct
33 Correct 735 ms 344 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 2 ms 212 KB Output is correct
36 Correct 138 ms 300 KB Output is correct
37 Correct 541 ms 340 KB Output is correct
38 Correct 158 ms 312 KB Output is correct
39 Correct 12 ms 212 KB Output is correct
40 Correct 475 ms 212 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 50 ms 212 KB Output is correct
44 Correct 2 ms 212 KB Output is correct
45 Correct 133 ms 300 KB Output is correct
46 Correct 12 ms 212 KB Output is correct
47 Correct 412 ms 312 KB Output is correct
48 Correct 4 ms 212 KB Output is correct
49 Correct 104 ms 288 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 2 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 2 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 4 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 2 ms 212 KB Output is correct
15 Correct 2 ms 212 KB Output is correct
16 Correct 4 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 4 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 4 ms 212 KB Output is correct
21 Correct 4 ms 212 KB Output is correct
22 Correct 7 ms 212 KB Output is correct
23 Correct 2 ms 212 KB Output is correct
24 Correct 14 ms 212 KB Output is correct
25 Correct 9 ms 212 KB Output is correct
26 Correct 809 ms 344 KB Output is correct
27 Correct 672 ms 344 KB Output is correct
28 Correct 308 ms 332 KB Output is correct
29 Correct 224 ms 300 KB Output is correct
30 Correct 132 ms 312 KB Output is correct
31 Correct 1157 ms 392 KB Output is correct
32 Correct 843 ms 344 KB Output is correct
33 Correct 735 ms 344 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 2 ms 212 KB Output is correct
36 Correct 138 ms 300 KB Output is correct
37 Correct 541 ms 340 KB Output is correct
38 Correct 158 ms 312 KB Output is correct
39 Correct 12 ms 212 KB Output is correct
40 Correct 475 ms 212 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 50 ms 212 KB Output is correct
44 Correct 2 ms 212 KB Output is correct
45 Correct 133 ms 300 KB Output is correct
46 Correct 12 ms 212 KB Output is correct
47 Correct 412 ms 312 KB Output is correct
48 Correct 4 ms 212 KB Output is correct
49 Correct 104 ms 288 KB Output is correct
50 Correct 3832 ms 548 KB Output is correct
51 Correct 3248 ms 532 KB Output is correct
52 Correct 4104 ms 596 KB Output is correct
53 Correct 3553 ms 476 KB Output is correct
54 Correct 1478 ms 400 KB Output is correct
55 Execution timed out 5085 ms 648 KB Time limit exceeded
56 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 2 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 2 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 4 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 2 ms 212 KB Output is correct
15 Correct 2 ms 212 KB Output is correct
16 Correct 4 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 4 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 4 ms 212 KB Output is correct
21 Correct 4 ms 212 KB Output is correct
22 Correct 7 ms 212 KB Output is correct
23 Correct 2 ms 212 KB Output is correct
24 Correct 14 ms 212 KB Output is correct
25 Correct 9 ms 212 KB Output is correct
26 Correct 809 ms 344 KB Output is correct
27 Correct 672 ms 344 KB Output is correct
28 Correct 308 ms 332 KB Output is correct
29 Correct 224 ms 300 KB Output is correct
30 Correct 132 ms 312 KB Output is correct
31 Correct 1157 ms 392 KB Output is correct
32 Correct 843 ms 344 KB Output is correct
33 Correct 735 ms 344 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 2 ms 212 KB Output is correct
36 Correct 138 ms 300 KB Output is correct
37 Correct 541 ms 340 KB Output is correct
38 Correct 158 ms 312 KB Output is correct
39 Correct 12 ms 212 KB Output is correct
40 Correct 475 ms 212 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 50 ms 212 KB Output is correct
44 Correct 2 ms 212 KB Output is correct
45 Correct 133 ms 300 KB Output is correct
46 Correct 12 ms 212 KB Output is correct
47 Correct 412 ms 312 KB Output is correct
48 Correct 4 ms 212 KB Output is correct
49 Correct 104 ms 288 KB Output is correct
50 Correct 3832 ms 548 KB Output is correct
51 Correct 3248 ms 532 KB Output is correct
52 Correct 4104 ms 596 KB Output is correct
53 Correct 3553 ms 476 KB Output is correct
54 Correct 1478 ms 400 KB Output is correct
55 Execution timed out 5085 ms 648 KB Time limit exceeded
56 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 2 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 2 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 4 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 2 ms 212 KB Output is correct
15 Correct 2 ms 212 KB Output is correct
16 Correct 4 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 4 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 4 ms 212 KB Output is correct
21 Correct 4 ms 212 KB Output is correct
22 Correct 7 ms 212 KB Output is correct
23 Correct 2 ms 212 KB Output is correct
24 Correct 14 ms 212 KB Output is correct
25 Correct 9 ms 212 KB Output is correct
26 Correct 809 ms 344 KB Output is correct
27 Correct 672 ms 344 KB Output is correct
28 Correct 308 ms 332 KB Output is correct
29 Correct 224 ms 300 KB Output is correct
30 Correct 132 ms 312 KB Output is correct
31 Correct 1157 ms 392 KB Output is correct
32 Correct 843 ms 344 KB Output is correct
33 Correct 735 ms 344 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 2 ms 212 KB Output is correct
36 Correct 138 ms 300 KB Output is correct
37 Correct 541 ms 340 KB Output is correct
38 Correct 158 ms 312 KB Output is correct
39 Correct 12 ms 212 KB Output is correct
40 Correct 475 ms 212 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 50 ms 212 KB Output is correct
44 Correct 2 ms 212 KB Output is correct
45 Correct 133 ms 300 KB Output is correct
46 Correct 12 ms 212 KB Output is correct
47 Correct 412 ms 312 KB Output is correct
48 Correct 4 ms 212 KB Output is correct
49 Correct 104 ms 288 KB Output is correct
50 Correct 3832 ms 548 KB Output is correct
51 Correct 3248 ms 532 KB Output is correct
52 Correct 4104 ms 596 KB Output is correct
53 Correct 3553 ms 476 KB Output is correct
54 Correct 1478 ms 400 KB Output is correct
55 Execution timed out 5085 ms 648 KB Time limit exceeded
56 Halted 0 ms 0 KB -