(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

제출 #1119740

#제출 시각아이디문제언어결과실행 시간메모리
1119740vjudge1Toys (CEOI18_toy)C++17
100 / 100
451 ms4620 KiB
#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #define ll int #define F first #define S second #define ull unsigned long long #define db double #define ldb long double #define pb push_back #define pf push_front #define ppb pop_back #define ppf pop_front #define yes cout<<"YES\n" #define no cout<<"NO\n" #define ordered_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> #define all(x) x.begin(), x.end() const int mod = 1e9 + 7; const int N = 10001; using namespace std; using namespace __gnu_pbds; ll n, a; vector <int> del; set <ll> ans; void solve(int x, int i, ll sum) { if (x == 1) { ans.insert(sum); return; } while (i >= 0 && x % del[i]) i--; if (i < 0) return; solve(x, i - 1, sum); solve(x / del[i], i, sum + del[i] - 1); } signed main (){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for (int i = 2; i <= sqrt (n); i++){ if (n % i == 0){ del.pb(i); if (n / i != i){ del.pb(n / i); } } } del.pb(n); sort(all(del)); solve (n, del.size() - 1, 0); cout << ans.size() << '\n'; for (auto i: ans){ cout << i << ' '; } }
#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...