QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#321965 | #8217. King's Dinner | KKT89 | AC ✓ | 2ms | 3708kb | C++17 | 4.0kb | 2024-02-05 23:38:15 | 2024-02-05 23:38:16 |
Judging History
answer
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
return (ull)rng() % B;
}
inline double time() {
return static_cast<long double>(chrono::duration_cast<chrono::nanoseconds>(chrono::steady_clock::now().time_since_epoch()).count()) * 1e-9;
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int q; cin >> q;
while (q--) {
int n; cin >> n;
vector<vector<char>> v(n, vector<char>(n, '.'));
if (n%6 == 1) {
for (int i = 0; i < n; i += 2) {
for (int j = 0; j+1 < n; j += 3) {
v[i][j] = v[i][j+1] = '#';
}
}
for (int i = 0; i+1 < n; i += 3) {
v[i][n-1] = v[i+1][n-1] = '#';
}
}
else if (n%6 == 2) {
for (int i = 0; i+3 < n; i += 2) {
for (int j = 0; j+1 < n; j += 3) {
v[i][j] = v[i][j+1] = '#';
}
}
for (int i = 0; i < n; i += 2) {
v[n-2][i] = v[n-1][i] = '#';
}
}
else if (n%6 == 3) {
for (int i = 0; i < n; i += 2) {
for (int j = 0; j+3 < n; j += 3) {
v[i][j] = v[i][j+1] = '#';
}
}
for (int i = 0; i+1 < n; i += 3) {
v[i][n-3] = v[i+1][n-3] = '#';
v[i][n-1] = v[i+1][n-1] = '#';
}
}
else if (n%6 == 4) {
for (int i = 0; i+2 < n; i += 2) {
for (int j = 0; j+1 < n; j += 3) {
v[i][j] = v[i][j+1] = '#';
}
}
for (int j = 0; j < n-4; j += 2) {
v[n-2][j] = v[n-1][j] = '#';
}
for (int i = 0; i+4 < n; i += 3) {
v[i][n-1] = v[i+1][n-1] = '#';
}
v[n-4][n-4] = v[n-4][n-3] = '#';
v[n-4][n-1] = v[n-3][n-1] = '#';
v[n-1][n-1] = v[n-1][n-2] = '#';
v[n-1][n-4] = v[n-2][n-4] = '#';
}
else if (n%6 == 5) {
for (int i = 0; i < n; i += 2) {
for (int j = 0; j+1 < n; j += 3) {
v[i][j] = v[i][j+1] = '#';
}
}
}
else {
for (int i = 0; i+2 < n; i += 2) {
for (int j = 0; j+6 < n; j += 3) {
v[i][j] = v[i][j+1] = '#';
}
}
for (int j = 0; j < n - 6; j += 2) {
v[n-2][j] = v[n-1][j] = '#';
}
for (int i = 0; i+6 < n; i += 3) {
v[i][n-6] = v[i+1][n-6] = '#';
v[i][n-4] = v[i+1][n-4] = '#';
v[i][n-2] = v[i+1][n-2] = '#';
}
v[n-6][n-6] = v[n-5][n-6] = '#';
v[n-6][n-4] = v[n-5][n-4] = '#';
v[n-6][n-2] = v[n-6][n-1] = '#';
v[n-4][n-2] = v[n-4][n-1] = '#';
v[n-3][n-6] = v[n-3][n-5] = '#';
v[n-1][n-6] = v[n-1][n-5] = '#';
v[n-1][n-3] = v[n-2][n-3] = '#';
v[n-1][n-1] = v[n-2][n-1] = '#';
for (int i = 0; i < n - 6; ++i) {
for (int j = 0; j < n; ++j) {
v[i][j] = '.';
}
}
for (int i = 0; i+1 < n-6; i += 2) {
v[i][0] = v[i][1] = '#';
}
for (int i = 0; i+2 < n-6; i += 3) {
for (int j = 3; j < n; j += 2) {
v[i][j] = v[i+1][j] = '#';
}
}
}
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
cout << v[i][j];
}
cout << '\n';
}
}
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3708kb
input:
3 1 2 3
output:
. #. #. #.# #.# ...
result:
ok all tests correct (3 test cases)
Test #2:
score: 0
Accepted
time: 1ms
memory: 3672kb
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: 3660kb
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: 1ms
memory: 3628kb
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: 1ms
memory: 3688kb
input:
1 100
output:
##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.# ...................................................................................................# ##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##...
result:
ok all tests correct (1 test case)
Extra Test:
score: 0
Extra Test Passed