A Snuke’s favorite YAKINIKU

#include<bits/stdc++.h> 
using namespace std;
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
For(j,m-1) cout<<a[i][j]<<' ';\
cout<<a[i][m]<<endl; \
}
#pragma
#define
#define
#define
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
ll mul(ll a,ll b){return (a*b)%F;}
ll add(ll a,ll b){return (a+b)%F;}
ll sub(ll a,ll b){return ((a-b)%F+F)%F;}
void upd(ll &a,ll b){a=(a%F+b%F)%F;}
inline int read()
{
int x=0,f=1; char ch=getchar();
while(!isdigit(ch)) {if (ch=='-') f=-1; ch=getchar();}
while(isdigit(ch)) { x=x*10+ch-'0'; ch=getchar();}
return x*f;
}
int main()
{
// freopen("A.in","r",stdin);
// freopen(".out","w",stdout);
char s[102];
cin>>s;
if (s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I')
cout<<"Yes";else cout<<"No";cout<<endl;
return 0;
}

B fLIP

#include<bits/stdc++.h> 
using namespace std;
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
For(j,m-1) cout<<a[i][j]<<' ';\
cout<<a[i][m]<<endl; \
}
#pragma
#define
#define
#define
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
ll mul(ll a,ll b){return (a*b)%F;}
ll add(ll a,ll b){return (a+b)%F;}
ll sub(ll a,ll b){return ((a-b)%F+F)%F;}
void upd(ll &a,ll b){a=(a%F+b%F)%F;}
inline int read()
{
int x=0,f=1; char ch=getchar();
while(!isdigit(ch)) {if (ch=='-') f=-1; ch=getchar();}
while(isdigit(ch)) { x=x*10+ch-'0'; ch=getchar();}
return x*f;
}
int main()
{
// freopen("B.in","r",stdin);
// freopen(".out","w",stdout);
int n,m,k;
cin>>n>>m>>k;

Rep(i,n+1) Rep(j,m+1) {
if (i*j+(n-i)*(m-j)==k) {
cout<<"Yes"<<endl;
return 0;
}
}
cout<<"No";cout<<endl;


return 0;
}

C Palindromic Matrix

#include<bits/stdc++.h> 
using namespace std;
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
For(j,m-1) cout<<a[i][j]<<' ';\
cout<<a[i][m]<<endl; \
}
#pragma
#define
#define
#define
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
ll mul(ll a,ll b){return (a*b)%F;}
ll add(ll a,ll b){return (a+b)%F;}
ll sub(ll a,ll b){return ((a-b)%F+F)%F;}
void upd(ll &a,ll b){a=(a%F+b%F)%F;}
inline int read()
{
int x=0,f=1; char ch=getchar();
while(!isdigit(ch)) {if (ch=='-') f=-1; ch=getchar();}
while(isdigit(ch)) { x=x*10+ch-'0'; ch=getchar();}
return x*f;
}
char s[10000];
int c[10000]={};
int main()
{
// freopen("C.in","r",stdin);
// freopen(".out","w",stdout);
int c4=0,c2=0,c1=0;
int n=read(),m=read();
if (n%2==0&&m%2==0) {
c4=n*m/4;
}
else if(n%2==1&&m%2==1) {
c1=1;
c4=(n/2)*(m/2);
c2=(n-1)+(m-1); c2/=2;
}
else {
c4=(n/2*2)*(m/2*2)/4;
c2=(n*m-c4*4)/2;
}
For(i,n) {
scanf("%s",s+1);
For(j,m) c[s[j] ]++;
}
Fork(i,'a','z') {
int p=min(c4,c[i]/4);
c[i]-=4*p;
c4-=p;
}
Fork(i,'a','z') {
int p=min(c2,c[i]/2);
c[i]-=2*p;
c2-=p;
}
Fork(i,'a','z') {
int p=min(c1,c[i]/1);
c[i]-=p;
c1-=p;
}
if (c1+c2+c4) {
puts("No");
}else puts("Yes");



return 0;
}

D Four Coloring

给一个n*m的矩阵染4种颜色,使曼哈顿距离为d的任意2点颜色不同。

d为偶数,黑白染色
任意d的方案:用边长为d的菱形染色,4个颜色组成一个大菱形,再用这个大菱形密铺平面。

#include<bits/stdc++.h> 
using namespace std;
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
For(j,m-1) cout<<a[i][j]<<' ';\
cout<<a[i][m]<<endl; \
}
#pragma
#define
#define
#define
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
ll mul(ll a,ll b){return (a*b)%F;}
ll add(ll a,ll b){return (a+b)%F;}
ll sub(ll a,ll b){return ((a-b)%F+F)%F;}
void upd(ll &a,ll b){a=(a%F+b%F)%F;}
inline int read()
{
int x=0,f=1; char ch=getchar();
while(!isdigit(ch)) {if (ch=='-') f=-1; ch=getchar();}
while(isdigit(ch)) { x=x*10+ch-'0'; ch=getchar();}
return x*f;
}
int n,m,d;
char h[1000]="RYGB";
int main()
{
// freopen("data.in","r",stdin);

int n=read(),m=read(),d=read();
For(x,n) {
For(y,m) {
int px=x+y,py=x-y;
px+=10000,py+=10000;
px/=d,py/=d;
px&=1,py&=1;
putchar(h[px*2+py]);
}puts("");
}



return 0;
}