Skip to content

Commit 006cd61

Browse files
committed
AC P832
1 parent 8b0695b commit 006cd61

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

P832.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include "header.h"
2+
#include <algorithm>
3+
#include <vector>
4+
5+
class Solution {
6+
public:
7+
vector<vector<int>> flipAndInvertImage(vector<vector<int>>& A) {
8+
for (auto &line:A){
9+
reverse(line.begin(), line.end());
10+
for_each(line.begin(), line.end(), [](int &p){p^=1;});
11+
}
12+
return A;
13+
}
14+
};
15+
16+
int main() {
17+
vector<vector<int>> a;
18+
a = {{1,1,0},{1,0,1},{0,0,0}};
19+
auto ret = Solution().flipAndInvertImage(a);
20+
for (auto l:ret) {
21+
for (auto p:l) {
22+
cout << p << " ";
23+
}
24+
cout << endl;
25+
}
26+
return 0;
27+
}

0 commit comments

Comments
 (0)