Submission #613704

# Submission time Handle Problem Language Result Execution time Memory
613704 2022-07-30T09:32:46 Z KoD Nice sequence (IZhO18_sequence) C++17
6 / 100
1 ms 452 KB
#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

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 time Memory Grader output
1 Correct 1 ms 212 KB Ok
2 Correct 1 ms 212 KB Ok
3 Correct 0 ms 212 KB Ok
4 Correct 1 ms 212 KB Ok
5 Correct 0 ms 212 KB Ok
6 Correct 0 ms 212 KB Ok
7 Correct 1 ms 212 KB Ok
8 Correct 1 ms 320 KB Ok
9 Correct 1 ms 212 KB Ok
10 Correct 1 ms 212 KB Ok
11 Correct 0 ms 212 KB Ok
12 Correct 0 ms 212 KB Ok
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 444 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 452 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Ok
2 Correct 1 ms 212 KB Ok
3 Correct 0 ms 212 KB Ok
4 Correct 1 ms 212 KB Ok
5 Correct 0 ms 212 KB Ok
6 Correct 0 ms 212 KB Ok
7 Correct 1 ms 212 KB Ok
8 Correct 1 ms 320 KB Ok
9 Correct 1 ms 212 KB Ok
10 Correct 1 ms 212 KB Ok
11 Correct 0 ms 212 KB Ok
12 Correct 0 ms 212 KB Ok
13 Runtime error 1 ms 340 KB Execution killed with signal 11
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Ok
2 Correct 1 ms 212 KB Ok
3 Correct 0 ms 212 KB Ok
4 Correct 1 ms 212 KB Ok
5 Correct 0 ms 212 KB Ok
6 Correct 0 ms 212 KB Ok
7 Correct 1 ms 212 KB Ok
8 Correct 1 ms 320 KB Ok
9 Correct 1 ms 212 KB Ok
10 Correct 1 ms 212 KB Ok
11 Correct 0 ms 212 KB Ok
12 Correct 0 ms 212 KB Ok
13 Runtime error 1 ms 444 KB Execution killed with signal 11
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Ok
2 Correct 1 ms 212 KB Ok
3 Correct 0 ms 212 KB Ok
4 Correct 1 ms 212 KB Ok
5 Correct 0 ms 212 KB Ok
6 Correct 0 ms 212 KB Ok
7 Correct 1 ms 212 KB Ok
8 Correct 1 ms 320 KB Ok
9 Correct 1 ms 212 KB Ok
10 Correct 1 ms 212 KB Ok
11 Correct 0 ms 212 KB Ok
12 Correct 0 ms 212 KB Ok
13 Runtime error 1 ms 444 KB Execution killed with signal 11
14 Halted 0 ms 0 KB -