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

ČVENK, 100 ponits

Unrated 레이팅 미적용
난이도
1s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

CROATIAN OLYMPIAD IN INFORMATICS 2015
Time limit: 3 seconds
Memory limit: 512 MB
Page \(1/2\)
A group of Czech tourists is walking in a labyrinth of a strange se\(lf-si\)milar shape. The ground plan of
the labyrinth is a Sierpinski triangle – a fractal structure named after the Polish mathematician Wacław
Sierpiński.
The labyrinth consists of a billion rows numbered from 0 to \(10^{9} - 1\) from top to bottom, and a billion columns
numbered from 0 to \(10^{9} - 1\) from left to right. The fields in the labyrinth can be either free or blocked.
The field in row \(X\) and column \(Y\) is free if the result of the bitwise ‘and’ operation on the numbers \(X\) and
\(Y\) is equal to zero, otherwise it is blocked. In other words, a field is blocked if, when \(X\) and \(Y\) are switched
to binary, there is an integer \(k\) such that the \(k\)^{th} digit from the right of the number \(X\) and the \(k\)^{th} digit from
the right of the number \(Y\) are equal to 1.
The first 32 rows and columns \(of\) the labyrinth. The blocked fields are colored \(in\) black.
The Czech tourists are tired from a long day of wandering and would like to meet up in a free field and
exchange experiences. In each step, one tourist can jump to one of the adjacent free fields (up, down, left or
right).
Write a programme that will, based on the current tourists’ locations, determine minimum total number
of steps necessary in order for all the tourists to meet in the same field.
CROATIAN OLYMPIAD IN INFORMATICS 2015
Time limit: 3 seconds
Memory limit: 512 MB
Page \(2/2\)

제약

subtask
subscore
constraints
1
17
\(N = 2\)
0 ⩽\(R_{K}\), \(S_{K} < 10^{9}\)
2
21
2 ⩽\(N\) ⩽100
0 ⩽\(R_{K}\), \(S_{K} < 10^{9}\)
3
22
2 ⩽\(N\)\(10^{5}\)
0 ⩽\(R_{K}\), \(S_{K} < 500\)
4
40
2 ⩽\(N\)\(10^{5}\)
0 ⩽\(R_{K}\), \(S_{K} < 10^{9}\)

입력 형식

The first line of input contains an integer \(N\) – the number of tourists. Each of the following \(N\) lines contains
two integers \(R@@RISE_MATH_BLOCK_0@@i\) – the row and column of the field where the \(i\)^{th} tourist is located.
All the tourists are located in free fields, and it is possible that there are multiple tourists in the same field.

출력 형식

The first and only line of output must contain the required minimum number of steps.
Please note: We recommend that you use a \(64-bi\)t integer data type (int64 in Pascal, long long in
\(C/C\)++).

예제 1
입력
2
2 1
4 3
6
2 5
3 4
8 7
9 6
10 5
11 4
출력
output
6
50
설명

Clarification of the first example: One of the fields where the brave Czech tourists could have met is
(2, 0).
Clarification of the second example: One of the fields where the playful Czech tourists could have met
is (8, 4).

문제 정보

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

출처 COCI 2014/2015 Olympiad

평가 및 의견

ČVENK, 100 ponits

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

Log in to rate problems.

개별 의견

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

풀이 제출

ČVENK, 100 ponits

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