Submission #1114036

# Submission time Handle Problem Language Result Execution time Memory
1114036 2024-11-18T06:43:34 Z vjudge1 Nice sequence (IZhO18_sequence) C++17
0 / 100
1 ms 508 KB
#include <bits/stdc++.h>
#define pb push_back
#define spc << " " <<
#define endl "\n"
#define all(x) x.begin(), x.end()
#define int long long
#define ii pair<long long,int>
#define vi vector<int>
#define vii vector<ii>
#define st first
#define nd second
#define mid (l+r)/2
#define inf 1e15
#define MOD 998244353
#define MX 100000
using namespace std;


void solve(){
    int n,m; cin >> n >> m;//assuming m is bigger
    int modi=1;
    if(n>m){
        modi=-1;
        swap(n,m);
    }
    if(n==m){
        cout << 0 << endl;
        return;
    }
    if(m-1>=2*n-1){
        cout << m-1 << endl;
        for(int i=1; i<=m-1; i++){
            cout << -modi << " ";
        }
        cout << endl;
    }
    else{
        cout << 2*n-1 << endl;
        for(int i=1; i<=2*n-1; i++){
            if(i==n) cout << -modi*n << " ";
            else cout << modi << " ";
        }
        cout << endl;
    }
}


signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);
    #ifdef Local
    freopen("in","r",stdin);
    freopen("out","w",stdout);
    /*#else
    freopen("248.in","r",stdin);
    freopen("248.out","w",stdout);*/
    #endif


    int t=1;
    cin >> t;
    while(t--) solve();
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 464 KB Ok
2 Correct 1 ms 336 KB Ok
3 Incorrect 1 ms 336 KB Jury has the better answer : jans = 93, pans = 0
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Jury has the better answer : jans = 1, pans = 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 508 KB there is incorrect sequence
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB there is incorrect sequence
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 464 KB Ok
2 Correct 1 ms 336 KB Ok
3 Incorrect 1 ms 336 KB Jury has the better answer : jans = 93, pans = 0
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 464 KB Ok
2 Correct 1 ms 336 KB Ok
3 Incorrect 1 ms 336 KB Jury has the better answer : jans = 93, pans = 0
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 464 KB Ok
2 Correct 1 ms 336 KB Ok
3 Incorrect 1 ms 336 KB Jury has the better answer : jans = 93, pans = 0
4 Halted 0 ms 0 KB -