답안 #378949

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
378949 2021-03-17T07:54:40 Z casperwang Nice sequence (IZhO18_sequence) C++14
15 / 100
11 ms 748 KB
#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];

void solve() {
	if (m % n == 0) {
		len = m-1;
		for (int i = 1; i <= len; i++)
			a[i] = flag ? 1 : -1;
	} else if (n == 2) {
		len = m;
		for (int i = 1; i <= len; i++) {
			if (i & 1)
				a[i] = flag ? -m/2-1 : m/2+1;
			else
				a[i] = flag ? m/2+2 : -m/2-2;
		}
	}
}

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;
		else
			flag = false;
		solve();
		cout << len << '\n';
		for (int i = 1; i <= len; i++)
			cout << a[i] << " \n"[i==len];
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 512 KB Ok
2 Correct 1 ms 364 KB Ok
3 Correct 1 ms 364 KB Ok
4 Correct 1 ms 364 KB Ok
5 Correct 1 ms 364 KB Ok
6 Correct 1 ms 364 KB Ok
7 Correct 1 ms 364 KB Ok
8 Correct 1 ms 364 KB Ok
9 Correct 1 ms 364 KB Ok
10 Correct 1 ms 364 KB Ok
11 Correct 1 ms 364 KB Ok
12 Correct 1 ms 364 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Ok
2 Correct 1 ms 364 KB Ok
3 Correct 1 ms 364 KB Ok
4 Correct 0 ms 364 KB Ok
5 Correct 0 ms 364 KB Ok
6 Correct 2 ms 364 KB Ok
7 Correct 8 ms 748 KB Ok
8 Correct 4 ms 492 KB Ok
9 Correct 11 ms 748 KB Ok
10 Correct 7 ms 748 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Ok
2 Correct 1 ms 364 KB Ok
3 Correct 1 ms 364 KB Ok
4 Incorrect 1 ms 364 KB Jury has the better answer : jans = 9, pans = 0
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Jury has the better answer : jans = 5, pans = 3
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 512 KB Ok
2 Correct 1 ms 364 KB Ok
3 Correct 1 ms 364 KB Ok
4 Correct 1 ms 364 KB Ok
5 Correct 1 ms 364 KB Ok
6 Correct 1 ms 364 KB Ok
7 Correct 1 ms 364 KB Ok
8 Correct 1 ms 364 KB Ok
9 Correct 1 ms 364 KB Ok
10 Correct 1 ms 364 KB Ok
11 Correct 1 ms 364 KB Ok
12 Correct 1 ms 364 KB Ok
13 Correct 1 ms 364 KB Ok
14 Correct 1 ms 364 KB Ok
15 Correct 1 ms 364 KB Ok
16 Incorrect 1 ms 364 KB Jury has the better answer : jans = 9, pans = 0
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 512 KB Ok
2 Correct 1 ms 364 KB Ok
3 Correct 1 ms 364 KB Ok
4 Correct 1 ms 364 KB Ok
5 Correct 1 ms 364 KB Ok
6 Correct 1 ms 364 KB Ok
7 Correct 1 ms 364 KB Ok
8 Correct 1 ms 364 KB Ok
9 Correct 1 ms 364 KB Ok
10 Correct 1 ms 364 KB Ok
11 Correct 1 ms 364 KB Ok
12 Correct 1 ms 364 KB Ok
13 Correct 1 ms 364 KB Ok
14 Correct 1 ms 364 KB Ok
15 Correct 1 ms 364 KB Ok
16 Correct 0 ms 364 KB Ok
17 Correct 0 ms 364 KB Ok
18 Correct 2 ms 364 KB Ok
19 Correct 8 ms 748 KB Ok
20 Correct 4 ms 492 KB Ok
21 Correct 11 ms 748 KB Ok
22 Correct 7 ms 748 KB Ok
23 Correct 1 ms 364 KB Ok
24 Correct 1 ms 364 KB Ok
25 Correct 1 ms 364 KB Ok
26 Incorrect 1 ms 364 KB Jury has the better answer : jans = 9, pans = 0
27 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 512 KB Ok
2 Correct 1 ms 364 KB Ok
3 Correct 1 ms 364 KB Ok
4 Correct 1 ms 364 KB Ok
5 Correct 1 ms 364 KB Ok
6 Correct 1 ms 364 KB Ok
7 Correct 1 ms 364 KB Ok
8 Correct 1 ms 364 KB Ok
9 Correct 1 ms 364 KB Ok
10 Correct 1 ms 364 KB Ok
11 Correct 1 ms 364 KB Ok
12 Correct 1 ms 364 KB Ok
13 Correct 1 ms 364 KB Ok
14 Correct 1 ms 364 KB Ok
15 Correct 1 ms 364 KB Ok
16 Correct 0 ms 364 KB Ok
17 Correct 0 ms 364 KB Ok
18 Correct 2 ms 364 KB Ok
19 Correct 8 ms 748 KB Ok
20 Correct 4 ms 492 KB Ok
21 Correct 11 ms 748 KB Ok
22 Correct 7 ms 748 KB Ok
23 Correct 1 ms 364 KB Ok
24 Correct 1 ms 364 KB Ok
25 Correct 1 ms 364 KB Ok
26 Incorrect 1 ms 364 KB Jury has the better answer : jans = 9, pans = 0
27 Halted 0 ms 0 KB -