제출 #1167346

#제출 시각아이디문제언어결과실행 시간메모리
1167346SmuggingSpunToys (CEOI18_toy)C++20
59 / 100
1 ms400 KiB
#include<bits/stdc++.h> #define taskname "B" using namespace std; int n; namespace sub123{ const int lim = 1e5 + 5; vector<int>d; int current = 0; bitset<lim>ans; void play(int N, int pre){ if(N == 1){ ans.set(current); return; } for(int i = pre; i < d.size() && d[i] <= N; i++){ if(N % d[i] == 0){ current += d[i] - 1; play(N / d[i], i); current -= d[i] - 1; } } } void solve(){ for(int i = 2; i * i <= n; i++){ if(n % i == 0){ d.emplace_back(i); if(i * i != n){ d.emplace_back(n / i); } } } sort(d.begin(), d.end()); d.emplace_back(n); ans.reset(); play(n, 0); cout << ans.count() << "\n"; for(int i = 0; i <= n; i++){ if(ans.test(i)){ cout << i << " "; } } } } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if(fopen(taskname".inp", "r")){ freopen(taskname".inp", "r", stdin); } cin >> n; if(n <= 100000){ sub123::solve(); } }

컴파일 시 표준 에러 (stderr) 메시지

toy.cpp: In function 'int main()':
toy.cpp:47:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   47 |                 freopen(taskname".inp", "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...