반응형 [PCCP] Lv3: 기지국 설치(12979) 해설 문제- 문제 링크: 기지국 설치 해설- 자료구조: - 시간복잡도: (풀이과정)1) 2) 3) 4) 코드(C언어)solution 1)더보기solution 1#includesolution 2)더보기#includesolution 3)더보기#include (C++)solution 1)- N: 전체 범위- W: 전파의 세기- 최악의 경우 location이 매번 2W + 1씩 증가하므로 N / (2W + 1)번 반복문을 수행- 최종 시간 복잡도: O(N/W)더보기#include using namespace std;int solution(int N, vector stations, int W) { int answer = 0; int location = 1; // 현재 탐색하는 아파트의 위치 int .. 2024. 12. 25. 이전 1 다음 반응형