QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#846987 | #5731. Checkerboard | Teapot# | AC ✓ | 0ms | 3836kb | C++20 | 1.8kb | 2025-01-07 16:43:02 | 2025-01-07 16:43:07 |
Judging History
answer
/** gnu specific **/
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
/** contains everything I need in std **/
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(S) ((int)S.size())
#define FOR(i, st_, n) for(int i = st_; i < n; ++i)
#define RFOR(i, n, end_) for(int i = (n)-1; i >= end_; --i)
#define x first
#define y second
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ull, ull> pull;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
using namespace std;
#ifdef ONPC
mt19937 rnd(228);
#else
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif
int32_t main()
{
ios::sync_with_stdio(0);
cin.tie(0);
ll r,c,a,b;
cin >> r >> c >> a >> b;
vector<ll> ar(a);
FOR(i,0,a)
cin >> ar[i];
vector<ll> ac(b);
FOR(i,0,b)
cin >> ac[i];
FOR(i,1,a)
{
ar[i] = ar[i-1]+ar[i];
}
FOR(i,1,b)
{
ac[i] = ac[i-1]+ac[i];
}
ll cr=0,cc=0;
ll k=0;
FOR(i,0,r)
{
if(i >= ar[cr])
{
k++;
cr++;
}
cc = 0;
FOR(j,0,c)
{
if(j >= ac[cc])
{
k++;
cc++;
}
if(k%2 == 0)
cout << 'B';
else
cout << 'W';
}
k-=cc;
cout << endl;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3608kb
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: 3608kb
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: 3556kb
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: 3596kb
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: 3804kb
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: 3768kb
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: 3664kb
input:
2 50 2 3 1 1 14 18 18
output:
BBBBBBBBBBBBBBWWWWWWWWWWWWWWWWWWBBBBBBBBBBBBBBBBBB WWWWWWWWWWWWWWBBBBBBBBBBBBBBBBBBWWWWWWWWWWWWWWWWWW
result:
ok 2 lines
Test #8:
score: 0
Accepted
time: 0ms
memory: 3836kb
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