Submission #64138717


Source Code Expand

#include<bits/stdc++.h>
using namespace std;

#define INF 1234567890
#define ll long long
#define MOD 998244353

int T;
int R, B;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	cin.exceptions(ios::badbit | ios::failbit);
	cin >> T;
	while(T--)
	{
		cin >> R >> B;
		if (R % 2 == 1) { cout << "No\n"; continue; }
		if (R == 0 && B % 2 == 1) { cout << "No\n"; continue; }
		cout << "Yes\n";

		if (R == 0)
		{
			int x = 1000000, y = 1000000;
			for(int i=0; i<B/2; i++)
				cout << "B " << x+i << " " << y+i << "\n";
			for(int i=B/2-1; i>=0; i--)
				cout << "B " << x+i-1 << " " << y+i+1 << "\n";
			continue;
		}
		
		int X = 1000000, Y = 1000000;
		for(int i=0; i<R/2; i++)
			cout << "R " << X << " " << Y-i << "\n";
		for(int i=R/2-1; i>=0; i--)
			cout << "R " << X+1 << " " << Y-i << "\n";

		if (B >= 1)
		{
			int x = -1, y = -1;
			if (B % 2 == 1) x = X+1, y = Y+1;
			else x = X+2, y = Y;

			if (B % 2 == 1)
			{
				for(int i=0; i<B/2; i++)
				{
					cout << "B " << x << " " << y << "\n";
					x--, y++;
				}
				
				cout << "B " << x << " " << y << "\n";
				x--, y--;

				for(int i=0; i<B/2; i++)
				{
					cout << "B " << x << " " << y << "\n";
					x++, y--;
				}
			}
			else
			{
				for(int i=0; i<B/2; i++)
				{
					cout << "B " << x << " " << y << "\n";
					x--, y++;
				}

				cout << "B " << x << " " << y << "\n";
				x--, y--;

				for(int i=0; i<B/2-1; i++)
				{
					cout << "B " << x << " " << y << "\n";
					x++, y--;
				}
			}
		}
	}
	return 0;
}

Submission Info

Submission Time
Task C - Hamiltonian Pieces
User edenooo
Language C++ 20 (gcc 12.2)
Score 600
Code Size 1578 Byte
Status AC
Exec Time 24 ms
Memory 4032 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 600 / 600
Status
AC × 1
AC × 50
Set Name Test Cases
Sample 00_sample_01.txt
All 00_sample_01.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 02_small_01.txt, 03_medium_01.txt, 03_medium_02.txt, 03_medium_03.txt, 03_medium_04.txt, 03_medium_05.txt, 03_medium_06.txt, 03_medium_07.txt, 03_medium_08.txt, 03_medium_09.txt, 03_medium_10.txt, 04_large_01.txt, 04_large_02.txt, 04_large_03.txt, 04_large_04.txt, 04_large_05.txt, 05_max_01.txt, 05_max_02.txt, 05_max_03.txt, 05_max_04.txt, 05_max_05.txt, 05_max_06.txt, 05_max_07.txt, 05_max_08.txt, 05_max_09.txt, 05_max_10.txt, 06_sum_max_01.txt, 06_sum_max_02.txt, 06_sum_max_03.txt, 06_sum_max_04.txt, 06_sum_max_05.txt, 06_sum_max_06.txt, 06_sum_max_07.txt, 06_sum_max_08.txt, 06_sum_max_09.txt, 06_sum_max_10.txt, 07_R_or_B_zero_01.txt, 07_R_or_B_zero_02.txt, 07_R_or_B_zero_03.txt, 07_R_or_B_zero_04.txt, 07_R_or_B_zero_05.txt, 07_R_or_B_zero_06.txt, 07_R_or_B_zero_07.txt, 07_R_or_B_zero_08.txt, 07_R_or_B_zero_09.txt, 07_R_or_B_zero_10.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 1 ms 3504 KiB
01_handmade_01.txt AC 24 ms 3480 KiB
01_handmade_02.txt AC 23 ms 3784 KiB
01_handmade_03.txt AC 23 ms 4032 KiB
02_small_01.txt AC 13 ms 3576 KiB
03_medium_01.txt AC 14 ms 3440 KiB
03_medium_02.txt AC 11 ms 3516 KiB
03_medium_03.txt AC 12 ms 3516 KiB
03_medium_04.txt AC 14 ms 3512 KiB
03_medium_05.txt AC 15 ms 3492 KiB
03_medium_06.txt AC 11 ms 3516 KiB
03_medium_07.txt AC 11 ms 3492 KiB
03_medium_08.txt AC 12 ms 3432 KiB
03_medium_09.txt AC 12 ms 3416 KiB
03_medium_10.txt AC 13 ms 3512 KiB
04_large_01.txt AC 14 ms 3512 KiB
04_large_02.txt AC 21 ms 3492 KiB
04_large_03.txt AC 13 ms 3504 KiB
04_large_04.txt AC 1 ms 3368 KiB
04_large_05.txt AC 20 ms 3568 KiB
05_max_01.txt AC 1 ms 3500 KiB
05_max_02.txt AC 23 ms 3868 KiB
05_max_03.txt AC 23 ms 3788 KiB
05_max_04.txt AC 1 ms 3424 KiB
05_max_05.txt AC 23 ms 3884 KiB
05_max_06.txt AC 1 ms 3400 KiB
05_max_07.txt AC 1 ms 3504 KiB
05_max_08.txt AC 1 ms 3488 KiB
05_max_09.txt AC 1 ms 3332 KiB
05_max_10.txt AC 1 ms 3468 KiB
06_sum_max_01.txt AC 7 ms 3436 KiB
06_sum_max_02.txt AC 18 ms 3504 KiB
06_sum_max_03.txt AC 12 ms 3568 KiB
06_sum_max_04.txt AC 22 ms 3780 KiB
06_sum_max_05.txt AC 13 ms 3580 KiB
06_sum_max_06.txt AC 22 ms 3652 KiB
06_sum_max_07.txt AC 14 ms 3372 KiB
06_sum_max_08.txt AC 23 ms 3860 KiB
06_sum_max_09.txt AC 4 ms 3500 KiB
06_sum_max_10.txt AC 1 ms 3512 KiB
07_R_or_B_zero_01.txt AC 12 ms 3492 KiB
07_R_or_B_zero_02.txt AC 19 ms 3508 KiB
07_R_or_B_zero_03.txt AC 2 ms 3628 KiB
07_R_or_B_zero_04.txt AC 23 ms 3856 KiB
07_R_or_B_zero_05.txt AC 5 ms 3508 KiB
07_R_or_B_zero_06.txt AC 1 ms 3508 KiB
07_R_or_B_zero_07.txt AC 1 ms 3568 KiB
07_R_or_B_zero_08.txt AC 21 ms 3592 KiB
07_R_or_B_zero_09.txt AC 1 ms 3400 KiB
07_R_or_B_zero_10.txt AC 3 ms 3632 KiB