일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- map
- 백준 9328번
- 그래프 탐색
- insomnia
- 자바스크립트
- 백준 9466번
- Next
- string
- Express.js
- PROJECT
- HTTP
- vsc 디버깅
- 백준 28298번
- localstorage
- router
- ccw 알고리즘
- visual studio code interactive 디버깅
- MongoDB
- html5
- ERD
- 이분 탐색
- Github
- Prisma
- pm2
- branch
- 게임 서버 아키텍처
- 그리디
- JavaScript
- MySQL
- stack을 이용한 dfs
Archives
- Today
- Total
목록합이 0인 네 정수 (1)
dh_0e
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/sKnI9/btsL5mb8eS0/JNhlFVsWGYt5kaORh1rSj1/img.png)
구현은 매우 쉽지만 발상하는데 시간이 꽤 걸렸던 문제A B의 합, C D의 합을 모두 구한 배열(각각 최대 1600만) 2개를 만든 뒤 정렬하여 two pointer, binary search를 사용하여 합이 0인 쌍의 개수를 구하면 된다. #include#include#includeusing namespace std;typedef long long ll;vector vec1, vec2;ll a[4001], b[4001], c[4001], d[4001];int binary_search(int en, int target) { int st = 0; while (st 0) n2--; else n1++; } printf("%lld\n", dap); return 0;}
알고리즘/Baekjoon
2025. 2. 4. 12:20