Submission #683878

# Submission time Handle Problem Language Result Execution time Memory
683878 2023-01-19T14:15:44 Z opPO Nice sequence (IZhO18_sequence) C++17
15 / 100
7 ms 1144 KB
#pragma GCC optimize("O3,unroll-loops")
#include <bits/stdc++.h>

using namespace std;

#define int long long
#define f first
#define s second
#define pb push_back
#define ld long double
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define vec vector

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

mt19937_64 gen(chrono::steady_clock::now().time_since_epoch().count());
const ld eps = 1e-6;
const int mod = 998244353;
const int oo = 2e9;
const ll OO = 2e18;
const int N = 1e5 + 10;

void solve()
{
    int n, m;
    cin >> n >> m;
    int neg = 1;
    if (n > m)
    {
        swap(n, m);
        neg *= -1;
    }
    if (m % n == 0)
    {
        vec<int> ans;
        for (int i = 1; i < m; i++) ans.pb(-1);
        cout << sz(ans) << "\n";
        for (int &x : ans) cout << x * neg << " ";
        cout << "\n";
        return;
    }
    vec<int> ans;
    for (int i = 1; i <= m; i++)
    {
        if (i & 1) ans.pb(1e9 - 1);
        else ans.pb(-1e9);
    }
    cout << sz(ans) << "\n";
    for (int &x : ans) cout << x * neg << " ";
    cout << "\n";
}

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    while (t--)
        solve();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Ok
2 Correct 1 ms 328 KB Ok
3 Correct 0 ms 212 KB Ok
4 Correct 1 ms 212 KB Ok
5 Correct 1 ms 212 KB Ok
6 Correct 1 ms 212 KB Ok
7 Correct 1 ms 212 KB Ok
8 Correct 1 ms 212 KB Ok
9 Correct 1 ms 212 KB Ok
10 Correct 1 ms 212 KB Ok
11 Correct 1 ms 320 KB Ok
12 Correct 1 ms 324 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 1 ms 320 KB Ok
2 Correct 1 ms 212 KB Ok
3 Correct 1 ms 212 KB Ok
4 Correct 1 ms 212 KB Ok
5 Correct 0 ms 212 KB Ok
6 Correct 2 ms 468 KB Ok
7 Correct 6 ms 1100 KB Ok
8 Correct 4 ms 596 KB Ok
9 Correct 7 ms 1144 KB Ok
10 Correct 5 ms 724 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Ok
2 Correct 1 ms 328 KB Ok
3 Correct 1 ms 320 KB Ok
4 Incorrect 0 ms 212 KB Jury has the better answer : jans = 9, pans = 8
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 328 KB Jury has the better answer : jans = 5, pans = 4
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Ok
2 Correct 1 ms 328 KB Ok
3 Correct 0 ms 212 KB Ok
4 Correct 1 ms 212 KB Ok
5 Correct 1 ms 212 KB Ok
6 Correct 1 ms 212 KB Ok
7 Correct 1 ms 212 KB Ok
8 Correct 1 ms 212 KB Ok
9 Correct 1 ms 212 KB Ok
10 Correct 1 ms 212 KB Ok
11 Correct 1 ms 320 KB Ok
12 Correct 1 ms 324 KB Ok
13 Correct 0 ms 212 KB Ok
14 Correct 1 ms 328 KB Ok
15 Correct 1 ms 320 KB Ok
16 Incorrect 0 ms 212 KB Jury has the better answer : jans = 9, pans = 8
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Ok
2 Correct 1 ms 328 KB Ok
3 Correct 0 ms 212 KB Ok
4 Correct 1 ms 212 KB Ok
5 Correct 1 ms 212 KB Ok
6 Correct 1 ms 212 KB Ok
7 Correct 1 ms 212 KB Ok
8 Correct 1 ms 212 KB Ok
9 Correct 1 ms 212 KB Ok
10 Correct 1 ms 212 KB Ok
11 Correct 1 ms 320 KB Ok
12 Correct 1 ms 324 KB Ok
13 Correct 1 ms 320 KB Ok
14 Correct 1 ms 212 KB Ok
15 Correct 1 ms 212 KB Ok
16 Correct 1 ms 212 KB Ok
17 Correct 0 ms 212 KB Ok
18 Correct 2 ms 468 KB Ok
19 Correct 6 ms 1100 KB Ok
20 Correct 4 ms 596 KB Ok
21 Correct 7 ms 1144 KB Ok
22 Correct 5 ms 724 KB Ok
23 Correct 0 ms 212 KB Ok
24 Correct 1 ms 328 KB Ok
25 Correct 1 ms 320 KB Ok
26 Incorrect 0 ms 212 KB Jury has the better answer : jans = 9, pans = 8
27 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Ok
2 Correct 1 ms 328 KB Ok
3 Correct 0 ms 212 KB Ok
4 Correct 1 ms 212 KB Ok
5 Correct 1 ms 212 KB Ok
6 Correct 1 ms 212 KB Ok
7 Correct 1 ms 212 KB Ok
8 Correct 1 ms 212 KB Ok
9 Correct 1 ms 212 KB Ok
10 Correct 1 ms 212 KB Ok
11 Correct 1 ms 320 KB Ok
12 Correct 1 ms 324 KB Ok
13 Correct 1 ms 320 KB Ok
14 Correct 1 ms 212 KB Ok
15 Correct 1 ms 212 KB Ok
16 Correct 1 ms 212 KB Ok
17 Correct 0 ms 212 KB Ok
18 Correct 2 ms 468 KB Ok
19 Correct 6 ms 1100 KB Ok
20 Correct 4 ms 596 KB Ok
21 Correct 7 ms 1144 KB Ok
22 Correct 5 ms 724 KB Ok
23 Correct 0 ms 212 KB Ok
24 Correct 1 ms 328 KB Ok
25 Correct 1 ms 320 KB Ok
26 Incorrect 0 ms 212 KB Jury has the better answer : jans = 9, pans = 8
27 Halted 0 ms 0 KB -