Submission #887394

# Submission time Handle Problem Language Result Execution time Memory
887394 2023-12-14T12:07:23 Z pcc Nice sequence (IZhO18_sequence) C++14
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>


void solve(){
	int n,m;
	cin>>n>>m;
	int sign = 1;
	if(m>n){
		sign = -1;
		swap(n,m);
	}
	if(n%2 == 0){
		cout<<n-1<<'\n';
		for(int i = 1;i<n;i++)cout<<(i&1?sign:-sign*2)<<' ';
		cout<<'\n';
	}
	else{
		cout<<n<<'\n';
		for(int i = 1;i<=n;i++)cout<<(i&1?2*sign:-3*sign)<<' ';
		cout<<'\n';
	}
	return;
}

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t;cin>>t;
	while(t--)solve();
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB there is incorrect sequence
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB there is incorrect sequence
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB there is incorrect sequence
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB there is incorrect sequence
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB there is incorrect sequence
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB there is incorrect sequence
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB there is incorrect sequence
2 Halted 0 ms 0 KB -