Submission #613704

#TimeUsernameProblemLanguageResultExecution timeMemory
613704KoDNice sequence (IZhO18_sequence)C++17
6 / 100
1 ms452 KiB
#include <bits/stdc++.h> using ll = long long; using std::vector; using std::array; using std::pair; using std::tuple; vector<int> solve(const int N, const int M) { if (M % N == 0) { return vector(M - 1, -1); } vector<int> ret(M, N - 1); for (int i = N - 1; i < M; i += N) { ret[i] = -N; } } int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); int T; std::cin >> T; while (T--) { int N, M; std::cin >> N >> M; vector<int> A; if (N > M) { A = solve(M, N); for (auto& x : A) { x = -x; } } else { A = solve(N, M); } std::cout << A.size() << '\n'; for (int i = 0; i < (int)A.size(); ++i) { if (i > 0) { std::cout << ' '; } std::cout << A[i]; } std::cout << '\n'; } return 0; }

Compilation message (stderr)

sequence.cpp: In function 'std::vector<int> solve(int, int)':
sequence.cpp:13:29: warning: control reaches end of non-void function [-Wreturn-type]
   13 |     vector<int> ret(M, N - 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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...