QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#401859 | #5438. Half Mixed | noviciate | WA | 1ms | 3568kb | C++14 | 1.7kb | 2024-04-29 15:53:29 | 2024-04-29 15:53:30 |
Judging History
answer
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<queue>
using namespace std;
#define inf 0x3f3f3f
const int maxn = 2000005;
inline int read() {
int tp = 0, w = 1;
char c;
c = getchar();
while (c < '0' || c>'9') {
if (c == '-') w = -1;
c = getchar();
}
while (c >= '0' && c <= '9') {
tp = tp * 10 + (c - '0');
c = getchar();
}
return tp * w;
}
int t;
int main() {
t = read();
int n, m;
while (t--) {
cin >> n >> m;
if (n % 4 == 3) {
cout << "Yes" << endl;
int tp = (n - 1) / 2 - 1;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
if (i <= tp || i == n) {
cout << 1 << " ";
}
else cout << 0 << " ";
}
cout << endl;
}
}
else if (m % 4 == 3) {
cout << "Yes" << endl;
int tp = (m - 1) / 2 - 1;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
if (j<=tp || j==m) {
cout << 1 << " ";
}
else cout << 0 << " ";
}
cout << endl;
}
}
else if (m % 4 == 0) {
cout << "Yes" << endl;
int tp = m / 2 - 1;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
if (j<=tp || j==m) {
cout << 1 << " ";
}
else cout << 0 << " ";
}
cout << endl;
}
}
else if (n%4==0) {
cout << "Yes" << endl;
int tp = n / 2 - 1;
for (int i = 1; i <= n; i++) {
if (i<=tp || i==n) {
for (int j = 1; j <= m; j++) {
cout << 1 << " ";
}
}
else {
for (int j = 1; j <= m; j++) {
cout << 0 << " ";
}
}
cout << endl;
}
}
else{
cout << "No" << endl;
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3568kb
input:
2 2 3 1 1
output:
Yes 0 0 1 0 0 1 No
result:
wrong answer 6 Mixed Submatrices Found, but 9 Expected (test case 1)