# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
490999 | 2021-11-30T03:09:31 Z | baokhue232005 | Toys (CEOI18_toy) | C++17 | 0 ms | 204 KB |
/* #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #pragma GCC optimize("unroll-loops") */ // lethal option #include<bits/stdc++.h> using namespace std; #define all(flg) flg.begin(), flg.end() #define int long long #define pb push_back #define fi first #define se second // #define endl "\n" #define eb emplace_back #define ii pair<int, int> #define PI 3.141592653589793238462643383279502884 #define ll long long #define for1(i, ff, gg) for(int i = ff; i <= gg; ++i) #define for2(i, ff, gg) for(int i = ff; i >= gg; --i) const ll mod = 1e9 + 7; const int maxN = 300005; const ll oo = 1e18 + 7; int n, a[maxN]; int x, y, z, k; vector<int> ans; vector<int> back(int god, int dnlim, int sum){ vector<int> buo; int db = sqrt(god); if(dnlim > god) return buo; buo.pb(sum + god - 1); for1(i, dnlim, db) if(god % i == 0){ auto cm = back(god / i, i, sum + i - 1); buo.insert(buo.end(), all(cm)); } // cout << god << " " << dnlim << ' ' << sum << "\n"; // for(int cc : buo) cout << cc << " "; // cout << endl; return buo; } signed main(){ ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); cin >> n; if(n == 1){ cout << "0\n\n"; return 0; } ans = back(n, 2, 0); ans.pb(n - 1); sort(all(ans)); int vl = 0; for1(i, 0, ans.size() - 1){ if(i == 0 || ans[i] != ans[i - 1]) ++vl; } cout << vl << endl; for1(i, 0, ans.size() - 1){ if(i == 0 || ans[i] != ans[i - 1]) cout << ans[i] << " "; } cout << endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |