(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 #1119697

#TimeUsernameProblemLanguageResultExecution timeMemory
1119697vjudge1Toys (CEOI18_toy)C++17
59 / 100
5041 ms137268 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 = 500001; using namespace std; using namespace __gnu_pbds; ll n, a; map <multiset<ll>, ll> mp; set <ll> ans; void rec (multiset <ll> v){ a = 0; for (auto i: v){ a += i; // cout << i << ' '; } mp[v]++; // cout << '\n'; ans.insert (a - v.size()); multiset <ll> q; for (auto i: v){ q.insert(i); } for (auto i: v){ for (int y = 2; y <= sqrt (i); y++){ if (i % y == 0){ q.erase (q.find(i)); q.insert(y); q.insert(i / y); if (mp[q] == 0)rec (q); q.erase(q.find(y)); q.erase (q.find(i / y)); q.insert(i); } } } } signed main (){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; rec ({n}); 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...