每日一题 第十六期 Codeforces Round 911 (Div. 2)

B. Laura and Operations

time limit per test: 2 seconds

memory limit per test: 256 megabytes

input: standard input

output: standard output
Laura is a girl who does not like combinatorics. Nemanja will try to convince her otherwise.

Nemanja wrote some digits on the board. All of them are either 1 1 1, 2 2 2, or 3 3 3. The number of digits 1 1 1 is a a a. The number of digits 2 2 2 is b b b and the number of digits 3 3 3 is c c c. He told Laura that in one operation she can do the following:

  • Select two different digits and erase them from the board. After that, write the digit ( 1 1 1, 2 2 2, or 3 3 3) different from both erased digits.

For example, let the digits be 1 1 1, 1 1 1, 1 1 1, 2 2 2, 3 3 3, 3 3 3. She can choose digits 1 1 1 and 3 3 3 and erase them. Then the board will look like this 1 1 1, 1 1 1, 2 2 2, 3 3 3. After that, she has to write another digit 2 2 2, so at the end of the operation, the board will look like 1 1 1, 1 1 1, 2 2 2, 3 3 3, 2 2 2.

Nemanja asked her whether it was possible for only digits of one type to remain written on the board after some operations. If so, which digits can they be?

Laura was unable to solve this problem and asked you for help. As an award for helping her, she will convince Nemanja to give you some points.
Input

Each test contains multiple test cases. The first line contains the number of test cases t t t ( 1 ≤ t ≤ 1 0 5 1 \le t \le 10^5 1t105). The description of the test cases follows.

The first and only line of each test case contains three integers a a a, b b b, c c c ( 1 ≤ a , b , c ≤ 100 1 \le a, b, c \le 100 1a,b,c100) — the number of ones, number of twos, and number of threes, respectively.
Output

For each test case, output one line containing 3 3 3 integers.

The first one should be 1 1 1 if it is possible that after some operations only digits 1 1 1 remain on the board, and 0 0 0 otherwise.

Similarly, the second one should be 1 1 1 if it is possible that after some operations only digits 2 2 2 remain on the board, and 0 0 0 otherwise.

Similarly, the third one should be 1 1 1 if it is possible that after some operations only digits 3 3 3 remain on the board, and 0 0 0 otherwise.

Example
inputCopy
3
1 1 1
2 3 2
82 47 59
outputCopy
1 1 1
0 1 0
1 0 0

Note

In the first test case, Laura can remove digits 2 2 2 and 3 3 3 and write digit 1 1 1. After that, the board will have 2 2 2 digits 1 1 1. She can make it have only digits 2 2 2 or 3 3 3 left by performing a similar operation.

In the second test case, she can remove digits 1 1 1 and 3 3 3 and write a digit 2 2 2. After performing that operation 2 2 2 times, the board will have only digits 2 2 2 left. It can be proven that there is no way to have only digits 1 1 1 or only digits 3 3 3 left.

In the third test case, there is a sequence of operations that leaves only digits 1 1 1 on the board. It can be proven that there is no way to have only digits 2 2 2 or only digits 3 3 3 left.

AC代码:

#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<queue>
#include<string>
#include<bitset>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<numeric>
#define endl '\n'
using namespace std;

typedef long long ll;
typedef pair<int, int>PII;
const int N=3e5+10;
const int MOD=998244353;
const int INF=0X3F3F3F3F;
const int dx[]={-1,1,0,0,-1,-1,+1,+1};
const int dy[]={0,0,-1,1,-1,+1,-1,+1};
const int M = 1e6 + 10;

int t;

int main()
{
	cin >> t;
	while(t --){
		int a, b, c;
		cin >> a >> b >> c;
		if(abs(b - c) % 2 == 0) cout << 1 << " ";
		else cout << 0 << " ";
		if(abs(a - c) % 2 == 0) cout << 1 << " ";
		else cout << 0 << " ";
		if(abs(a - b) % 2 == 0) cout << 1 << " ";
		else cout << 0 << " ";
		cout << endl;
	}
	return 0;
}

相关推荐

  1. 每日 Codeforces Round 911 (Div. 2)

    2024-03-21 06:48:05       20 阅读
  2. 每日 单调队列

    2024-03-21 06:48:05       9 阅读
  3. 每日 洛谷 回文日期

    2024-03-21 06:48:05       16 阅读
  4. 每日 洛谷 统计子矩阵

    2024-03-21 06:48:05       18 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-03-21 06:48:05       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-03-21 06:48:05       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-03-21 06:48:05       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-03-21 06:48:05       20 阅读

热门阅读

  1. dataGridView 绑定List 显示内容不刷新

    2024-03-21 06:48:05       21 阅读
  2. 突破编程_C++_STL教程( queue 的基础知识)

    2024-03-21 06:48:05       18 阅读
  3. 计算机网络题,网上的记录下,计算题

    2024-03-21 06:48:05       20 阅读
  4. Python基础----数据容器(持续更新中)

    2024-03-21 06:48:05       21 阅读
  5. 获取比特币和莱特币的实时价格

    2024-03-21 06:48:05       18 阅读
  6. 记录新人的web3之旅

    2024-03-21 06:48:05       18 阅读
  7. vue3+vite+Electron构建跨平台应用

    2024-03-21 06:48:05       21 阅读
  8. MATLAB/Simulink 学习路径 chhttty个人博客总目录 参见

    2024-03-21 06:48:05       20 阅读