10515 | 2024-04-04 15:26:03 | 111 | Egy trikolór mestermű | cpp17 | Wrong answer 23/100 | 18ms | 15748 KiB |
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N,M,R,G,B;
cin>>N>>M>>R>>G>>B;
vector<vector<char>>g(N+1,vector<char>(M+1,'0'));
vector<pair<int,char>>v{{R,'R'},{G,'G'},{B,'B'}};
sort(v.rbegin(),v.rend());
for(int i=0;i<N;i++){
for(int j=0;j<M;j++){
if(i%2!=j%2){
if(v[0].first){
v[0].first--;
g[i][j]=v[0].second;
}
else if(v[1].first){
v[1].first--;
g[i][j]=v[1].second;
}
}
}
}
for(int i=0;i<N;i++){
for(int j=0;j<M;j++){
if(i%2==j%2){
if(v[1].first){
v[1].first--;
g[i][j]=v[1].second;
}
else if(v[2].first){
v[2].first--;
g[i][j]=v[2].second;
}
}
}
}
int ok=1;
for(int i=0;i<N;i++){
for(int j=0;j<M;j++){
ok&=g[i][j]!=g[i][j+1];
ok&=g[i][j]!=g[i+1][j];
}
}
if(!ok){
cout<<"NO"<<'\n';
return 0;
}
cout<<"YES"<<'\n';
for(int i=0;i<N;i++){
for(int j=0;j<M;j++){
cout<<g[i][j];
}
cout<<'\n';
}
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1824 KiB | ||||
2 | Accepted | 3ms | 2052 KiB | ||||
subtask2 | 0/17 | ||||||
3 | Accepted | 3ms | 2532 KiB | ||||
4 | Wrong answer | 2ms | 2508 KiB | ||||
5 | Accepted | 3ms | 2396 KiB | ||||
6 | Accepted | 3ms | 2592 KiB | ||||
7 | Accepted | 3ms | 2764 KiB | ||||
8 | Accepted | 3ms | 2852 KiB | ||||
9 | Accepted | 3ms | 2988 KiB | ||||
10 | Accepted | 3ms | 3212 KiB | ||||
11 | Accepted | 3ms | 3444 KiB | ||||
12 | Wrong answer | 3ms | 3660 KiB | ||||
subtask3 | 0/21 | ||||||
13 | Accepted | 6ms | 4220 KiB | ||||
14 | Accepted | 3ms | 4204 KiB | ||||
15 | Wrong answer | 3ms | 4216 KiB | ||||
16 | Wrong answer | 3ms | 4220 KiB | ||||
17 | Accepted | 3ms | 4364 KiB | ||||
subtask4 | 23/23 | ||||||
18 | Accepted | 6ms | 5012 KiB | ||||
19 | Accepted | 6ms | 5188 KiB | ||||
20 | Accepted | 3ms | 5140 KiB | ||||
21 | Accepted | 6ms | 5144 KiB | ||||
subtask5 | 0/39 | ||||||
22 | Accepted | 3ms | 4680 KiB | ||||
23 | Accepted | 13ms | 10088 KiB | ||||
24 | Accepted | 6ms | 4956 KiB | ||||
25 | Accepted | 6ms | 4964 KiB | ||||
26 | Accepted | 3ms | 4632 KiB | ||||
27 | Accepted | 6ms | 5100 KiB | ||||
28 | Accepted | 6ms | 5204 KiB | ||||
29 | Accepted | 18ms | 15748 KiB | ||||
30 | Accepted | 4ms | 5176 KiB | ||||
31 | Wrong answer | 3ms | 5332 KiB | ||||
32 | Accepted | 3ms | 4880 KiB |