QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#355526#8217. King's Dinnerucup-team228#WA 1ms3916kbC++204.1kb2024-03-16 19:16:262024-03-16 19:16:28

Judging History

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

  • [2024-03-16 19:16:28]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3916kb
  • [2024-03-16 19:16:26]
  • 提交

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);
        }
        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";
        }
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3688kb

input:

3
1
2
3

output:

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

result:

ok all tests correct (3 test cases)

Test #2:

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

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 = 8, pans = 7 (test case 6)