# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
383537 | maximath_1 | Toys (CEOI18_toy) | C++11 | 3114 ms | 94980 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <numeric>
#include <queue>
#include <assert.h>
#include <map>
#include <set>
#include <limits.h>
using namespace std;
#define ll long long
#define ld long double
const int MX = 100005;
const int LG = (int)log2(MX) + 2;
const int BLOCK = 105;
const ll mod = 1e9 + 7;
const ll inv2 = (mod + 1) / 2;
#define gc getchar//_unlocked //can't for window server
void cin(int &x){
char c = gc(); bool neg = false;
for(; c < '0'||'9' < c; c = gc())
if(c == '-') neg=true;
x = c - '0'; c = gc();
for(; '0' <= c && c <= '9'; c = gc())
x = (x << 1) + (x << 3) + (c - '0');
if(neg) x = -x;
}
int n;
vector<int> divi;
set<int> v[100005];
int main(){
cin(n);
for(int i = 1; i * i <= n; i ++) if(n % i == 0){
divi.push_back(i);
if(i * i != n)
divi.push_back(n / i);
}
sort(divi.begin(), divi.end());
v[0].insert(0);
for(int i = 1; i < divi.size(); i ++){
for(int j = 0; j < i; j ++) if(divi[i] % divi[j] == 0){
for(int k : v[j])
v[i].insert(k + (divi[i] / divi[j] - 1));
}
}
set<int> ans = v[divi.size() - 1];
printf("%d\n", ans.size());
for(int i : ans)
printf("%d ", i);
printf("\n");
}
Compilation message (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... |