# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
538009 | jamielim | Toys (CEOI18_toy) | C++14 | 5085 ms | 648 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |