QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#847010#5731. CheckerboardLaVuna47#AC ✓0ms3824kbC++202.0kb2025-01-07 16:52:202025-01-07 16:52:20

Judging History

你现在查看的是最新测评结果

  • [2025-01-07 16:52:20]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3824kb
  • [2025-01-07 16:52:20]
  • 提交

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

/*

1 2 3
3 2

BBBWW
WWWBB
WWWBB
BBBWW
BBBWW
BBBWW
*/

int solve()
{
	int n, m, A, B;
	if(!(cin>>n>>m>>A>>B))return 1;
	vector<int> a(A);
	vector<int> b(B);
	FOR(i,0,A)cin>>a[i];
	FOR(i,0,B)cin>>b[i];
	vector<vector<bool>> M(n, vector<bool>(m, false));

	int k=0;
	int J=0;
	FOR(i,0,m)
	{
		int j = 0;
		if(k == b[J]) ++J, k=0;
		++k;
		bool ok = (J%2==0);

		for(auto c: a)
		{
			for(int ctr=0; ctr<c; ++ctr, ++j)
				M[j][i]=ok;
			ok=!ok;
		}
	}
	
	FOR(i,0,n)
	{
		FOR(j,0,m)
		{
			if(M[i][j])cout<<"B";
			else cout<<"W";
		}
		cout<<'\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
        cout << "__________________________" << endl;
#endif
    }
#ifdef ONPC
    cerr << endl << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl;
#endif
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3544kb

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: 3824kb

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: 3564kb

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: 3664kb

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: 3596kb

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: 3540kb

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: 3548kb

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: 3776kb

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