QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#741319 | #6309. Aqre | OIer_kzc# | WA | 0ms | 6764kb | C++17 | 1.8kb | 2024-11-13 14:05:35 | 2024-11-13 14:05:37 |
Judging History
answer
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <queue>
#include <algorithm>
#define LOG(FMT...) fprintf(stderr, FMT)
#define eb emplace_back
#define em emplace
using namespace std;
typedef long long LL;
constexpr int N = 1024;
constexpr int rem[4] = {3, 1, 2, 0};
char gr[N][N];
int a[N][N];
int main() {
int n = 1020, m = 1020;
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
gr[i + 1][j + 1] = ".#"[(j & 3) != rem[i & 3]];
a[i + 1][j + 1] = (gr[i + 1][j + 1] == '#') + a[i + 1][j] + a[i][j + 1] - a[i][j];
}
}
int task;
for (scanf("%d", &task); task--; ) {
scanf("%d%d", &n, &m);
if (n < 4 && m < 4) {
printf("%d\n", n * m);
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
putchar('#');
}
puts("");
}
} else if (n == 3) {
printf("%d\n", n * (m - m / 4) - (m % 4 >= 2));
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
putchar(".#"[(j & 3) != rem[i & 1]]);
}
puts("");
}
} else if (m == 3) {
printf("%d\n", m * (n - n / 4) - (n % 4 >= 2));
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
putchar(".#"[(i & 3) != rem[j & 1]]);
}
puts("");
}
} else {
int res = 0, rx = -1, ry = -1;
for (int x = 0; x < 4; ++x) {
for (int y = 0; y < 4; ++y) {
int v = a[x + n][y + m] - a[x + n][y] - a[x][y + m] + a[x][y];
if (v <= res) {
continue;
}
res = v, rx = x, ry = y;
}
}
printf("%d\n", res);
// LOG("%d\n", min(n * (m - m / 4), m * (n - n / 4)));
// LOG("+(%d, %d)\n", rx, ry);
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= m; ++j) {
putchar(gr[rx + i][ry + j]);
}
puts("");
}
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 6764kb
input:
3 2 2 3 4 3 8
output:
4 ## ## 9 ###. #.## ###. 18 ###.###. #.###.## ###.###.
result:
wrong answer Token parameter [name=s[i]] equals to "##", doesn't correspond to pattern "[01]{1,1000}" (test case 1)