(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.

Submission #1119700

#TimeUsernameProblemLanguageResultExecution timeMemory
1119700vjudge1Toys (CEOI18_toy)C++17
79 / 100
5068 ms62452 KiB
// made by Tima // 2025 will be a golden year... #include "bits/stdc++.h" #include <ext/pb_ds/assoc_container.hpp> #define ll long long #define pb push_back #define pf push_front #define ppb pop_back #define ppf pop_front // #define int long long #define F first #define S second #define all(x) (x).begin(), (x).end() #define pii pair<int,int> #define tpii pair <pair <int,int> , int> #define bruh cout << "NO\n" using namespace std; using namespace __gnu_pbds; const int N = 3e5 + 5; int mod = 1e9 + 7; const int INF = 1e18; int n; map <int , set <int>> used; set <int> solve(int x){ set <int> st; st.insert(x - 1); // cout << x << '\n'; if(x == 1) return st; if(used[x].size()) return used[x]; for(int i = 2 ; i * i <= x ; i++){ if(x % i == 0){ int f = i , s = x / i; set <int> st1 = solve(f) , st2 = solve(s); for(auto it : st1){ for(auto ti : st2){ st.insert(ti + it); } } } } return used[x] = st; } void Gold(){ cin >> n; set <int> st = solve(n); cout << st.size() << '\n'; for(auto it : st){ cout << it << ' '; } } //https://codeforces.com/blog/entry/133289 signed main(/*Zhunussov Temirlan*/){ //freopen("txt.in","r",stdin);freopen("txt.out","w",stdout); ios_base::sync_with_stdio(0);cin.tie(0); srand(time(0)); int TT = 1; // cin >> TT; for(int i = 1 ; i <= TT ; i++){ //cout << "Case " << i << ": "; Gold(); } }

Compilation message (stderr)

toy.cpp:21:17: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   21 | const int INF = 1e18;
      |                 ^~~~
#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...