Submission #7637727
Source Code Expand
Copy
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1e10;
const int MOD = 1e9 + 7;
#define dump(x) \
if (dbg) { \
cout << #x << " = " << (x) << endl; \
}
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define P pair<int, int>
#define V vector<int>
#define S set<int>
#define itn int
bool dbg = false;
itn H, W, A, B;
int c[1010][1010];
int sw[1010], sh[1010];
int SW[1010], SH[1010];
void solve()
{
int x = -1, y = -1;
FOR(i, 0, H)
{
if (x != -1) {
break;
}
FOR(j, 0, W)
{
if (i * (W - 2 * A) + A * H == j * (H - 2 * B) + B * W) {
x = i;
y = j;
}
}
}
if (x == -1) {
cout << "No" << endl;
return;
}
FOR(i, 0, H)
{
if (i < x)
sh[i] = A;
else
sh[i] = W - A;
}
FOR(i, 0, W)
{
if (i < y)
sw[i] = B;
else
sw[i] = H - B;
}
FOR(i, 0, H)
{
FOR(j, 0, W)
{
if (SH[i] < sh[i] && SW[j] < sw[j]) {
c[i][j] = 1;
SH[i]++;
SW[j]++;
}
}
}
/*
int a = INF, b = INF;
int h = 0, w = 0;
FOR(i, 0, H)
{
FOR(j, 0, W)
{
c[i][j] =
}
}*/
FOR(i, 0, H)
{
FOR(j, 0, W)
{
cout << c[i][j];
}
cout << endl;
}
}
signed main()
{
cin.tie(nullptr);
ios::sync_with_stdio(false);
cin >> H >> W >> A >> B;
solve();
return 0;
}
Submission Info
Submission Time |
|
Task |
A - 01 Matrix |
User |
cuthbert |
Language |
C++14 (GCC 5.4.1) |
Score |
300 |
Code Size |
1964 Byte |
Status |
AC |
Exec Time |
45 ms |
Memory |
9216 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
300 / 300 |
Status |
|
|
Set Name |
Test Cases |
Sample |
sample-01.txt, sample-02.txt |
All |
01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, sample-01.txt, sample-02.txt |
Case Name |
Status |
Exec Time |
Memory |
01-01.txt |
AC |
1 ms |
256 KB |
01-02.txt |
AC |
1 ms |
256 KB |
01-03.txt |
AC |
1 ms |
256 KB |
01-04.txt |
AC |
4 ms |
4992 KB |
01-05.txt |
AC |
2 ms |
384 KB |
01-06.txt |
AC |
42 ms |
8448 KB |
01-07.txt |
AC |
4 ms |
5248 KB |
01-08.txt |
AC |
27 ms |
8704 KB |
01-09.txt |
AC |
44 ms |
8832 KB |
01-10.txt |
AC |
45 ms |
9216 KB |
01-11.txt |
AC |
44 ms |
9216 KB |
01-12.txt |
AC |
44 ms |
7168 KB |
sample-01.txt |
AC |
1 ms |
256 KB |
sample-02.txt |
AC |
1 ms |
256 KB |