제출 #378935

#제출 시각아이디문제언어결과실행 시간메모리
378935casperwangNice sequence (IZhO18_sequence)C++14
0 / 100
1 ms364 KiB
#include <bits/stdc++.h>
using namespace std;
#define debug(args...) kout("[ " + string(#args) + " ]", args)
void kout() { cerr << endl; }
template <class T, class ...U> void kout(T a, U ...b) { cerr << a << ' ',kout(b...); }
template <class T> void pary(T L, T R) { while (L != R) cerr << *L << " \n"[++L==R]; }

const int MAXN = 200000;
int t;
int n, m;
bool flag;
int len;
int a[MAXN+1];

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> t;
	while (t--) {
		cin >> n >> m;
		if (n > m) swap(n, m), flag = true;
		if (m % n == 0) {
			len = m-1;
			for (int i = 1; i <= len; i++)
				a[i] = (flag ? 1 : -1);
		}
		cout << len << '\n';
		for (int i = 1; i <= len; i++)
			cout << a[i] << " \n"[i==len];
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...