Submission #91925

# Submission time Handle Problem Language Result Execution time Memory
91925 2018-12-31T14:00:09 Z popovicirobert Nice sequence (IZhO18_sequence) C++14
0 / 100
2 ms 380 KB
#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long
#define ld long double
// 217
// 44

using namespace std;

const int INF = 999999999;
const int MAXN = (int) 2e5;

int arr[2 * MAXN + 1];

int main() {
    //ifstream cin("A.in");
    //ofstream cout("A.out");
    int t, i;
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    cin >> t;
    while(t > 0) {
        t--;
        int n, m;
        cin >> n >> m;
        int mn = min(n, m), mx = max(n, m);
        if(mx % mn == 0) {
            cout << mx - 1 << "\n";
            for(i = 1; i < mx; i++) {
                cout << 1 << " ";
            }
            cout << "\n";
            continue;
        }
        int sz = n + m - 2, val = INF / (n - 1);
        int pos = 1;
        cout << sz << "\n";
        while(pos <= sz) {
            for(i = 1; i <= n - 1 && pos <= sz; i++) {
                arr[pos] = val;
                pos++;
            }
            if(pos <= sz) {
                arr[pos] = - val * (n - 1) - 1;
                pos++;
            }
        }
        int sign = 1;
        if(n != mn) {
            sign = -1;
        }
        for(i = 1; i <= sz; i++) {
            cout << sign * arr[i] << " ";
        }
        cout << "\n";
    }
    //cin.close();
    //cout.close();
    return 0;
}

# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 380 KB there is incorrect sequence
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB there is incorrect sequence
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Ok
2 Incorrect 2 ms 376 KB there is incorrect sequence
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB there is incorrect sequence
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 380 KB there is incorrect sequence
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 380 KB there is incorrect sequence
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 380 KB there is incorrect sequence
2 Halted 0 ms 0 KB -