QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#650559#8217. King's Dinnerucup-team3160#WA 1ms3704kbC++142.4kb2024-10-18 15:36:052024-10-18 15:36:08

Judging History

你现在查看的是最新测评结果

  • [2024-10-18 15:36:08]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3704kb
  • [2024-10-18 15:36:05]
  • 提交

answer

#include <bits/stdc++.h>
#define rep(i, min, max) for(int i = (min); i <= (max); ++i)
#define nrep(i, max, min) for(int i = (max); i >= (min); --i)
#define reads(str) (scanf("%s", str + 1), strlen(str + 1))
#define case() int Ts = read(); rep(T, 1, Ts)
#define putf(flag) puts((flag) ? "Yes" : "No")
#define put(x) printf("%d ", x)
#define putl(x) printf("%lld ", x)
#define endl() putchar('\n')
using namespace std;

void print() { cerr << endl; }
template<typename T, typename ...Ts>
void print(T x, Ts ...xs) { cerr << x << " "; print(xs...); }

typedef long long ll;
inline ll read()
{
    ll now=0; bool nev=false; char c=getchar();
    while(c<'0' || c>'9') { if(c=='-') nev=true; c=getchar(); }
    while(c>='0' && c<='9') { now=(now<<1)+(now<<3)+(c&15); c=getchar(); }
    return nev?-now:now;
}

const int N = 200 + 10;

int a[N][N];
int ax, ay;

inline int& f(int x, int y) {
    return a[x + ax][y + ay];
}

int main() {
    case() {
        int n = read(), n0 = n; ax = 0, ay = 0;
        rep(i, 1, n) rep(j, 1, n) a[i][j] = 0;
        while(1) {
            if(n % 2 == 0 && n >= 6) {
                rep(i, 1, n - 2) if(i % 2 != 0) {
                    f(1, i) = f(2, i) = f(i, n) = f(i, n - 1) = f(n, n - i + 1) = f(n - 1, n - i + 1) = f(n - i + 1, 1) = f(n - i + 1, 2) = 1;
                }
                ax += 3, ay += 3;
                n -= 6;
            } else if(n % 3 == 1 && n >= 4) {
                rep(i, 1, n - 1) if(i % 3 != 0) {
                    a[1 + ax][i + ay] = a[i + ax][n + ay] = a[n + ax][n - i + 1 + ay] = a[n - i + 1 + ax][1 + ay] = 1;
                }
                ax += 2, ay += 2;
                n -= 4;
            }  else {
                break;
            }
        }
        int xlim = n, ylim = n;
        while((xlim + 1) % 3 != 0) xlim --;
        while((ylim + 1) % 2 != 0) ylim --;
        rep(i, 1, n) {
            rep(j, 1, n) {
                if(j % 2 != 0 && i % 3 != 0 && i <= xlim && j <= ylim) {
                    a[i + ax][j + ay] = 1;
                }
            }
        }
        if(n % 3 == 1) rep(i, 1, xlim) if(i % 3 != 0) a[n + ax][i + ay] = 1;
        n = n0;
        rep(i, 1, n) {
            rep(j, 1, n) {
                if(a[i][j]) putchar('#');
                else putchar('.');
            }
            putchar('\n');
        }
            // putchar('\n');
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3660kb

input:

3
1
2
3

output:

.
#.
#.
#.#
#.#
...

result:

ok all tests correct (3 test cases)

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3704kb

input:

50
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

output:

.
#.
#.
#.#
#.#
...
##.#
...#
#...
#.##
#.#.#
#.#.#
.....
#.#.#
#.#.#
#.#.##
#.#...
....##
##....
...#.#
##.#.#
##.##.#
......#
#.#.#..
#.#.#.#
......#
#......
#.##.##
#.#.#.##
#.#.#...
......##
##.#....
...#..##
##......
...#.#.#
##.#.#.#
#.#.#.#.#
#.#.#.#.#
.........
#.#.#.#.#
#.#.#.#.#
.........
...

result:

wrong answer jury has the better answer: jans = 16, pans = 15 (test case 9)