Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: cyblox_boi

Problemset: Croissant Display

Language: cpp

Time: 0.003 second

Submitted On: 2026-01-01 01:02:13

#include <bits/stdc++.h>
using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    unordered_map<int, vector<string>> ascii = {
        {0, {"###", "# #", "# #", "# #", "###"}},
        {1, {"  #", "  #", "  #", "  #", "  #"}},
        {2, {"###", "  #", "###", "#  ", "###"}},
        {3, {"###", "  #", "###", "  #", "###"}},
        {4, {"# #", "# #", "###", "  #", "  #"}},
        {5, {"###", "#  ", "###", "  #", "###"}},
        {6, {"###", "#  ", "###", "# #", "###"}},
        {7, {"###", "  #", "  #", "  #", "  #"}},
        {8, {"###", "# #", "###", "# #", "###"}},
        {9, {"###", "# #", "###", "  #", "###"}},
        {'A', {"###", "# #", "###", "# #", "# #"}},
        {'P', {"###", "# #", "###", "#  ", "#  "}},
        {'M', {"# #", "###", "# #", "# #", "# #"}},
    };

    string h, m;
    cin >> h >> m;

    int hour = stoi(h);
    string state = (hour >= 12) ? "PM" : "AM";

    if (hour >= 12)
    {
        hour -= 12;

        if (hour < 10)
        {
            h = '0' + to_string(hour);
        }
        else
        {
            h = to_string(hour);
        }
    }

    vector<string> output(5);

    for (int i = 0; i < 5; i++)
    {
        for (int j = 0; j < 2; j++)
        {
            output[i] += ascii[h[j] - '0'][i] + ' ';
        }
    }

    for (int i = 0; i < 5; i++)
    {
        if (i == 1 || i == 3)
        {
            output[i] += ": ";
        }
        else
        {
            output[i] += "  ";
        }
    }

    for (int i = 0; i < 5; i++)
    {
        for (int j = 0; j < 2; j++)
        {
            output[i] += ascii[m[j] - '0'][i] + ' ';
        }
    }

    for (int i = 0; i < 5; i++)
    {
        output[i] += string(2, ' ');

        for (int j = 0; j < 2; j++)
        {
            output[i] += ascii[state[j]][i];

            if (j != 1)
            {
                output[i] += ' ';
            }
        }
    }

    for (int i = 0; i < 5; i++)
    {
        cout << output[i] << '\n';
    }

    return 0;
}