Submission #494338

#TimeUsernameProblemLanguageResultExecution timeMemory
494338fcmalkcinToys (CEOI18_toy)C++17
100 / 100
1871 ms4352 KiB
/*#pragma GCC optimize("Ofast") #pragma GCC optimization("unroll-loops, no-stack-protector") #pragma GCC target("avx,avx2,fma")*/ #include <bits/stdc++.h> using namespace std; #define ll int #define pll pair<ll,ll> #define ff first #define ss second #define pb push_back #define endl "\n" mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); const ll maxn=5e5+5; const ll mod=1e9+7 ; const ll base=3e18; /// you will be the best but now you just are trash /// goal 1/7 set<ll> st; void dosth(ll n,ll a,ll l) { if (n==1) { st.insert(a); return ; } for (int j=1;j*j<=n;j++) { if (n%j==0) { if (j>=l) dosth(n/j,a+j-1,j); if (n/j>=l) dosth(j,a+n/j-1,n/j); } } } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); if (fopen("t.inp", "r")) { freopen("test.inp", "r", stdin); freopen("test.out", "w", stdout); } ll n; cin>> n; dosth(n,0,2); cout <<st.size()<<endl; for (auto to:st) { cout <<to<<" "; } } /*1 10 6 0 9 16 0 6 2 1 5 10 15 */

Compilation message (stderr)

toy.cpp:19:15: warning: overflow in conversion from 'double' to 'int' changes value from '3.0e+18' to '2147483647' [-Woverflow]
   19 | const ll base=3e18;
      |               ^~~~
toy.cpp: In function 'int main()':
toy.cpp:47:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   47 |         freopen("test.inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
toy.cpp:48:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   48 |         freopen("test.out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#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...