#include <bits/stdc++.h>
using namespace std;
int tab[310][310];
int main() {
int t, n, k, k1;
cin >> t >> n >> k >> k1;
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= n; j++) {
cin >> tab[i][j];
}
}
int ans1 = 0;
int ans2 = 0;
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= n / 2; j++) {
if(tab[i][j]) {
ans1++;
}
}
}
for(int i = 1; i <= n / 2; i++) {
for(int j = 1; j <= n; j++) {
if(tab[i][j]) {
ans2++;
}
}
}
if(ans1 < ans2) {
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= n / 2; j++) {
cout << "0 ";
}
for(int j = 1; j <= n / 2; j++) {
cout << "1 ";
}
cout << '\n';
}
}
else {
for(int i = 1; i <= n / 2; i++) {
for(int j = 1; j <= n; j++) {
cout << "0 ";
}
cout << '\n';
}
for(int i = 1; i <= n / 2; i++) {
for(int j = 1; j <= n; j++) {
cout << "1 ";
}
cout << '\n';
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
K = 24 |
2 |
Incorrect |
1 ms |
340 KB |
K = 623 |
3 |
Partially correct |
16 ms |
1052 KB |
K = 20313 |
4 |
Partially correct |
15 ms |
904 KB |
K = 23205 |
5 |
Partially correct |
15 ms |
980 KB |
K = 18430 |
6 |
Partially correct |
15 ms |
956 KB |
K = 22273 |
7 |
Partially correct |
15 ms |
952 KB |
K = 22537 |
8 |
Partially correct |
15 ms |
852 KB |
K = 20045 |
9 |
Partially correct |
15 ms |
940 KB |
K = 21031 |
10 |
Partially correct |
16 ms |
932 KB |
K = 22367 |