Submission #666404

#TimeUsernameProblemLanguageResultExecution timeMemory
666404ktkeremToys (CEOI18_toy)C++17
100 / 100
2289 ms86548 KiB
/*#pragma GCC target ("avx2") #pragma GCC optimize ("O3") #pragma GCC optimize("Ofast") #pragma GCC optimize ("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")/**/ #include<bits/stdc++.h> /**/ typedef int ll; //typedef long long ll; typedef unsigned long long ull; typedef std::string str; /*typedef __int128 vll; typedef unsigned __int128 uvll;*/ #define llll std::pair<ll , ll> #define pb push_back #define pf push_front #define halo cout << "hello\n" #define fi first #define sec second #define all(a) a.begin() , a.end() const ll limit = 1e9+7; const ll ous = 1e5 + 7; const ll dx[4] = {-1 , 0 , 1 , 0} , dy[4] = {0,1,0,-1}; ll n , m;std::vector<ll> ar; void solve(){ std::cin >> n; std::vector<ll> dv; for(ll i = 1;n>=i*i;i++){ if(n % i == 0){ dv.pb(i); if(n/i != i){ dv.pb(n/i); } } } std::sort(all(dv)); std::vector<std::set<ll>> v; v.resize(dv.size()); v[0].insert(0); for(ll i = 0;dv.size()>i;i++){ for(ll j = 0;i>j;j++){ if(dv[i] % dv[j] == 0){ for(auto k:v[j]){ v[i].insert(k + dv[i]/dv[j] - 1); } } } } std::cout << v[dv.size()-1].size() << "\n"; for(auto j:v[dv.size()-1]){ std::cout << j << " "; } std::cout << "\n"; return;/**/ } signed main(){ ll t=1; //std::cin >> t; ll o = 1; while(t--){ //cout << "Case " << o++ << ":\n"; solve(); } return 0; }/**/

Compilation message (stderr)

toy.cpp:5:78: warning: "/*" within comment [-Wcomment]
    5 | #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")/**/
      |                                                                               
toy.cpp: In function 'void solve()':
toy.cpp:40:27: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'll' {aka 'int'} [-Wsign-compare]
   40 |     for(ll i = 0;dv.size()>i;i++){
      |                  ~~~~~~~~~^~
toy.cpp: In function 'int main()':
toy.cpp:59:8: warning: unused variable 'o' [-Wunused-variable]
   59 |     ll o = 1;
      |        ^
#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...