제출 #321006

#제출 시각아이디문제언어결과실행 시간메모리
321006phathnvFibonacci representations (CEOI18_fib)C++11
0 / 100
1 ms364 KiB
#include <bits/stdc++.h> #define mp make_pair #define X first #define Y second #define taskname "Toys" using namespace std; typedef long long ll; typedef pair <int, int> ii; int n; vector <int> divisors; vector < set<int> > res; map <int, int> pos; void readInput(){ ios_base::sync_with_stdio(0); cin >> n; } void solve(){ for(int i = 1; i * i <= n; i++){ if (n % i) continue; divisors.push_back(i); if (i * i != n) divisors.push_back(n / i); } sort(divisors.begin(), divisors.end()); res.resize(divisors.size()); for(int i = 0; i < (int) divisors.size(); i++) pos[divisors[i]] = i; for(int i = 0; i < (int) divisors.size(); i++){ res[i].insert(divisors[i] - 1); for(int j = i + 1; j < (int) divisors.size(); j++){ if (divisors[j] % divisors[i]) continue; for(int x : res[i]) res[j].insert(x + divisors[j] / divisors[i] - 1); } } cout << res.back().size() << '\n'; for(int x : res.back()) cout << x << ' '; } int main(){ if (fopen(taskname".inp", "r")){ freopen(taskname".inp", "r", stdin); freopen(taskname".out", "w", stdout); } readInput(); solve(); return 0; }

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

fib.cpp: In function 'int main()':
fib.cpp:52:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   52 |         freopen(taskname".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
fib.cpp:53:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   53 |         freopen(taskname".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...