# Codeforces Round #632 (Div. 2)（A+B）

0
14

A. Little Artem

```#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int nk_max = 8 + 5;
const int INF = 0x3fffffff;
int main() {
int t;
int n,m;
cin>>t;
while(t--) {
int B,W;
cin>>n/*行数*/>>m/*列数*/;
int tot=n*m;
char ptr[150][150];
if(tot%2==0) {
B=tot/2;
W=B-1;
} else {
B=(tot/2)+1;
W=tot-B;
}
//涂色
for(int i=1; i<=n; i++) {
for(int j=1; j<=m; j++) {
if(i%2!=0&&j%2==0) {
ptr[i][j]='W';
}
if(i%2!=0&&j%2!=0) {
ptr[i][j]='B';
}
if(i%2==0&&j%2!=0) {
ptr[i][j]='W';
}
if(i%2==0&&j%2==0) {
ptr[i][j]='B';
}
}
}
//        cout<<B<<" "<<W<<"==="<<endl;
if(tot%2==0) {//判断奇偶性，如果是偶数的话
if(ptr[n][m]=='B') {
ptr[n][m-1]='B';
} else {
ptr[n][m]='B';
}
}
for(int i=1; i<=n; i++) {
for(int j=1; j<=m; j++) {
cout<<ptr[i][j];
}
cout<<endl;
}
}
return 0;
}```

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

signed main() {
ios::sync_with_stdio(false);
int t,n,m;
cin>>t;
while(t--) {
cin>>n>>m;
for(int i=1;i<=n;i++) {
for(int j=1;j<=m;j++) {
if(i==1 && j==1) cout<<"W";
else cout<<"B";
}
cout<<endl;
}
}
}```

B. Kind Anton

```#include<iostream>
#include<cstring>
#include<algorithm>
#include<map>
int a[100010]={0};
int b[100010]={0};
using namespace std;;
int main(){
int t,n;
cin>>t;
map<int,int> mp;
while(t--){
mp.clear();
scanf("%d",&n);
for(int i=1;i<=n;i++){
cin>>a[i];
mp[a[i]]++;
}
for(int i=1;i<=n;i++){
cin>>b[i];
}//数据输入完毕，下面开始处理数据
int f=1;
for(int i=n;i>=1;i--){
mp[a[i]]--;
if(a[i]==b[i]){
continue;
}
if(a[i]<b[i]){
if(!mp[1]){
f=0;
break;
}
}
if(a[i]>b[i]){
if(!mp[-1]){
f=0;
break;
}
}
}
if(f){
cout<<"YES"<<endl;
}else{
cout<<"NO"<<endl;
}
}
return 0;
}```

<

0