Submission #343523

# Submission time Handle Problem Language Result Execution time Memory
343523 2021-01-04T07:31:25 Z koketsu Nice sequence (IZhO18_sequence) C++14
9 / 100
10 ms 1004 KB
#include <bits/stdc++.h>
#define pb push_back
#define LL long long
#define Kultivator ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

const LL Mxn = 1e5 + 7;
const LL Mod = 1e9;
const LL Inf = 1e14 + 7;

signed main(){
    Kultivator;
    int tt;
    cin >> tt;
    while(tt--){
        int N, M;
        cin >> N >> M;
        if(N == M){
            cout << N - 1 << '\n';
            for(int i = 1; i < N; i++){
                cout << true << ' ';
            }
        }
        else if(min(N, M) == 2){
            if(max(N, M) % 2){
                cout << max(N, M) << '\n';
                if(N < M){
                    cout << Mod - 1 << ' ';
                    for(int i = 1; i < M - 1; i++){
                        if(i % 2){
                            cout << -Mod << ' ';
                        } else {
                            cout << Mod - 1 << ' ';
                        }
                    }
                    cout << Mod - 1 << ' ';
                } else {
                    cout << -Mod + 1 << ' ';
                    for(int i = 1; i < N - 1; i++){
                        if(i % 2){
                            cout << Mod << ' ';
                        } else {
                            cout << -Mod + 1 << ' ';
                        }
                    }
                    cout << -Mod + 1 << ' ';
                }
            } else {
                cout << max(N, M) - 1 << '\n';
                if(N > M){
                    for(int i = 1; i < N; i++){
                        cout << 1 << ' ';
                    }
                } else {
                    for(int i = 1; i < M; i++){
                        cout << -1 << ' ';
                    }
                }
            }
        } else if(min(N, M) == 1){
            cout << max(N, M) - 1 << '\n';
            if(N < M){
                for(int i = 1; i < M; i++){
                    cout << -1 << ' ';
                }
            } else {
                for(int i = 1; i < N; i++){
                    cout << 1 << ' ';
                }
            }
        }
        cout << '\n';
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Ok
2 Incorrect 1 ms 364 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 364 KB Ok
2 Correct 0 ms 364 KB Ok
3 Correct 1 ms 364 KB Ok
4 Correct 1 ms 384 KB Ok
5 Correct 1 ms 364 KB Ok
6 Correct 2 ms 492 KB Ok
7 Correct 9 ms 876 KB Ok
8 Correct 4 ms 620 KB Ok
9 Correct 10 ms 1004 KB Ok
10 Correct 6 ms 748 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 0 ms 364 KB Ok
2 Correct 0 ms 364 KB Ok
3 Correct 0 ms 364 KB Ok
4 Incorrect 0 ms 364 KB Jury has the better answer : jans = 9, pans = 2
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 364 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Ok
2 Incorrect 1 ms 364 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Ok
2 Incorrect 1 ms 364 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Ok
2 Incorrect 1 ms 364 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -