제출 #538009

#제출 시각아이디문제언어결과실행 시간메모리
538009jamielimToys (CEOI18_toy)C++14
39 / 100
5085 ms648 KiB
#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));
	}
}

컴파일 시 표준 에러 (stderr) 메시지

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...