Submission #9404

# Submission time Handle Problem Language Result Execution time Memory
9404 2014-09-28T06:10:33 Z maniac Zu (kriii2_Z) C++14
4 / 4
0 ms 1684 KB
#include<string>
#include<vector>
#include<cstdio>
using namespace std;
vector <string> seq = {
"a","b","c","d","e","f",
"g","h","i","j","kq","l",
"m","n","o","p","z","r",
"s","t","uv","w","x","y",
"0","1","2","3","3","4","4",
"5","5","6","6","7","7",
"8","9","10"
};
string symbol[][5] ={
{
"#####",
"..#..", // a
"#...#",
"#####",
"#####",
},{
"#####",
"#...#", // b
"#.#.#",
"....#",
"#####",
},{
"#####",
"###..", // c
"###.#",
"###..",
"#####",
},{
"#####",
"#####", // d
"#####",
"..###",
"#.###",
},{
"#####",
"..###", // e
"#.###",
"#....",
"#####",
},{
"#####",
"#.#.#", // f
"....#",
"#.#.#",
"#####",
},{
"###.#",
"##..#", // g
"##.##",
"##..#",
"###.#",
},{
"#####",
"#...#", // h
"#.#.#",
"#...#",
"###.#",
},{
"#.#.#",
"#...#", // i
"#####",
"#####",
"#####",
},{
"#####",
"#####", // j
"#####",
"###..",
"###.#",
},{
"###.#",
"###.#", // kq
"###.#",
"#...#",
"#.###",
},{
"#####",
"#...#", // l
"##.##",
"#...#",
"##.##",
},{
"#####",
"#####", // m
"#...#",
"..#..",
"#####",
},{
"#####",
"#....", // n
"#.#.#",
"#...#",
"#####",
},{
"#####",
"..###", // o
"#.###",
"..###",
"#####",
},{
"###.#",
"###..", // p
"#####",
"#####",
"#####",
},{
"#####",
"....#", // z
"###.#",
"###..",
"#####",
},{
"#####",
"#.#.#", // r
"#....",
"#.#.#",
"#####",
},{
"#.###",
"#..##", // s
"##.##",
"#..##",
"#.###",
},{
"#.###",
"#...#", // t
"#.#.#",
"#...#",
"#####",
},{
"#####",
"#####", // uv
"#####",
"#...#",
"#.#.#",
},{
"#.###",
"..###", // w
"#####",
"#####",
"#####",
},{
"###.#",
"#...#", // x
"#.###",
"#.###",
"#.###",
},{
"##.##",
"#...#", // y
"##.##",
"#...#",
"#####",
},{
"#####",
"#...#", // 0
"#...#",
"#...#",
"#####",
},{
"#####",
"#.#.#", // 1
"#.#.#",
"#...#",
"#####",
},{
"#####",
"#...#", // 2
"#.###",
"#...#",
"#####",
},{
"#####",
"#.#.#", // 3
"#.###",
"#...#",
"#####",
},{
"#####",
"#...#", // 3
"#.#.#",
"#.#.#",
"#####",
},{
"#####",
"#...#", // 4
"###.#",
"#...#",
"#####",
},{
"#####",
"#.#.#", // 4
"#.#.#",
"#.#.#",
"#####",
},{
"#####",
"#.#.#", // 5
"###.#",
"#...#",
"#####",
},{
"#####",
"#...#", // 5
"#.###",
"#.#.#",
"#####",
},{
"#####",
"#...#", // 6
"#####",
"#...#",
"#####",
},{
"#####",
"#.#.#", // 6
"#.###",
"#.#.#",
"#####",
},{
"#####",
"#...#", // 7
"###.#",
"#.#.#",
"#####",
},{
"#####",
"#.#.#", // 7
"#####",
"#...#",
"#####",
},{
"#####",
"#.#.#", // 8
"###.#",
"#.#.#",
"#####",
},{
"#####",
"#...#", // 9
"#####",
"#.#.#",
"#####",
},{
"#####",
"#.#.#", // 10
"#####",
"#.#.#",
"#####",
}
};

const char BLACK[] = "\x1b[47m";
const char WHITE[] = "\x1b[40m";
const char CLEAR[] = "\x1b[0m";
void Verify() // Linux Only :)
{
        for (int i = 0; i < seq.size(); i++) {
                printf("%s[%s]\n", CLEAR, seq[i].c_str());
                for (int y = 0; y < 5; y++) {
                        for (int x = 0; x < 5; x++) {
                                printf("%s ", symbol[i][y][x] == '#' ? BLACK : WHITE);
                        }
                        printf("%s\n", CLEAR);
                }
                getchar();
        }
}

int r, c;

char f[666][666];

const string none("_");
string go(int sy, int sx) {
        for (int k = 0; k < seq.size(); k++) {
                int flag = 1;
                for (int i = sy; flag && i < sy+5; i++) {
                        for (int j = sx; flag && j < sx+5; j++) {
                                if (f[i][j] != symbol[k][i-sy][j-sx])
                                        flag = 0;
                        }
                }
                if (flag) return seq[k];
        }
        return none;
}

int main()
{
        //Verify();
        scanf("%d%d", &r, &c);
        for (int i = 0; i+1 < 6*r; i++) {
                scanf("%s", f[i]);
        }

        vector <string> str;
        for (int i = 0; i+1 < 6*r; i+=6) {
                for (int j = 0; j+1 < 6*c; j+=6) {
                        str.push_back(go(i, j));
                }
        }

        for (int i = c-1; i >= 0; i--) {
                for (int j = 0; j < r; j++) {
                        printf("%s", str[i+j*c].c_str());
                }
                puts("");
        }

        return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1684 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1684 KB Output is correct