Submission #424663

#TimeUsernameProblemLanguageResultExecution timeMemory
424663A_DToys (CEOI18_toy)C++14
0 / 100
0 ms204 KiB
#include <bits/stdc++.h> #define int long long #define ii pair<int,int> #define F first #define S second #define du long double using namespace std; const int N=1e8+5; bool freq[N]; vector<int> vec; void solve() { int n; cin>>n; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ for(int k=1;k<=n;k++){ if((i*j*k)==n){ if(freq[i+j+k])continue; freq[i+j+k]=1; cout<<i<<" "<<j<<" "<<k<<endl; } } } } /* for(int i=1;i<=n;i++){ for(int j=1;j*i<=n;j++){ int u=i*j; if(n%u==0){ int v=n/u; if(freq[i+j+v])continue; cout<<i<<" "<<j<<" "<<v<<endl; freq[i+j+v]=1; } } } */ for(int i=1;i<=n+3;i++){ if(freq[i])vec.push_back(i-3); } int sz=vec.size(); printf("%lld\n",sz); for(auto x:vec)printf("%lld ",x); } main() { int t=1; //cin>>t; while(t--)solve(); }

Compilation message (stderr)

toy.cpp:46:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   46 | main()
      | ^~~~
#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...