답안 #92873

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
92873 2019-01-05T11:49:27 Z davitmarg Nice sequence (IZhO18_sequence) C++17
9 / 100
9 ms 888 KB
/*
DEATH-MATCH
Davit-Marg
*/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iterator>
#include <ctype.h>
#include <stdlib.h>  
#include <cassert>
#include <fstream>  
#define mod 1000000007ll
#define LL long long
#define LD long double
#define MP make_pair
#define PB push_back
using namespace std;

int t,n, m;
bool sw;
vector<int> a;
int main()
{
	cin >> t;
	while (t--)
	{
		cin >> n >> m;
		sw = 0;
		a.resize(0);
		if (n < m)
		{
			sw = 1;
			swap(n, m);
		}

		if (m == 2)
		{

			if (n % 2)
			{

				for (int i = n; i >= 1; i--)
					if ((n + 1 - i) % 2)
						a.PB(i / 2+2*n);
					else
						a.PB(-(a.back() + 1));
			}
			else
			{
				for (int i = 1; i < n; i++)
					a.PB(-1);
			}
		}
		cout << a.size() << endl;
		if (a.size() != 0)
		{
			for (int i = 0; i < a.size(); i++)
				cout << a[i] * (2 * (sw)-1) << " ";
			cout << endl;
		}

	}
	return 0;
}

/*


*/

Compilation message

sequence.cpp: In function 'int main()':
sequence.cpp:66:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (int i = 0; i < a.size(); i++)
                    ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Jury has the better answer : jans = 1, pans = 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Ok
2 Correct 2 ms 376 KB Ok
3 Correct 2 ms 256 KB Ok
4 Correct 2 ms 376 KB Ok
5 Correct 2 ms 376 KB Ok
6 Correct 3 ms 376 KB Ok
7 Correct 8 ms 888 KB Ok
8 Correct 5 ms 504 KB Ok
9 Correct 9 ms 888 KB Ok
10 Correct 6 ms 632 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Jury has the better answer : jans = 2, pans = 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Jury has the better answer : jans = 5, pans = 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Jury has the better answer : jans = 1, pans = 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Jury has the better answer : jans = 1, pans = 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Jury has the better answer : jans = 1, pans = 0
2 Halted 0 ms 0 KB -