Submission #383537

#TimeUsernameProblemLanguageResultExecution timeMemory
383537maximath_1Toys (CEOI18_toy)C++11
100 / 100
3114 ms94980 KiB
#include <stdio.h> #include <string> #include <math.h> #include <algorithm> #include <vector> #include <string.h> #include <numeric> #include <queue> #include <assert.h> #include <map> #include <set> #include <limits.h> using namespace std; #define ll long long #define ld long double const int MX = 100005; const int LG = (int)log2(MX) + 2; const int BLOCK = 105; const ll mod = 1e9 + 7; const ll inv2 = (mod + 1) / 2; #define gc getchar//_unlocked //can't for window server void cin(int &x){ char c = gc(); bool neg = false; for(; c < '0'||'9' < c; c = gc()) if(c == '-') neg=true; x = c - '0'; c = gc(); for(; '0' <= c && c <= '9'; c = gc()) x = (x << 1) + (x << 3) + (c - '0'); if(neg) x = -x; } int n; vector<int> divi; set<int> v[100005]; int main(){ cin(n); for(int i = 1; i * i <= n; i ++) if(n % i == 0){ divi.push_back(i); if(i * i != n) divi.push_back(n / i); } sort(divi.begin(), divi.end()); v[0].insert(0); for(int i = 1; i < divi.size(); i ++){ for(int j = 0; j < i; j ++) if(divi[i] % divi[j] == 0){ for(int k : v[j]) v[i].insert(k + (divi[i] / divi[j] - 1)); } } set<int> ans = v[divi.size() - 1]; printf("%d\n", ans.size()); for(int i : ans) printf("%d ", i); printf("\n"); }

Compilation message (stderr)

toy.cpp: In function 'int main()':
toy.cpp:49:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |  for(int i = 1; i < divi.size(); i ++){
      |                 ~~^~~~~~~~~~~~~
toy.cpp:57:11: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::set<int>::size_type' {aka 'long unsigned int'} [-Wformat=]
   57 |  printf("%d\n", ans.size());
      |          ~^     ~~~~~~~~~~
      |           |             |
      |           int           std::set<int>::size_type {aka long unsigned int}
      |          %ld
#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...