답안 #1032488

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1032488 2024-07-23T20:59:41 Z hasan2006 Nice sequence (IZhO18_sequence) C++17
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>

using namespace std;

#define TL ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define rall(s) s.rbegin(),s.rend()
#define all(s) s.begin(),s.end()
#define pb push_back
#define se second
#define fi first
#define ll long long
#define ld long double
#define YES cout<<"YES\n"
#define Yes cout<<"Yes\n"
#define yes cout<<"yes\n"
#define NO cout<<"NO\n"
#define No cout<<"No\n"
#define no cout<<"no\n"


const int N = 1e5 + 9 , mod = 1e9 + 7;
ll a[N] , b[N] , dp[N] , c[N] ,d[N] ;

void solve()
{
    ll n , q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ;
    cin>>n>>m;
    if(n == m && n > 1){
        cout<<n - 1<<"\n";
        for(i = 1; i < n; i++)
            cout<<i<<" ";
        cout<<"\n";
        return;
    }
    if(m == 2 * n - 1){
        cout<<m<<"\n";
        for(i = 1; i < n; i++)
            cout<<2<<" ";
        cout<<-m<<" ";
        for(i = 1; i < n; i++)
            cout<<2<<" ";
        cout<<"\n";
        return;
    }
    if(n == 2 * m - 1){
        cout<<n<<"\n";
        for(i = 1; i < m; i++)
            cout<<-2<<" ";
        cout<<m<<" ";
        for(i = 1; i <= m; i++)
            cout<<-2<<" ";
        cout<<"\n";
        return;
    }
    if(n <  m && m > 1){
        cout<<m - 1<<"\n";
        for(i = 1; i < m; i++)
            cout<<-1<<" ";
        cout<<"\n";
        return;
    }
    if(n >=  m && n > 1 ){
        cout<<n - 1<<"\n";
        for(i = 1; i < n; i++)
            cout<<i<<" ";
        cout<<"\n";
        return;
    }
    cout<<0<<"\n";
}

int main(){
    TL;
    /*#ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif*/
    int t = 1;
    cin>>t;
    while(t--)
     {
        solve();
     }
}
// Author : حسن

Compilation message

sequence.cpp: In function 'void solve()':
sequence.cpp:26:12: warning: unused variable 'q' [-Wunused-variable]
   26 |     ll n , q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ;
      |            ^
sequence.cpp:26:20: warning: unused variable 'j' [-Wunused-variable]
   26 |     ll n , q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ;
      |                    ^
sequence.cpp:26:23: warning: unused variable 'l' [-Wunused-variable]
   26 |     ll n , q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ;
      |                       ^
sequence.cpp:26:26: warning: unused variable 'r' [-Wunused-variable]
   26 |     ll n , q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ;
      |                          ^
sequence.cpp:26:30: warning: unused variable 'x' [-Wunused-variable]
   26 |     ll n , q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ;
      |                              ^
sequence.cpp:26:34: warning: unused variable 'y' [-Wunused-variable]
   26 |     ll n , q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ;
      |                                  ^
sequence.cpp:26:38: warning: unused variable 's' [-Wunused-variable]
   26 |     ll n , q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ;
      |                                      ^
sequence.cpp:26:46: warning: unused variable 'f' [-Wunused-variable]
   26 |     ll n , q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ;
      |                                              ^
sequence.cpp:26:50: warning: unused variable 'k' [-Wunused-variable]
   26 |     ll n , q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ;
      |                                                  ^
sequence.cpp:26:58: warning: unused variable 'mn' [-Wunused-variable]
   26 |     ll n , q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ;
      |                                                          ^~
sequence.cpp:26:69: warning: unused variable 'mx' [-Wunused-variable]
   26 |     ll n , q , i , j ,l ,r , x , y , s = 0 , f , k , m , mn = 1e18, mx = 0 ;
      |                                                                     ^~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB there is incorrect sequence
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB there is incorrect sequence
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB there is incorrect sequence
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Jury has the better answer : jans = 5, pans = 3
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB there is incorrect sequence
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB there is incorrect sequence
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB there is incorrect sequence
2 Halted 0 ms 0 KB -