QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#398494 | #2540. Build The Grid | haze# | WA | 1ms | 3644kb | C++23 | 1.5kb | 2024-04-25 13:59:21 | 2024-04-25 13:59:23 |
Judging History
answer
/*
Author: Haze
2024/4/25
*/
#include <bits/stdc++.h>
#define irep(i, l, r) for(int i = (l); i <= (r); ++ i)
#define drep(i, r, l) for(int i = (r); i >= (l); -- i)
#define IOS ios::sync_with_stdio(false), cin.tie(nullptr);
using namespace std;
typedef long long ll;
inline ll read() {
ll s = 0;
bool fl = false;
char ch = (char) getchar();
while (!isdigit(ch)) {
if (ch == '-')fl = true;
ch = (char) getchar();
}
while (isdigit(ch)) {
s = s * 10 + (ch ^ 48);
ch = (char) getchar();
}
return fl ? -s : s;
}
const int mod = 1000000000 + 7;
const int itinf = 1000000999;
const ll llinf = 2e18;
const int N = 500099;
char g[555][555];
int line[N], col[N];
void solve() {
int n = read();
irep(i, 1, n){
line[i] = col[i] = 1;
if(i > 1)
if(i % 2 == 1)line[i] = i - 1;
else col[i] = i - 1;
}
irep(i, 1, n){
irep(j, 1, n){
g[i][j] = 'B';
}
}
irep(i, 1, n){
irep(j, 1, line[i])g[i][j] = 'W';
}
irep(j, 1, n){
irep(i, 1, col[j])
g[i][j] = 'W';
}
if(n & 1){
swap(g[n], g[n - 1]);
swap(g[n - 1], g[1]);
}
irep(i, 1, n){
irep(j, 1, n){
cout << g[i][j];
}
cout << '\n';
}
return;
}
int main() {
// IOS
int T = 1;
while (T--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3644kb
input:
3
output:
WWB WWW WBB
result:
ok accepted
Test #2:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
2
output:
WW WB
result:
ok accepted
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3644kb
input:
4
output:
WWWW WBBW WWBW WBBB
result:
wrong answer there are no white cells around a black cell