RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
문제 ICPC00122

B. Drone Photo

설명

Today, like every year at SWERC, the \(n^{2}\) contestants have gathered outside the venue to take a drone photo. Jennifer, the social media manager for the event, has arranged them into an \(n \times n\) square. Being very good at her job, she knows that the contestant standing on the intersection of the \(i-th\) row with the \(j-th\) column is \(a_{i,j}\) years old. Coincidentally, she notices that no two contestants have the same age, and that everyone is between 1 and \(n^{2}\) years old. Jennifer is planning to have some contestants hold a banner with the ICPC logo parallel to the ground, so that it is clearly visible in the aerial picture. Here are the steps that she is going to follow in order to take the perfect SWERC drone photo. • First of all, Jennifer is going to select four contestants standing on the vertices of an ax\(is-al\)igned rectangle. • Then, she will have the two younger contestants hold one of the poles, while the two older contestants will hold the other pole. • Finally, she will unfold the banner, using the poles to support its two ends. Obviously, this can only be done if the two poles are parallel and do not cross, as shown in the pictures below. Being very indecisive, Jennifer would like to try out all possible arrangements for the banner, but she is worried that this may cause the contestants to be late for the competition. How many different ways are there to choose the four contestants holding the poles in order to take a perfect photo? Two choices are considered different if at least one contestant is included in one but not the other.

제약
입력 형식

The first line contains a single integer \(n\) (\(2 \le n \le 1500\)). The next \(n\) lines describe the ages of the contestants. Specifically, the \(i-th\) line contains the integers \(a_{i,1}\), \(a_{i,2}\), . . . , \(a_{i,n}\) (\(1 \le a_{i,j} \le n^{2}\)). It is guaranteed that \(a_{i,j}\)̸ = \(a_{k,l}\) if \(i\)̸ = \(k\) or \(j\)̸ = \(l\).

출력 형식

Print the number of ways for Jennifer to choose the four contestants holding the poles. Problem B: Drone Photo SWERC \(2021-2022\)

예제 1
입력
2
1 3
4 2
출력
0
예제 2
입력
2
3 2
4 1
출력
1
예제 3
입력
3
9 2 4
1 5 3
7 8 6
출력
6
문제 정보

생성자가 기록되지 않았습니다.

출처 ICPC SWERC 2021

평가 및 의견

B. Drone Photo

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

B. Drone Photo

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8