QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#321091 | #8217. King's Dinner | ucup-team2894# | AC ✓ | 2ms | 4000kb | C++20 | 2.4kb | 2024-02-04 03:43:02 | 2024-02-04 03:43:03 |
Judging History
answer
#include <bits/stdc++.h>
#define fr first
#define sc second
#define all(a) (a).begin(), (a).end()
#define unique(a) a.resize(unique(a.begin(), a.end()) - a.begin())
using namespace std;
#ifdef ONPC
mt19937 rnd(223);
#else
mt19937 rnd(chrono::high_resolution_clock::now()
.time_since_epoch().count());
#endif
#define TIME (clock() * 1.0 / CLOCKS_PER_SEC)
using ll = long long;
using ld = double;
const int maxn = 1e5 + 100, inf = 1e9 + 100;
int N;
bool tkn[105][105];
void rec(int l, int r) {
if (r - l + 1 == 3) {
tkn[l+1][r] = 1;
tkn[l+1][r-1] = 1;
return;
}
else if (l >= r) {
return ;
}
for (int i = l + 1; i <= r - 3; i += 2) {
tkn[i][l + 2] = 1;
tkn[i][l + 1] = 1;
}
for (int j = l + 1; j <= r - 3; j += 2) {
tkn[r][j] = 1;
tkn[r - 1][j] = 1;
}
for (int i = r; i >= l + 3; i -= 2) {
tkn[i][r] = 1;
tkn[i][r - 1] = 1;
}
for (int j = r; j >= l + 3; j -= 2) {
tkn[l + 2][j] = 1;
tkn[l + 1][j] = 1;
}
rec(l + 3, r - 3);
}
void solve() {
cin >> N;
for (int i = 0; i <= N; i++) {
for (int j = 0; j <= N; j++) {
tkn[i][j] = 0;
}
}
if ((N + 1) % 2 == 0) {
int bottom = (N + 1) % 6;
for (int i = 2; i <= N - bottom; i += 3) {
for (int j = 1; j <= N; j += 2) {
tkn[i][j] = 1;
tkn[i - 1][j] = 1;
}
}
for (int j = 2; j <= N; j += 3) {
for (int i = N - bottom + 2; i <= N; i += 2) {
tkn[i][j] = 1;
tkn[i][j - 1] = 1;
}
}
}
else {
rec(0, N);
}
for (int i = 1; i <= N; i++) {
for (int j = 1; j <= N; j++) {
if (!tkn[i][j]) {
cout << '.';
}
else {
cout << '#';
}
}
cout << "\n";
}
#ifdef ONPC
cout << '\n';
#endif
}
int main() {
#ifdef ONPC
freopen("../a.in", "r", stdin);
// freopen("../a.out", "w", stdout);
#endif
ios::sync_with_stdio(0);
cin.tie(0);
cout << fixed;
cout.precision(20);
int T;
cin >> T;
while(T--) {
solve();
}
cerr << "\n\nConsumed " << TIME << endl;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3928kb
input:
3 1 2 3
output:
. ## .. ##. ... ##.
result:
ok all tests correct (3 test cases)
Test #2:
score: 0
Accepted
time: 1ms
memory: 3976kb
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: 3988kb
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: 3932kb
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: 4000kb
input:
1 100
output:
##.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# ...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# ##...................................................................................................
result:
ok all tests correct (1 test case)
Extra Test:
score: 0
Extra Test Passed