10517 | 2024-04-04 15:29:08 | 111 | Egy trikolór mestermű | cpp17 | Wrong answer 40/100 | 17ms | 15256 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[2].first){
v[2].first--;
g[i][j]=v[2].second;
}
else{
cout<<"NO"<<'\n';
return 0;
}
}
}
}
for(int i=0;i<N;i++){
for(int j=0;j<M;j++){
if(i%2==j%2){
if(v[2].first){
v[2].first--;
g[i][j]=v[2].second;
}
else if(v[1].first){
v[1].first--;
g[i][j]=v[1].second;
}
else{
cout<<"NO"<<'\n';
return 0;
}
}
}
}
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 | 1832 KiB | ||||
2 | Accepted | 3ms | 2060 KiB | ||||
subtask2 | 17/17 | ||||||
3 | Accepted | 3ms | 2272 KiB | ||||
4 | Accepted | 3ms | 2484 KiB | ||||
5 | Accepted | 3ms | 2580 KiB | ||||
6 | Accepted | 3ms | 2564 KiB | ||||
7 | Accepted | 3ms | 2952 KiB | ||||
8 | Accepted | 3ms | 2832 KiB | ||||
9 | Accepted | 3ms | 2948 KiB | ||||
10 | Accepted | 3ms | 2980 KiB | ||||
11 | Accepted | 3ms | 3148 KiB | ||||
12 | Accepted | 3ms | 3376 KiB | ||||
subtask3 | 0/21 | ||||||
13 | Accepted | 6ms | 3600 KiB | ||||
14 | Accepted | 3ms | 3728 KiB | ||||
15 | Wrong answer | 3ms | 3852 KiB | ||||
16 | Wrong answer | 3ms | 3940 KiB | ||||
17 | Accepted | 3ms | 3812 KiB | ||||
subtask4 | 23/23 | ||||||
18 | Accepted | 6ms | 4268 KiB | ||||
19 | Accepted | 6ms | 4260 KiB | ||||
20 | Accepted | 3ms | 4260 KiB | ||||
21 | Accepted | 6ms | 4552 KiB | ||||
subtask5 | 0/39 | ||||||
22 | Accepted | 2ms | 3920 KiB | ||||
23 | Accepted | 12ms | 9380 KiB | ||||
24 | Accepted | 6ms | 4260 KiB | ||||
25 | Accepted | 6ms | 4360 KiB | ||||
26 | Accepted | 3ms | 4400 KiB | ||||
27 | Accepted | 6ms | 4372 KiB | ||||
28 | Accepted | 6ms | 4436 KiB | ||||
29 | Accepted | 17ms | 15256 KiB | ||||
30 | Accepted | 4ms | 4580 KiB | ||||
31 | Wrong answer | 3ms | 4652 KiB | ||||
32 | Accepted | 3ms | 4468 KiB |