반응형
Notice
Recent Posts
Recent Comments
Link
250x250
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 백준 회전초밥
- neo4j 인덱스 사용
- 백준 7795
- gensim_models
- 첫서버
- express
- neo4j
- cs50
- gensim
- 투포인터
- GET REQUESTS
- gensim size
- 워드 임베딩
- spring-boot2
- PREFECT
- nodemon babel
- 알고리즘
- 백준 2470
- UnsatisfiedDependencyException
- pandas-profiling
- 그랜빌의 법칙
- 백준
- 텍스트전처리
- neo4j 스키마 정의
- 파이썬
- spring-boot3
- BFS
- 플로이드워셜
- neo4j 제약조건
- Sequenial
Archives
- Today
- Total
정리정돈
[백준 7795] 먹을 것인가 먹힐 것인가 (Python) 본문
728x90
반응형
https://www.acmicpc.net/problem/7795
7795번: 먹을 것인가 먹힐 것인가
심해에는 두 종류의 생명체 A와 B가 존재한다. A는 B를 먹는다. A는 자기보다 크기가 작은 먹이만 먹을 수 있다. 예를 들어, A의 크기가 {8, 1, 7, 3, 1}이고, B의 크기가 {3, 6, 1}인 경우에 A가 B를 먹을
www.acmicpc.net
나의 풀이
import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
n, m = map(int,input().split())
a = map(int,input().split())
b = map(int,input().split())
a = sorted(a)
b = sorted(b)
a_start, b_start = 0,0
cnt = 0
while a_start < n and b_start < m:
if a[a_start] > b[b_start]:
cnt += 1
b_start += 1
if b_start == m:
a_start += 1
b_start = 0
else:
a_start += 1
b_start = 0
print(cnt)
알고리즘 분류 :
728x90
반응형
'알고리즘 > 백준' 카테고리의 다른 글
[백준 7456] 합이 0인 네 정수 (Python) (0) | 2022.03.25 |
---|---|
[백준 2531] 회전 초밥 (Python) (0) | 2022.03.25 |
[백준 2470] 두 용액 (Python) (0) | 2022.03.24 |
[백준 11728] 배열 합치기(Python) (0) | 2022.03.24 |
[백준 1644] 소수의 연속합(Python) (0) | 2022.03.24 |