Logo
(追記) (追記ここまで)

24250번 - Heaps 서브태스크다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1.2 초 1024 MB9026423.529%

문제

Nini and Mimi are playing a game with $N$ heaps of stones and pebbles. Each heap $i$ has $B_i$ big stones and $S_i$ small pebbles. Nini and Mimi take turns performing moves and once a player has no more moves to do, they lose. Each move consists of choosing a non-empty heap i and removing some stones and/or pebbles from it. Formally, one can remove $X$ stones and $Y$ pebbles, where 0ドル ≤ X ≤ B_i,ドル 0ドル ≤ Y ≤ S_i$ and $X + Y > 0$. However, every removed stone must be replaced with at least $K$ pebbles; it can be replaced with any natural number of pebbles not less than $K$. Thus, in any move where $X ≥ 1,ドル first $Y$ pebbles are removed and then the player must add back $Z ≥ KX$ pebbles, which are taken from an infinite supply of pebbles. Nini goes first. Before making her move she wonders whether she can win the game if she plays optimally. Write a program, which answers her question.

입력

From the first line of the standard input, your program should read $K$ and $Q$. Then $Q$ independent tests with that $K$ will follow. For each test, the first line contains $N$. The next $N$ lines each have a desription of a heap: $B_i$ and $S_i$.

출력

On $Q$ lines, your program should output the answers to each of the tests in the order they were given. It should print Win, if Nini can win, and Loss, otherwise.

제한

  • 1ドル ≤ Q ≤ 10$
  • $ 1 ≤ N ≤ 10^4$
  • 0ドル ≤ K, B_i ≤ 3000$
  • 0ドル ≤ S_i ≤ 10^7$

서브태스크

번호배점제한
18

$K = 0,ドル $B_i = 0$

211

$K = 0,ドル $B_i ≤ 1,ドル if $B_i = 1,ドル then $S_i = 0$.

312

$K = 0,ドル $B_i ≤ 300$

418

$K = 1,ドル $B_i ≤ 5$

518

$K ≤ 20,ドル $B_i ≤ 20$

610

$K ≤ 100,ドル $B_i ≤ 100$

711

$K ≤ 300,ドル $B_i ≤ 300$

812

$K ≤ 3000,ドル $B_i ≤ 3000$

예제 입력 1

3 2
2
1 5
3 2
3
0 3
2 1
3 2

예제 출력 1

Win
Loss

힌트

출처

Olympiad > International Autumn Tournament in Informatics > 2021 > Group A (Seniors) 1번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /