전체 글
-
또~~~~ 버 플로우(경우를 세는 경우 오버플로우 날 수 있다)실수모음 2023. 10. 17. 13:12
3079번: 입국심사 첫째 줄에 N과 M이 주어진다. (1 ≤ N ≤ 100,000, 1 ≤ M ≤ 1,000,000,000) 다음 N개 줄에는 각 심사대에서 심사를 하는데 걸리는 시간인 Tk가 주어진다. (1 ≤ Tk ≤ 109) www.acmicpc.net 틀림(22번째 줄에서 오버플로우 남) 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 #include #define endl '\n' // don't use when you cover interactive problem #define all(v) v.begin(), v.end() using namespace std; typedef lon..
-
어떤 걸 기준으로 2개로 나뉠 때 자료구조 2개 쓸 수 있음아무거나적어~ 2023. 10. 5. 15:02
커서를 기준으로 왼쪽 오른쪽 나뉨(스텍 2개 사용) 1406번: 에디터 첫째 줄에는 초기에 편집기에 입력되어 있는 문자열이 주어진다. 이 문자열은 길이가 N이고, 영어 소문자로만 이루어져 있으며, 길이는 100,000을 넘지 않는다. 둘째 줄에는 입력할 명령어의 개수 www.acmicpc.net 중앙값을 기준으로 2개로 나뉨(heap 2개 사용) 2696번: 중앙값 구하기 첫째 줄에 테스트 케이스의 개수 T(1 ≤ T ≤ 1,000)가 주어진다. 각 테스트 케이스의 첫째 줄에는 수열의 크기 M(1 ≤ M ≤ 9999, M은 홀수)이 주어지고, 그 다음 줄부터 이 수열의 원소가 차례대로 주 www.acmicpc.net
-
지문을 멋대로 해석해버린 예시실수모음 2023. 9. 22. 15:55
일반화의 오류 순서쌍의 위치에 의미가 있을것이라고 생각 순서쌍에 대한 배경지식이 작용하여 순서쌍의 각 위치에도 의미(순서쌍의 첫 번째 오는 팀이 상대적인 순위가 더 높아졌다고 착각)가 있을것이라고 생각했다. 예시를 보고 이해하되, 그 예시가 강조하고 싶었던 것이 무었이었는지 다시 한번 상기하자. 2 1 2 1 1 2 답 : 2 1 오답 : 1 2 3665번: 최종 순위 올해 ACM-ICPC 대전 인터넷 예선에는 총 n개의 팀이 참가했다. 팀은 1번부터 n번까지 번호가 매겨져 있다. 놀랍게도 올해 참가하는 팀은 작년에 참가했던 팀과 동일하다. 올해는 인터넷 예선 본부에 www.acmicpc.net 물리적으로 한 칸씩 움직일것이라고 생각(이 또한 문제를 잘못 읽은 것이었음....) 문제가 일상에서 볼 수 있..
-
lower bound, upper_bound compare function아무거나적어~ 2023. 9. 20. 16:39
https://stackoverflow.com/questions/52118904/using-lower-bound-upper-bound-with-2-different-types using lower_bound/upper_bound with 2 different types I have a small working code for finding a range of items that uses a special compare method. But when I try to rewrite it with lower_bound() and upper_bound() function, I get a strange error. I have stackoverflow.com
-
평면상에서 가장 가까운 두 점(Closest Pair of Points)아무거나적어~ 2023. 9. 20. 15:29
왼쪽 평면에서 가장 가까운 두 점 사이의 거리를 dl 오른쪽 평면에서 가장 가까운 두 점 사이의 거리를 dr 이라고 하자. 그리고 두 값중 더 작은 걸 d = min{dl, dr}라고 하자. 이제 위 그림에서 S 부분을 한 변의 길이가 d/2 인 정사각형으로 쪼개보자 그러면 한 변의 길이가 d/2인 정사각형(이하 정사각형이라고 부르겠음)은 왼쪽 평면에 속하거나 오른쪽 평면에 포함된다. 하나의 정사각형 안에 두 개의 점 d1, d2가 존재한다고 가정하자. 정사각형은 하나의 평면에만 속하므로 d1, d2의 거리는 d이상이다(정사각형이 오른쪽 평면에 포함되면 d1, d2의 거리는 dr이상일 것이고, 왼쪽 평면에 포한되는 d1, d2의 거리는 dl이상일 텐데, 암튼 d보다는 크거나 같게 됨). 그런데 한 변의 ..
-
std::set::lower_bound vs std::lower_bound in C++아무거나적어~ 2023. 9. 12. 11:49
https://www.geeksforgeeks.org/difference-between-stdsetlower_bound-and-stdlower_bound-in-c/ Difference between std::set::lower_bound and std::lower_bound in C++ - GeeksforGeeks A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions. www.geeks..