euisblue
17681. 비밀지도

비밀지도

Time Complexity: O(N^2)

1#include <string> 2#include <vector> 3 4using namespace std; 5 6vector<string> solution(int n, vector<int> arr1, vector<int> arr2) { 7 vector<string> answer; 8 9 vector<int> binary(n); 10 11 for(int i=0; i<n; ++i) { 12 binary[i] = arr1[i] | arr2[i]; 13 } 14 15 for(int x : binary) { 16 string m = ""; 17 for(int i=0; i<n; ++i) { 18 m = ((x&1 == 1) ? '#' : ' ') + m; 19 x >>= 1; 20 } 21 answer.push_back(m); 22 } 23 24 return answer; 25}