-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path275A - Lights Out.cpp
More file actions
87 lines (75 loc) · 1.67 KB
/
275A - Lights Out.cpp
File metadata and controls
87 lines (75 loc) · 1.67 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <map>
#include <cmath>
#include <climits>
#include <queue>
#include <stack>
#include <ctype.h>
#include <set>
#include <unordered_map>
#define ll long long
#define pb push_back
#define ArrayMaxLen 100001
#define vi vector<int>
#define vl vector<long long>
#define mod 1000000007
#define MAX 10000001
using namespace std;
void solve();
int main(){
#ifndef ONLINE_JUDGE
// for getting input from input.txt
freopen("input.txt", "r", stdin);
// for writing output to output.txt
freopen("output.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t=1;
// cin>>t;
while(t--){
solve();
}
return 0;
}
string keypadCodes[] ={".;","abc", "def" ,"ghi","jkl","mno","pqrs","tu","vwx","yz"} ;
#define ppp pair<int,pair<int,int > >
void solve(){
int toggletimes[5][5];
for(int i=0;i<=4;i++){
for(int j=0;j<=4;j++){
toggletimes[i][j] = 0;
}
}
for(int i=1;i<=3;i++){
for(int j=1;j<=3;j++){
cin>> toggletimes[i][j];
}
}
int finalans[5][5];
for(int i=1;i<=3;i++){
for(int j=1;j<=3;j++){
//self row
//prevrow
//next row
// finalans[i][j] = toggletimes[i][j]+toggletimes[i][j-1]+toggletimes[i][j+1]
// +toggletimes[i-1][j]+toggletimes[i-1][j-1]+toggletimes[i-1][j+1]
// +toggletimes[i+1][j]+toggletimes[i+1][j-1]+toggletimes[i+1][j+1];
finalans[i][j] =toggletimes[i][j]+ toggletimes[i][j-1]+toggletimes[i][j+1]+toggletimes[i-1][j]+toggletimes[i+1][j];
}
}
for(int i=1;i<=3;i++){
for(int j=1;j<=3;j++){
if(finalans[i][j] %2 ==0){
cout<<"1";
}else{
cout<<"0";
}
}
cout<<"\n";
}
}