Submission #19215

# Submission time Handle Problem Language Result Execution time Memory
19215 2016-02-21T07:14:12 Z joonas Zu (kriii2_Z) C++
1 / 4
12 ms 1852 KB
#include <bits/stdc++.h>
using namespace std;

#define NUMBER_OF_GLYPHIC 10

string mapping[NUMBER_OF_GLYPHIC][5]={
    {   // _
        ".....",
        ".....",
        ".....",
        ".....",
        "....."
    },
    {   // 3
        "#####",
        "#.#.#",
        "#.###",
        "#...#",
        "#####"
    },
    {   // 3 (2)
        "#####",
        "#...#",
        "#.#.#",
        "#.#.#",
        "#####"
    },
    {   // 10
        "#####",
        "#.#.#",
        "#####",
        "#.#.#",
        "#####"
    },
    {   // a
        "#####",
        "..#..",
        "#...#",
        "#####",
        "#####"
    },
    {   // b
        "#####",
        "#...#",
        "#.#.#",
        "....#",
        "#####"
    },
    {   // c
        "#####",
        "###..",
        "###.#",
        "###..",
        "#####"
    },
    {   // d
        "#####",
        "#####",
        "#####",
        "..###",
        "#.###"
    },
    {   // kq
        "###.#",
        "###.#",
        "###.#",
        "#...#",
        "#.###"
    },
    {   // uv
        "#####",
        "#####",
        "#####",
        "#...#",
        "#.#.#"
    }
};
string encode[NUMBER_OF_GLYPHIC]={
    "_","3","3","10","a","b","c","d","kq","uv"
};

string finder(string s[], int y, int x){
    for(int idx=0; idx<NUMBER_OF_GLYPHIC; ++idx){
        bool isSame = true;
        for(int i=0; i<5; ++i)
            isSame &= s[y+i].substr(x, 5) == mapping[idx][i];
        if(isSame) return encode[idx];
    }
    return "z";
}

int main(){
    string s[350];
    int i, j, k, r, c;
    cin >> r >> c;
    for(i=0; i<6*r-1; ++i) cin >> s[i];
    
    for(j=6*(c-1); j>=0; j -= 6){
        for(i=0; i<6*r; i += 6){
            cout<< finder(s, i, j);
        }
        cout<<'\n';
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 12 ms 1852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 1852 KB Output isn't correct