QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#39754 | #2942. 7 Segments You Say? | Eke | WA | 7ms | 13704kb | C++ | 3.4kb | 2022-07-13 11:57:06 | 2022-07-13 11:57:08 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int maxn = 114514;
int s;
string str;
char output[maxn][90];
bool v[maxn];
int main()
{
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
memset(output, 0, sizeof(output));
cin >> s >> str;
int r = 0, c = 0;
while (str.size() % 7) {
str = '0' + str;
}
for (int i = 0; i + 7 <= str.size(); i += 7) {
for (int i = r; i < r + s * 7; ++i) v[i] = 1;
for (int i = r; i < r + s * 7; ++i) {
for (int j = c; j < c + s * 3; ++j) output[i][j] = ' ';
}
string sub = str.substr(i, 7);
if (sub != "1110111" && sub != "0100100" && sub != "1011101" && sub != "1101101"
&& sub != "0101110" && sub != "1101011" && sub != "1111011" && sub != "0100101"
&& sub != "1111111" && sub != "1101111" && sub != "0111111" && sub != "1111010"
&& sub != "1010011" && sub != "1111100" && sub != "1011011" && sub != "0011011") {
for (int j = r; j < r + 7 * s; ++j) {
for (int k = c; k < c + 3 * s; ++k) {
output[j][k] = ' ';
}
}
goto L;
}
if (str[i + 6] == '1') {
for (int j = r; j < r + s; ++j) {
for (int k = c; k < c + s * 3; ++k) {
output[j][k] = 'X';
}
}
}
if (str[i + 5] == '1') {
for (int j = r + s; j < r + s * 3; ++j) {
for (int k = c; k < c + s; ++k) {
output[j][k] = 'X';
}
}
}
if (str[i + 4] == '1') {
for (int j = r + s; j < r + s * 3; ++j) {
for (int k = c + s * 2; k < c + s * 3; ++k) {
output[j][k] = 'X';
}
}
}
if (str[i + 3] == '1') {
for (int j = r + 3 * s; j < r + 4 * s; ++j) {
for (int k = c; k < c + s * 3; ++ k) {
output[j][k] = 'X';
}
}
}
if (str[i + 2] == '1') {
for (int j = r + 4 * s; j < r + 6 * s; ++j) {
for (int k = c; k < c + s; ++k) {
output[j][k] = 'X';
}
}
}
if (str[i + 1] == '1') {
for (int j = r + 4 * s; j < r + 6 * s; ++j) {
for (int k = c + s * 2; k < c + s * 3; ++k) {
output[j][k] = 'X';
}
}
}
if (str[i] == '1') {
for (int j = r + 6 * s; j < r + 7 * s; ++j) {
for (int k = c; k < c + s * 3; ++k) {
output[j][k] = 'X';
}
}
}
L:
if (c + s * 5 >= 80) {
c = 0;
for (int j = r + 7 * s; j < r + 8 * s; ++j) {
output[j][0] = '\0';
v[j] = 1;
}
r += 8 * s;
continue;
}
if (i + 14 <= str.size())
for (int j = r; j < r + 7 * s; ++j) {
for (int k = c + s * 3; k < c + s * 5; ++k) {
output[j][k] = ' ';
}
}
c += s * 5;
}
int ptr = maxn - 2;
while (output[ptr][0] == '\0') ptr--;
for (int i = 0; i < ptr; ++i) {
cout << output[i] << endl;
}
cout << output[ptr];
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 7ms
memory: 13528kb
input:
1 110111111011
output:
XXX XXX X X X X XXX XXX X X X X X X XXX
result:
ok 7 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 13648kb
input:
4 110111111011
output:
XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXX...
result:
ok 28 lines
Test #3:
score: 0
Accepted
time: 2ms
memory: 13700kb
input:
1 1110111010010010111011101101010111011010111111011010010111111111101111011111111110101010011111110010110110011011
output:
XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X XXX XXX XXX XXX XXX XXX XXX XXX XXX ...
result:
ok 7 lines
Test #4:
score: 0
Accepted
time: 2ms
memory: 13704kb
input:
1 111011101001001011101110110101011101101011111101101001011111111110111101111111111010101001111111001011011001101111101110100100101110111011010101110110101111110110100101111111111011110111111111101010100111111100101101100110111110111010010010111011101101
output:
XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X XXX XXX XXX XXX XXX XXX XXX XXX XXX ...
result:
ok 23 lines
Test #5:
score: -100
Wrong Answer
time: 4ms
memory: 13648kb
input:
3 11101110100100101110111011010101110110101111110110100101111111111011110111111111101010100111111100101101100110111110111010010010111011101101010111011010111111011010010111111111101111011111111110101010011111110010110110011011
output:
XXXXXXXXX XXXXXXXXX XXXXXXXXX XXXXXXXXX XXXXXXXXX XXXXXXXXX XXXXXXXXX XXXXXXXXX XXXXXXXXX XXXXXXXXX XXXXXXXXX XXXXXXXXX XXX XXX XXX XXX ...
result:
wrong answer 1st lines differ - expected: 'XXXXXXXXX ...X XXXXXXXXX ', found: 'XXXXXXXXX ...X XXXXXXXXX'