답안 #320921

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
320921 2020-11-10T09:06:50 Z shrek12357 Nice sequence (IZhO18_sequence) C++14
15 / 100
13 ms 748 KB
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <climits>
#include <cmath>
#include <fstream>
#include <queue>
#include <stack>
#include <bitset>
using namespace std;
#define ll long long
//cin.tie(0);ios_base::sync_with_stdio(0); 

void solve() {
	int n, m;
	cin >> n >> m;
	int sign = 1;
	if (m > n) {
		sign = -1;
	}
	if (n < m) {
		swap(n, m);
	}
	if (n == m) {
		cout << n - 1 << endl;
		if (n - 1 != 0) {
			for (int i = 0; i < n - 1; i++) {
				cout << 1 << " ";
			}
			cout << endl;
		}
		return;
	}
	if (n % m == 0) {
		cout << n - 1 << endl;
		for (int i = 0; i < n - 1; i++) {
			cout << 1 * sign << " ";
		}
		cout << endl;
		return;
	}
	else {
		cout << n << endl;
		for (int i = 0; i < n; i++) {
			if (i % 2 == 0) {
				cout << n * sign * -1 << " ";
			}
			else {
				cout << (n + 1) * sign << " ";
			}
		}
		cout << endl;
		return;
	}
}

int main(){
	int t;
	cin >> t;
	while (t--) {
		solve();
	}
}
# 결과 실행 시간 메모리 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 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 1 ms 364 KB Ok
5 Correct 1 ms 364 KB Ok
6 Correct 3 ms 364 KB Ok
7 Correct 11 ms 620 KB Ok
8 Correct 6 ms 492 KB Ok
9 Correct 13 ms 748 KB Ok
10 Correct 8 ms 620 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 = 8
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Jury has the better answer : jans = 5, pans = 4
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 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 = 8
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 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 1 ms 364 KB Ok
17 Correct 1 ms 364 KB Ok
18 Correct 3 ms 364 KB Ok
19 Correct 11 ms 620 KB Ok
20 Correct 6 ms 492 KB Ok
21 Correct 13 ms 748 KB Ok
22 Correct 8 ms 620 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 = 8
27 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 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 1 ms 364 KB Ok
17 Correct 1 ms 364 KB Ok
18 Correct 3 ms 364 KB Ok
19 Correct 11 ms 620 KB Ok
20 Correct 6 ms 492 KB Ok
21 Correct 13 ms 748 KB Ok
22 Correct 8 ms 620 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 = 8
27 Halted 0 ms 0 KB -