Inconsistent Patterns

시간 제한2초메모리 제한1024 MB

요약
두 팀이 N개 분야에서 푼 문제 수와 시도한 문제 수를 정해, 한 팀이 모든 분야에서 이기지만 전체로는 지도록 만든다.
난이도

보통10점 중 7점

유형
수학, 그리디, 구현, 정수론
정답자
아직 제출이 없습니다

문제

The Simpson's Paradox is a phenomenon in statistics where a trend or pattern that appears in different groups of data is inconsistent (disappears or even reverses) with what we see when the groups are combined. It is named after the British statistician Edward H. Simpson, who described it in 1951, although similar observations had been made earlier.

For example, let assume that two teams have been training for the UKIEPC 2024 and have the following statistics for the graph and geometry problems:

  • Team X has solved 81 out of 87 graph problems (success rate of approx 93%), and 192 out of 263 geometry (73%). Total is 273 out of 350 problems (78%).
  • Team Y has solved 234 out of 270 graph problems (87%), and 55 out of 80 geometry (69%). Total is 289 out of 350 (83%).

If we look per category --- team X has higher success rate in both categories, but when looking in combination, the pattern reverses, and team Y appears to have higher success rate.

In this problem you are to construct an example of the dataset illustrating the Simpson’s paradox. More specifically, let us assume (similarly to the example above) that there are two teams who have been solving problems of NN categories and the total number of problems solved by each of the teams is MM. Let us denote the number of the problems in ii-th category solved by Team X as a_ia\_i, attempted --- by b_ib\_i. Similarly, let us define c_ic\_i as the number of problems solved by Team Y in the ii-th category and d_id\_i as the number of problems attempted.

You are to find such a_ia\_i, b_ib\_i, c_ic\_i and d_id\_i that:

  • ∑b_i=∑d_i=M\sum b\_i = \sum d\_i = M
  • a_i≤b_ia\_i \le b\_i for all ii from 11 to NN
  • c_i≤d_ic\_i \le d\_i for all ii from 11 to NN
  • a_i,b_i,c_i,d_i>0a\_i, b\_i, c\_i, d\_i > 0 for all ii from 11 to NN
  • a_ib_i>c_id_i\frac{a\_i}{b\_i} > \frac{c\_i}{d\_i} for all ii from 11 to NN
  • ∑a_i∑b_i<∑c_i∑d_i\frac{\sum a\_i}{\sum b\_i} < \frac{\sum c\_i}{\sum d\_i}

입력

Input file contains two integer numbers NN and MM (2≤N≤100002 \le N \le 10000, 4\*N≤M≤1054\*N \le M \le 10^5).

출력

Output NN lines --- ii-th of them should contain four positive integer numbers a_ia\_i, b_ib\_i, c_ic\_i, d_id\_i, describing the dataset. Input data is selected in such a way that the solution exists.

예제1

  1. 예제 1

    입력
    2 350
    
    예상 출력
    81 87 234 270
    192 263 55 80