QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#851261 | #5731. Checkerboard | WeaRD276# | AC ✓ | 1ms | 3876kb | C++20 | 1.6kb | 2025-01-10 17:02:33 | 2025-01-10 17:02:33 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define x first
#define y second
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
typedef long long ll;
typedef double db;
typedef long double LD;
typedef pair<int, int> pii;
typedef pair<db, db> pdd;
typedef pair<ll, ll> pll;
int solve()
{
int r, c, a, b;
if (!(cin >> r >> c >> a >> b))
return 1;
vector<int> as(a), bs(b);
FOR (i, 0, a)
cin >> as[i];
FOR (i, 0, b)
cin >> bs[i];
vector<string> ans(r, string(c, '~'));
auto getStart = [&]() -> pii
{
FOR (i, 0, r)
{
FOR (j, 0, c)
{
if (ans[i][j] == '~')
return pii{i, j};
}
}
assert(false);
};
//int bl = 1;
string str = "BW";
FOR (i, 0, a)
{
FOR (j, 0, b)
{
int rr = as[i];
int cc = bs[j];
pii st = getStart();
FOR (ii, st.x, st.x + rr)
{
FOR (jj, st.y, st.y + cc)
{
ans[ii][jj] = str[(i + j) & 1];
}
}
//bl ^= 1;
}
//if (c != 1)
//bl ^= 1;
}
for (string sss: ans)
cout << sss << '\n';
return 0;
}
int32_t main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int TET = 1e9;
//cin >> TET;
for (int i = 1; i <= TET; i++)
{
if (solve())
{
break;
}
#ifdef ONPC
cerr << "_____________________________\n";
#endif
}
#ifdef ONPC
cerr << "\nfinished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec\n";
#endif
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3800kb
input:
6 5 3 2 1 2 3 3 2
output:
BBBWW WWWBB WWWBB BBBWW BBBWW BBBWW
result:
ok 6 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
4 4 2 2 1 3 3 1
output:
BBBW WWWB WWWB WWWB
result:
ok 4 lines
Test #3:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
20 20 4 14 5 2 9 4 1 2 1 1 1 1 1 1 1 1 1 1 4 3
output:
BWWBWBWBWBWBWBBBBWWW BWWBWBWBWBWBWBBBBWWW BWWBWBWBWBWBWBBBBWWW BWWBWBWBWBWBWBBBBWWW BWWBWBWBWBWBWBBBBWWW WBBWBWBWBWBWBWWWWBBB WBBWBWBWBWBWBWWWWBBB BWWBWBWBWBWBWBBBBWWW BWWBWBWBWBWBWBBBBWWW BWWBWBWBWBWBWBBBBWWW BWWBWBWBWBWBWBBBBWWW BWWBWBWBWBWBWBBBBWWW BWWBWBWBWBWBWBBBBWWW BWWBWBWBWBWBWBBBBWWW BWWBWB...
result:
ok 20 lines
Test #4:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
50 2 43 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 3 1 2 1 1 1 1 3 1 1 1 1 1 1 1
output:
BW WB BW BW WB BW WB BW WB BW WB BW WB BW WB BW WB BW WB BW WB BW WB BW WB BW BW WB BW WB BW WB BW BW BW WB BW BW WB BW WB BW WB WB WB BW WB BW WB BW
result:
ok 50 lines
Test #5:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
1 50 1 5 1 1 10 11 22 6
output:
BWWWWWWWWWWBBBBBBBBBBBWWWWWWWWWWWWWWWWWWWWWWBBBBBB
result:
ok single line: 'BWWWWWWWWWWBBBBBBBBBBBWWWWWWWWWWWWWWWWWWWWWWBBBBBB'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
50 1 17 1 4 1 1 1 6 2 3 1 3 5 1 4 5 1 6 2 4 1
output:
B B B B W B W B B B B B B W W B B B W B B B W W W W W B W W W W B B B B B W B B B B B B W W B B B B
result:
ok 50 lines
Test #7:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
2 50 2 3 1 1 14 18 18
output:
BBBBBBBBBBBBBBWWWWWWWWWWWWWWWWWWBBBBBBBBBBBBBBBBBB WWWWWWWWWWWWWWBBBBBBBBBBBBBBBBBBWWWWWWWWWWWWWWWWWW
result:
ok 2 lines
Test #8:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
50 50 29 44 2 1 1 1 2 1 3 1 1 2 3 3 1 1 2 1 1 3 2 3 3 1 1 2 1 3 1 1 2 1 1 1 2 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1
output:
BWBWWBWBBWBWBBWBWBWBWBWBBWBWWBWBWBWBWBWBBWBWBWBWBW BWBWWBWBBWBWBBWBWBWBWBWBBWBWWBWBWBWBWBWBBWBWBWBWBW WBWBBWBWWBWBWWBWBWBWBWBWWBWBBWBWBWBWBWBWWBWBWBWBWB BWBWWBWBBWBWBBWBWBWBWBWBBWBWWBWBWBWBWBWBBWBWBWBWBW WBWBBWBWWBWBWWBWBWBWBWBWWBWBBWBWBWBWBWBWWBWBWBWBWB BWBWWBWBBWBWBBWBWBWBWBWBBWBWWBWBWBWBWBWBBWBWB...
result:
ok 50 lines