10521 | 2024-04-04 15:37:35 | 111 | Egy trikolór mestermű | cpp17 | Wrong answer 44/100 | 67ms | 15212 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 | Wrong answer | 3ms | 1828 KiB | ||||
2 | Accepted | 3ms | 2064 KiB | ||||
subtask2 | 0/17 | ||||||
3 | Wrong answer | 3ms | 2260 KiB | ||||
4 | Accepted | 3ms | 2472 KiB | ||||
5 | Wrong answer | 2ms | 2560 KiB | ||||
6 | Accepted | 3ms | 2640 KiB | ||||
7 | Accepted | 3ms | 2648 KiB | ||||
8 | Accepted | 3ms | 2768 KiB | ||||
9 | Accepted | 3ms | 2888 KiB | ||||
10 | Accepted | 3ms | 3096 KiB | ||||
11 | Accepted | 3ms | 3184 KiB | ||||
12 | Accepted | 3ms | 3312 KiB | ||||
subtask3 | 21/21 | ||||||
13 | Accepted | 6ms | 3876 KiB | ||||
14 | Accepted | 59ms | 4084 KiB | ||||
15 | Accepted | 3ms | 3948 KiB | ||||
16 | Accepted | 3ms | 4072 KiB | ||||
17 | Accepted | 12ms | 4292 KiB | ||||
subtask4 | 23/23 | ||||||
18 | Accepted | 6ms | 4768 KiB | ||||
19 | Accepted | 6ms | 4728 KiB | ||||
20 | Accepted | 67ms | 4864 KiB | ||||
21 | Accepted | 6ms | 4720 KiB | ||||
subtask5 | 0/39 | ||||||
22 | Wrong answer | 3ms | 4260 KiB | ||||
23 | Accepted | 13ms | 9708 KiB | ||||
24 | Accepted | 6ms | 4484 KiB | ||||
25 | Accepted | 6ms | 4552 KiB | ||||
26 | Accepted | 3ms | 4240 KiB | ||||
27 | Accepted | 6ms | 4580 KiB | ||||
28 | Accepted | 6ms | 4476 KiB | ||||
29 | Accepted | 19ms | 15212 KiB | ||||
30 | Accepted | 4ms | 4476 KiB | ||||
31 | Wrong answer | 63ms | 4764 KiB | ||||
32 | Accepted | 3ms | 4320 KiB |