Codeforces A Mist of Florescence

A Mist of Florescence


题目大意:

事先告诉你每种颜色分别有几个联通块,构造一个不超过 \(50*50\) 的矩形。用 \(A,B,C,D\) 四种颜色来对矩形进行涂色使它满足要求。

每种颜色联通块不超过 \(100\)

Examples

input

5 3 2 1

output

4 7
DDDDDDD
DABACAD
DBABACD
DDDDDDD

input

50 50 1 1

output

4 50
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
ABABABABABABABABABABABABABABABABABABABABABABABABAB
BABABABABABABABABABABABABABABABABABABABABABABABABA
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD

input

1 6 4 5

output

7 7
DDDDDDD
DDDBDBD
DDCDCDD
DBDADBD
DDCDCDD
DBDBDDD
DDDDDDD

Note

In the first example, each cell of Amaranths, Begonias and Centaureas forms a connected component, while all the Dianthuses form one.





我不就是读不懂英文题面吗???至于这样吗?
所以比赛的时候问了一下 \(Zero\) 然后他告诉我了大概意思。。。

并没有告诉我每个联通块个数不超过 100

(大家可以想想这是个啥不可做题。。。。)

而且我还以为矩形大小是题目规定的。。。。更不可做。。。

当场去世。。。。
(然后比赛打到一半开开心心的出去吃面去了。。。。面真好吃233)


看一眼代码就知道这是一道**题了。。。
得知数据范围的我很生气。。。机房调试都没有当场 1A 的啊。。


不好意思打扰了。。。


#include<bits/stdc++.h>
using namespace std;
char mapp[55][55];
int A, B, C, D;

inline void prepare()
{
    A--; B--; C--; D--;
    
    for(int i = 1; i <= 24; ++i)
        for(int j = 1; j <= 24; ++j)
            mapp[i][j] = 'A';
    
    for(int i = 1; i <= 24; ++i)
        for(int j = 25; j <= 48; ++j)
            mapp[i][j] = 'B';
            
    for(int i = 25; i <= 48; ++i)
        for(int j = 1; j <= 24; ++j)
            mapp[i][j] = 'C';
            
    for(int i = 25; i <= 48; ++i)
        for(int j = 25; j <= 48; ++j)
            mapp[i][j] = 'D';
}

inline void Draw()
{
    int i = 2, j = 0;
    while(B){
        B--;
        if(j <= 18) j += 2;
        else{i += 2; j = 2;}
        mapp[i][j] = 'B';
    }
    
    i = 2; j = 24;
    while(A){
        A--;
        if(j <= 42) j += 2;
        else{i += 2; j = 26;}
        mapp[i][j] = 'A';
    }
    
    i = 26; j = 0;
    while(D){
        D--;
        if(j <= 18) j += 2;
        else{i += 2; j = 2;}
        mapp[i][j] = 'D';
    }
    
    i = 26; j = 24;
    while(C){
        C--;
        if(j <= 42) j += 2;
        else{i += 2; j = 26;}
        mapp[i][j] = 'C';
    }
}

inline void print()
{
    printf("48 48\n");
    for(int i = 1; i <= 48; ++i){
        for(int j = 1; j <= 48; ++j)
            printf("%c", mapp[i][j]);       
        printf("\n");
    }

}

int main()
{
    scanf("%d%d%d%d", &A, &B, &C, &D);
    prepare();
    Draw();
    print();
    return 0;
}

猜你喜欢

转载自www.cnblogs.com/LLppdd/p/9174868.html
今日推荐