Submission #920775

#TimeUsernameProblemLanguageResultExecution timeMemory
920775Sir_Ahmed_ImranToys (CEOI18_toy)C++17
100 / 100
746 ms80244 KiB
///~~~LOTA~~~/// #include <bits/stdc++.h> using namespace std; #define nl '\n' #define ff first #define ss second #define add insert #define ll long long #define append push_back #define all(x) (x).begin(),(x).end() #define pii pair<int,int> #define N 2001 unordered_map<int,unordered_set<int>> x; void compute(int n){ int m=sqrtl(n); x[n].add(n-1); for(int i=2;i<=m;i++){ if(n%i) continue; for(auto& j:x[n/i]) x[n].add(j+i-1); } } void solve(){ int n,m,o,p,q,r; cin>>n; m=sqrtl(n); vector<int> v; for(int i=2;i<=m;i++){ if(n%i) continue; v.append(n/i); v.append(i); } sort(all(v)); for(auto& i:v) compute(i); compute(n); cout<<x[n].size()<<nl; v.clear(); for(auto& i:x[n]) v.append(i); sort(all(v)); for(auto& i:v) cout<<i<<' '; } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); solve(); return 0; }

Compilation message (stderr)

toy.cpp: In function 'void solve()':
toy.cpp:24:13: warning: unused variable 'o' [-Wunused-variable]
   24 |     int n,m,o,p,q,r;
      |             ^
toy.cpp:24:15: warning: unused variable 'p' [-Wunused-variable]
   24 |     int n,m,o,p,q,r;
      |               ^
toy.cpp:24:17: warning: unused variable 'q' [-Wunused-variable]
   24 |     int n,m,o,p,q,r;
      |                 ^
toy.cpp:24:19: warning: unused variable 'r' [-Wunused-variable]
   24 |     int n,m,o,p,q,r;
      |                   ^
#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...