# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
920774 | Faisal_Saqib | Toys (CEOI18_toy) | C++17 | 3082 ms | 90312 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#include <iostream>
#include <map>
#include <set>
using namespace std;
map<int,set<int>> mp;
void pos(long long&x)
{
auto it=mp.find(x);
if(it!=mp.end())
return;
set<int> cur={x-1};
for(long long d=2;(d*d)<=x;d++)
{
if(x%d==0)
{
long long rem=x/d;
pos(rem);
auto nxt=mp[rem];
for(auto j:nxt)
cur.insert(j+(d-1));
if((d*d)!=x)
{
d=x/d;
long long rem=x/d;
pos(rem);
auto nxt=mp[rem];
for(auto j:nxt)
cur.insert(j+(d-1));
d=x/d;
}
}
}
mp[x]=cur;
}
int main()
{
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(0);
long long n;
cin>>n;
pos(n);
auto tlp=mp[n];
cout<<tlp.size()<<endl;
for(auto j:tlp)
{
cout<<j<<' ';
}
cout<<endl;
}
컴파일 시 표준 에러 (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... |