-
Notifications
You must be signed in to change notification settings - Fork 0
/
C. Engineer Artem.cpp
47 lines (45 loc) · 1.1 KB
/
C. Engineer Artem.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <fstream>
#include <string>
#include <iostream>
#include <math.h>
#include <bitset>
#include <algorithm>
#include<bits/stdc++.h>
#include <vector>
using namespace std;
int t;
int n, m;
int dx[2] = {-1, 0};
int dy[2] = {0, -1};
int main(){
cin >> t;
for (int z = 0; z < t; z++){
cin >> n >> m;
long long mat[n][m];
for (int x = 0; x < n; x++){
for (int y = 0; y < m; y++){
cin >> mat[x][y];
}
}
for (int x = 0; x < n; x++){
for (int y = 0; y < m; y++){
if ((x + y) % 2 == 0){
if (mat[x][y] % 2 == 1){
mat[x][y] += 1;
}
}
else{
if (mat[x][y] % 2 == 0){
mat[x][y] += 1;
}
}
}
}
for (int x = 0; x < n; x++){
for (int y = 0; y < m; y++){
cout << mat[x][y] << " ";
}
cout << "\n";
}
}
}