0% found this document useful (0 votes)
7 views

Tower Capturing Codeforces

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Tower Capturing Codeforces

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

6/9/24, 10:17 PM Problem - H - Codeforces

|
NguyenDucHien | Logout

HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP

PROBLEMS SUBMIT CODE MY SUBMISSIONS STATUS HACKS ROOM STANDINGS CUSTOM INVOCATION

Codeforces Global Round 26


H. Tower Capturing Contest is running
time limit per test: 2 seconds
02:17:15
memory limit per test: 256 megabytes
input: standard input Contestant
output: standard output

There are n towers at n distinct points (x 1 , y1 ), (x 2 , y2 ), … , (x n , yn ) , such that no three


are collinear and no four are concyclic. Initially, you own towers (x 1 , y1 ) and (x 2 , y2 ) , and
→ Submit?
you want to capture all of them. To do this, you can do the following operation any number of
times:
Language: Python 3.8.10
Almost always, if you send a solution
Pick two towers P and Q you own and one tower R you don't own, such that the circle on PyPy, it works much faster
through P , Q, and R contains all n towers inside of it. Choose
Choose File No file chosen
Afterwards, capture all towers in or on triangle △P QR, including R itself. file:
Be careful: there is 50 points penalty for
An attack plan is a series of choices of R (R1 , R2 , … , Rk ) using the above operations after submission which fails the pretests or
resubmission (except failure on the first test,
which you capture all towers. Note that two attack plans are considered different only if they denial of judgement or similar verdicts).
"Passed pretests" submission verdict doesn't
differ in their choice of R in some operation; in particular, two attack plans using the same guarantee that the solution is absolutely
choices of R but different choices of P and Q are considered the same. correct and it will pass system tests.

Count the number of attack plans of minimal length. Note that it might not be possible to
Submit
capture all towers, in which case the answer is 0.

Since the answer may be large, output it modulo 998 244 353 .
→ Score table
Input
The first line contains a single integer t (1 ≤ t ≤ 250 ) — the number of test cases. Score
Problem A 444
The first line of each test case contains a single integer n (4 ≤ n ≤ 100) — the number of
Problem B 666
towers.
Problem C1 666
4 4
The i -th of the next n lines contains two integers x i and yi (−10 ≤ x i , yi ≤ 10 ) — the Problem C2 1110
location of the i -th tower. Initially, you own towers (x 1 , y1 ) and (x 2 , y2 ) .
Problem D 2220
All towers are at distinct locations, no three towers are collinear, and no four towers are Problem E 2664
concyclic.
Problem F 2664
The sum of n over all test cases does not exceed 1000 . Problem G 3552
Problem H 4440
Output
For each test case, output a single integer — the number of attack plans of minimal length Successful hack 100
after which you capture all towers, modulo 998 244 353 . Unsuccessful hack -50
Unsuccessful submission -50
Example
Resubmission -50
input Copy
* If you solve problem on 00:42 from the first attempt
3
5
1 1
2 5
3 3
4 2
5 4
6
1 1
3 3
1 2
2 1

https://codeforces.com/contest/1984/problem/H 1/2
6/9/24, 10:17 PM Problem - H - Codeforces
3 10000
19 84
7
2 7
-4 -3
-3 6
3 1
-5 2
1 -4
-1 7

output Copy

1
0
10
Note
In the first test case, there is only one possible attack plan of shortest length, shown below.

Use the operation with P = tower 1, Q = tower 2, and R = tower 5. The circle through
these three towers contains all towers inside of it, and as a result towers 3 and 5 are
captured.
Use the operation with P = tower 5, Q = tower 1, and R = tower 4. The circle through
these three towers contains all towers inside of it, and as a result tower 4 is captured.

In the second case, for example, you can never capture the tower at (3, 10 000).

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov


The only programming contests Web 2.0 platform
Server time: Jun/09/2024 22:17:42UTC+7 (j2).
Desktop version, switch to mobile version.
Privacy Policy

Supported by

https://codeforces.com/contest/1984/problem/H 2/2

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy