10519 | 2024-04-04 15:33:14 | 111 | Egy trikolór mestermű | cpp17 | Wrong answer 44/100 | 17ms | 15032 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;
for(int i=0;i<10;i++){
vector<vector<char>>g(N+1,vector<char>(M+1,'0'));
vector<pair<int,char>>v{{R,'R'},{G,'G'},{B,'B'}};
random_shuffle(v.begin(),v.end());
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 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[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;
}
}
}
}
int ok=1;
for(int i=0;i<N;i++){
for(int j=0;j<M;j++){
ok&=g[i][j]!='0';
ok&=g[i][j]!=g[i][j+1];
ok&=g[i][j]!=g[i+1][j];
}
}
if(ok){
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;
}
}
cout<<"NO"<<'\n';
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1880 KiB | ||||
2 | Accepted | 3ms | 2240 KiB | ||||
subtask2 | 0/17 | ||||||
3 | Accepted | 3ms | 2336 KiB | ||||
4 | Wrong answer | 3ms | 2404 KiB | ||||
5 | Accepted | 3ms | 2620 KiB | ||||
6 | Accepted | 3ms | 2828 KiB | ||||
7 | Accepted | 3ms | 2828 KiB | ||||
8 | Accepted | 3ms | 2808 KiB | ||||
9 | Accepted | 3ms | 3032 KiB | ||||
10 | Accepted | 3ms | 3264 KiB | ||||
11 | Accepted | 3ms | 3440 KiB | ||||
12 | Wrong answer | 3ms | 3648 KiB | ||||
subtask3 | 21/21 | ||||||
13 | Accepted | 6ms | 4232 KiB | ||||
14 | Accepted | 8ms | 4068 KiB | ||||
15 | Accepted | 3ms | 3980 KiB | ||||
16 | Accepted | 3ms | 3844 KiB | ||||
17 | Accepted | 3ms | 3904 KiB | ||||
subtask4 | 23/23 | ||||||
18 | Accepted | 6ms | 4552 KiB | ||||
19 | Accepted | 6ms | 4620 KiB | ||||
20 | Accepted | 8ms | 4768 KiB | ||||
21 | Accepted | 6ms | 4636 KiB | ||||
subtask5 | 0/39 | ||||||
22 | Accepted | 3ms | 4148 KiB | ||||
23 | Accepted | 12ms | 9732 KiB | ||||
24 | Accepted | 6ms | 4396 KiB | ||||
25 | Accepted | 6ms | 4448 KiB | ||||
26 | Accepted | 3ms | 4284 KiB | ||||
27 | Accepted | 6ms | 4460 KiB | ||||
28 | Accepted | 6ms | 4388 KiB | ||||
29 | Accepted | 17ms | 15032 KiB | ||||
30 | Accepted | 4ms | 4448 KiB | ||||
31 | Wrong answer | 8ms | 4624 KiB | ||||
32 | Accepted | 2ms | 4212 KiB |