10520 | 2024-04-04 15:33:58 | 111 | Egy trikolór mestermű | cpp17 | Wrong answer 61/100 | 67ms | 15456 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<100;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;
}
}
}
}
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 | 1828 KiB | ||||
2 | Accepted | 3ms | 2052 KiB | ||||
subtask2 | 17/17 | ||||||
3 | Accepted | 3ms | 2284 KiB | ||||
4 | Accepted | 3ms | 2496 KiB | ||||
5 | Accepted | 3ms | 2840 KiB | ||||
6 | Accepted | 3ms | 2764 KiB | ||||
7 | Accepted | 3ms | 2756 KiB | ||||
8 | Accepted | 3ms | 2844 KiB | ||||
9 | Accepted | 3ms | 2980 KiB | ||||
10 | Accepted | 3ms | 3316 KiB | ||||
11 | Accepted | 3ms | 3468 KiB | ||||
12 | Accepted | 3ms | 3548 KiB | ||||
subtask3 | 21/21 | ||||||
13 | Accepted | 6ms | 3900 KiB | ||||
14 | Accepted | 59ms | 3936 KiB | ||||
15 | Accepted | 3ms | 3732 KiB | ||||
16 | Accepted | 3ms | 3988 KiB | ||||
17 | Accepted | 10ms | 3936 KiB | ||||
subtask4 | 23/23 | ||||||
18 | Accepted | 6ms | 4400 KiB | ||||
19 | Accepted | 6ms | 4408 KiB | ||||
20 | Accepted | 67ms | 4552 KiB | ||||
21 | Accepted | 6ms | 4396 KiB | ||||
subtask5 | 0/39 | ||||||
22 | Accepted | 3ms | 4040 KiB | ||||
23 | Accepted | 13ms | 9752 KiB | ||||
24 | Accepted | 6ms | 4568 KiB | ||||
25 | Accepted | 6ms | 4812 KiB | ||||
26 | Accepted | 3ms | 4560 KiB | ||||
27 | Accepted | 6ms | 4804 KiB | ||||
28 | Accepted | 6ms | 4864 KiB | ||||
29 | Accepted | 19ms | 15456 KiB | ||||
30 | Accepted | 4ms | 4868 KiB | ||||
31 | Wrong answer | 61ms | 5148 KiB | ||||
32 | Accepted | 3ms | 4616 KiB |