Submission #463442

#TimeUsernameProblemLanguageResultExecution timeMemory
463442fuad27Toys (CEOI18_toy)C++14
0 / 100
1 ms204 KiB
#include<bits/stdc++.h> using namespace std; #pragma GCC optmize("O3") typedef int ll; typedef long double ld; #define vii vector<pair<int, int>> #define vi vector<int> #define vl vector<long long> #define vll vector<pair<long long, long long>> #define mp make_pair #define pb push_back #define rep(i, a, b) for(int i = a;i<=b;i++) #define f first #define s second #define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define start int tt;cin>>tt;rep(testcase, 1, tt) #define print(k) cout<<"Case #"<<testcase<<": "<<k<<"\n"; #define endl "\n" set<ll> ans; void solve(ll n, ll k, ll sum) { ans.insert(sum + n -1); for(int i = k;i<= n/k;i++) { if(n%i == 0) { solve(n/i, i, sum + i -1); } } } int main () { //FIO; #ifndef ONLINE_JUDGE freopen("stdin", "r", stdin); freopen("stdout", "w", stdout); freopen("stderr", "w", stderr); #endif int n; scanf("%d", &n); solve(n, 2, 0); printf("%d\n", int(ans.size())); for(int i:ans) { printf("%d ", i); } return 0; }

Compilation message (stderr)

toy.cpp:3: warning: ignoring '#pragma GCC optmize' [-Wunknown-pragmas]
    3 | #pragma GCC optmize("O3")
      | 
toy.cpp: In function 'int main()':
toy.cpp:31:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |  freopen("stdin", "r", stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
toy.cpp:32:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |  freopen("stdout", "w", stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
toy.cpp:33:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |  freopen("stderr", "w", stderr);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
toy.cpp:36:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   36 |  scanf("%d", &n);
      |  ~~~~~^~~~~~~~~~
#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...