QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#321950 | #8217. King's Dinner | KKT89 | WA | 1ms | 3876kb | C++17 | 3.3kb | 2024-02-05 22:56:28 | 2024-02-05 22:56:29 |
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 < n; i += 2) {
for (int j = 0; j+4 < n; j += 3) {
v[i][j] = v[i][j+1] = '#';
}
}
for (int i = 0; i+4 < n; i += 3) {
v[i][n-3] = v[i+1][n-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 < n; i += 2) {
for (int j = 0; j+6 < n; j += 3) {
v[i][j] = v[i][j+1] = '#';
}
}
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; ++i) {
for (int j = 0; j < n; ++j) {
cout << v[i][j];
}
cout << '\n';
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3876kb
input:
3 1 2 3
output:
. #. #. #.# #.# ...
result:
ok all tests correct (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3676kb
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 = 20, pans = 18 (test case 10)