답안 #673906

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
673906 2022-12-22T11:20:39 Z ReLice Nice sequence (IZhO18_sequence) C++14
6 / 100
1 ms 332 KB
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long
#define pb push_back
#define fr first
#define sc second
void start(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
const ll N = 4e5 + 10 ;
const ll mod=1e9+7;
ll pr[N],suf[N];
void solve(){
    ll n,i,x,y,mx=-1;
    ll m,k,sum=0,c=0,j;
    cin>>n>>m;
    if(n==m){
        cout<<n-1<<endl;
        for(i=0;i<n-1;i++){
            cout<<1<<' ';
        }
    }
    else{
        ll mn=min(n,m);
        mx=max(n,m);
        if(mn*2-1>mx-1){
                cout<<mn*2-1<<endl;
            if(mn==n){
                for(i=1;i<mn;i++){
                    cout<<2<<' ';
                }
                cout<<-mn*2+1<<' ';
                for(i=1;i<mn;i++){
                    cout<<2<<' ';
                }
            }
            else {
                for(i=1;i<mn;i++){
                    cout<<-2<<' ';
                }
                cout<<mn*2-1<<' ';
                for(i=1;i<mn;i++){
                    cout<<-2<<' ';
                }
            }
        }
        else {
            cout<<mx-1<<endl;
            if(n<m){
                for(i=1;i<m;i++){
                    cout<<-1<<' ';
                }
            }
            else {
                for(i=1;i<n;i++){
                    cout<<1<<' ';
                }
            }
        }
    }
    cout<<endl;
}
main(){
    //fre("");
    start();
    ll t=1;
    cin>>t;
    while(t--)solve();

}

Compilation message

sequence.cpp: In function 'void solve()':
sequence.cpp:17:12: warning: unused variable 'x' [-Wunused-variable]
   17 |     ll n,i,x,y,mx=-1;
      |            ^
sequence.cpp:17:14: warning: unused variable 'y' [-Wunused-variable]
   17 |     ll n,i,x,y,mx=-1;
      |              ^
sequence.cpp:18:10: warning: unused variable 'k' [-Wunused-variable]
   18 |     ll m,k,sum=0,c=0,j;
      |          ^
sequence.cpp:18:12: warning: unused variable 'sum' [-Wunused-variable]
   18 |     ll m,k,sum=0,c=0,j;
      |            ^~~
sequence.cpp:18:18: warning: unused variable 'c' [-Wunused-variable]
   18 |     ll m,k,sum=0,c=0,j;
      |                  ^
sequence.cpp:18:22: warning: unused variable 'j' [-Wunused-variable]
   18 |     ll m,k,sum=0,c=0,j;
      |                      ^
sequence.cpp: At global scope:
sequence.cpp:66:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   66 | main(){
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Ok
2 Correct 1 ms 328 KB Ok
3 Correct 1 ms 212 KB Ok
4 Correct 0 ms 328 KB Ok
5 Correct 1 ms 212 KB Ok
6 Correct 0 ms 212 KB Ok
7 Correct 1 ms 212 KB Ok
8 Correct 0 ms 328 KB Ok
9 Correct 1 ms 328 KB Ok
10 Correct 0 ms 212 KB Ok
11 Correct 1 ms 212 KB Ok
12 Correct 1 ms 212 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Jury has the better answer : jans = 5, pans = 4
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Ok
2 Correct 1 ms 332 KB Ok
3 Incorrect 1 ms 212 KB Jury has the better answer : jans = 5, pans = 4
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Jury has the better answer : jans = 6, pans = 5
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Ok
2 Correct 1 ms 328 KB Ok
3 Correct 1 ms 212 KB Ok
4 Correct 0 ms 328 KB Ok
5 Correct 1 ms 212 KB Ok
6 Correct 0 ms 212 KB Ok
7 Correct 1 ms 212 KB Ok
8 Correct 0 ms 328 KB Ok
9 Correct 1 ms 328 KB Ok
10 Correct 0 ms 212 KB Ok
11 Correct 1 ms 212 KB Ok
12 Correct 1 ms 212 KB Ok
13 Correct 1 ms 332 KB Ok
14 Correct 1 ms 332 KB Ok
15 Incorrect 1 ms 212 KB Jury has the better answer : jans = 5, pans = 4
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Ok
2 Correct 1 ms 328 KB Ok
3 Correct 1 ms 212 KB Ok
4 Correct 0 ms 328 KB Ok
5 Correct 1 ms 212 KB Ok
6 Correct 0 ms 212 KB Ok
7 Correct 1 ms 212 KB Ok
8 Correct 0 ms 328 KB Ok
9 Correct 1 ms 328 KB Ok
10 Correct 0 ms 212 KB Ok
11 Correct 1 ms 212 KB Ok
12 Correct 1 ms 212 KB Ok
13 Incorrect 0 ms 212 KB Jury has the better answer : jans = 5, pans = 4
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Ok
2 Correct 1 ms 328 KB Ok
3 Correct 1 ms 212 KB Ok
4 Correct 0 ms 328 KB Ok
5 Correct 1 ms 212 KB Ok
6 Correct 0 ms 212 KB Ok
7 Correct 1 ms 212 KB Ok
8 Correct 0 ms 328 KB Ok
9 Correct 1 ms 328 KB Ok
10 Correct 0 ms 212 KB Ok
11 Correct 1 ms 212 KB Ok
12 Correct 1 ms 212 KB Ok
13 Incorrect 0 ms 212 KB Jury has the better answer : jans = 5, pans = 4
14 Halted 0 ms 0 KB -