반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- compose
- 6987
- 연결요소
- 소프티어
- OFFSET
- boj #19237 #어른 상어
- BOJ
- dfs
- 경력
- 처우산정
- incr
- Docker
- 매개변수탐색
- 기술면접
- 성적평가
- 퇴사통보
- 물채우기
- 백준
- 오퍼레터
- @P0
- Kafka
- msSQL
- 13908
- upper_bound
- 백트래킹
- BFS
- 처우협의
- softeer
- 이분탐색
- 파라메트릭
Archives
- Today
- Total
기술 블로그
16471번 작은 숫자 내기 본문
728x90
반응형
제 5회 한양대학교 프로그래밍 경시대회 Open Contest - Advanced Div. D번 문제
https://www.acmicpc.net/problem/16471
각각 정렬을 한 후
주언이의 원소 < 사장의 원소이면, 점수 획득 및 둘 다 인덱스 증가
그게 아니면, 사장의 인덱스만 증가한다.
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | #include <iostream> #include <queue> #include <stack> #include <cstdio> #include <vector> #include <cstring> #include <string> #include <math.h> #include <algorithm> #include <map> using namespace std; vector<int> j, c; int main(void) { int num = 0, N = 0; scanf("%d", &N); for (int i = 0; i < N; i++) { scanf("%d", &num); j.push_back(num); } sort(j.begin(), j.end()); for (int i = 0; i < N; i++) { scanf("%d", &num); c.push_back(num); } sort(c.begin(), c.end()); int i=0, k = 0; int score = 0; int win = (N + 1) / 2; while(1) { if (j.at(i) < c.at(k)) ++i, ++k, ++score; else ++k; if (k == N) break; } if (score >= win) printf("YES\n"); else printf("NO\n"); return 0; } | cs |
728x90
반응형
'알고리즘 문제 > BOJ' 카테고리의 다른 글
16472번 고냥이 (0) | 2018.11.27 |
---|---|
16461번 듀얼 채널 VHF 무전기 (0) | 2018.11.27 |
15740번 A+B - 9 (2) | 2018.11.26 |
16459번 독서의 계절 (0) | 2018.11.26 |
16562번 친구비 (0) | 2018.11.24 |