QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#355536#8217. King's Dinnerucup-team228#AC ✓2ms3912kbC++204.3kb2024-03-16 19:49:522024-03-16 19:49:57

Judging History

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

  • [2024-03-16 19:49:57]
  • 评测
  • 测评结果:AC
  • 用时:2ms
  • 内存:3912kb
  • [2024-03-16 19:49:52]
  • 提交

answer

//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx2") // doesn't work on Yandex
//#pragma GCC target("avx") // for old judges
//#pragma GCC target("bmi,bmi2,lzcnt,popcnt") // fast bit operations

#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <cmath>
#include <algorithm>
#include <cassert>
#include <chrono>
#include <random>
#include <string>
#include <numeric>
#include <complex>
#include <tuple>
#include <utility>
#include <bitset>
#include <array>
#include <stack>
#include <sstream>
#include <unordered_set>

using namespace std;
typedef long long ll;

string to_string(string a) { return '"' + a + '"'; }
string to_string(char a) { return "'" + string(1, a) + "'"; }
string to_string(const char* a) { return to_string((string) a); }
string to_string(bool a) { return a ? "true" : "false"; }
template <class T1, class T2>
string to_string(pair<T1, T2> a) {
    return "(" + to_string(a.first) + ", " + to_string(a.second) + ")";
}
template <class T>
string to_string(T a) {
    bool first = true; string res = "{";
    for (const auto& i : a) {
        if (!first) res += ", ";
        first = false;
        res += to_string(i);
    }
    res += "}";
    return res;
}
void debug_out() { cerr << endl; }
template <class T1, class... T2>
void debug_out(T1 a, T2... b) {
    cerr << " " << to_string(a);
    debug_out(b...);
}

#ifdef LOCAL
#define out(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define out(...) 42
#endif

clock_t start_time; void start_timer() { start_time = clock(); }
double get_time() { return (double) (clock() - start_time) / CLOCKS_PER_SEC; }

void Solve();

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef LOCAL
    freopen("usr/share/man/man1/input.txt", "r", stdin);
#endif
    start_timer();
    Solve();
#ifdef LOCAL
    cerr << fixed << setprecision(3);
    cerr << endl << "Time spent: " << get_time() << endl;
#endif
    return 0;
}

// do something, stay focused
// look for stupid bugs
// guess, slow, stress
// don't overgeneralize
// don't rush

// don't waste time on standings

// SOLVE THE PROBLEM OR DIE TRYING
// THE SOLUTION IS ALWAYS SIMPLE
// THE CODE IS ALWAYS SHORT

const int N = 105;

int a[N][N];

int calc(int n) {
    int res = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            res += a[i][j];
        }
    }
    return res;
}

void color(int u, int d, int l, int r, int c) {
    for (int i = u; i <= d; i++) {
        for (int j = l; j <= r; j++) {
            a[i][j] = 0;
        }
    }
    if (c == 0) { // horizontal
        for (int i = u; i <= d; i += 2) {
            for (int j = l; j + 1 <= r; j += 3) {
                a[i][j] = 1;
                a[i][j + 1] = 1;
            }
        }
    }
    else { // vertical
        for (int i = u; i + 1 <= d; i += 3) {
            for (int j = l; j <= r; j += 2) {
                a[i][j] = 1;
                a[i + 1][j] = 1;
            }
        }
    }
}

void Solve() {
    int T;
    cin >> T;
    while (T--) {
        int n;
        cin >> n;
        color(1, n, 1, n, 1);
        int r = n % 6;
        if (r == 0) {
            color(n - 2, n, 1, n, 0);
            color(1, n - 3, n - 1, n, 0);
            a[n - 2][n - 2] = 0;
            a[n - 2][n - 1] = 0;
            color(n - 1, n, n - 2, n, 1);
        }
        else if (r == 1) {
            color(n, n, 1, n, 0);
        }
        else if (r == 2) {
            color(1, n, n - 1, n, 0);
        }
        else if (r == 3) {
            color(n - 2, n, 1, n, 0);
        }
        else if (r == 4) {
            color(n, n, 1, n, 0);
            a[n][n] = 1;
            a[n - 1][n] = 1;
            color(1, n - 2, n - 1, n, 0);
        }
        else if (r == 5) {
            
        }
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= n; j++) {
                if (a[i][j] == 0) {
                    cout << '.';
                }
                else {
                    cout << '#';
                }
            }
            cout << "\n";
        }
    }
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
1
2
3

output:

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

result:

ok all tests correct (3 test cases)

Test #2:

score: 0
Accepted
time: 1ms
memory: 3912kb

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:

ok all tests correct (50 test cases)

Test #3:

score: 0
Accepted
time: 2ms
memory: 3740kb

input:

39
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89

output:

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

result:

ok all tests correct (39 test cases)

Test #4:

score: 0
Accepted
time: 0ms
memory: 3896kb

input:

11
90
91
92
93
94
95
96
97
98
99
100

output:

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

result:

ok all tests correct (11 test cases)

Test #5:

score: 0
Accepted
time: 0ms
memory: 3780kb

input:

1
100

output:

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

result:

ok all tests correct (1 test case)

Extra Test:

score: 0
Extra Test Passed