Atenţie! Aceasta este o versiune veche a paginii, scrisă la 2012-04-18 15:20:07.
Revizia anterioară   Revizia următoare  

 

Fişierul intrare/ieşire:arbsat.in, arbsat.outSursăAlgoritmiada 2012, Runda Finala
AutorCosmin GheorgheAdăugată deCezarMocanCezar Mocan CezarMocan
Timp execuţie pe test0.75 secLimită de memorie65536 kbytes
Scorul tăuN/ADificultateN/A

Vezi solutiile trimise | Statistici

Arbsat

You are given a natural number, T, and T testcases in the following format: a natural number N followed by N points with integer coordinates. For each of the T tests, your program should print 1 if the given points respect the following condition: any rectangle of positive area (greater than 0), determined by any two of the N points, contains at least another one of the N points either inside or on the borders. If the condition is not satifsied, your program should print 0 for that testcase. 

Input

The input file arbsat.in will contain on the first line T, the number of testcases. T tests follow, in the following format: N, the number of points, then N lines having the coordinates of the points.

Output

The output file arbsat.out will contain T values of 0 or 1, on separate lines, the i-th value representing the answer for the i-th testcase in the input file.

Restrictions

  • 1 ≤ T ≤ 6
  • 1 ≤ N ≤ 100.000
  • All the coordinates are positive, strictly greater than 0.

Example

arbsat.inarbsat.out
2
4
1 1
3 5
2 4
8 8
3
10 9
13 9
10 8
0
1
Trebuie sa te autentifici pentru a trimite solutii. Click aici

Cum se trimit solutii?