0% found this document useful (0 votes)
75 views2 pages

Problem - A - Codeforces

The document outlines a problem from Codeforces Round 1025 (Div. 2) titled 'It's Time To Duel', where players report their duel outcomes in a tournament. The task is to determine if at least one player is lying about their results based on their reports. The input consists of multiple test cases with the number of players and their respective reports, and the output should indicate whether there is at least one liar for each test case.
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)
75 views2 pages

Problem - A - Codeforces

The document outlines a problem from Codeforces Round 1025 (Div. 2) titled 'It's Time To Duel', where players report their duel outcomes in a tournament. The task is to determine if at least one player is lying about their results based on their reports. The input consists of multiple test cases with the number of players and their respective reports, and the output should indicate whether there is at least one liar for each test case.
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

5/17/25, 8:14 PM Problem - A - Codeforces

gbsk12345 | 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 Round 1025 (Div. 2)


A. It's Time To Duel
Contest is running
time limit per test: 1 second
memory limit per test: 256 megabytes 02:05:51

Something you may not know about Mouf is that he is a big fan of the Yu-Gi-Oh! card game. He Contestant
loves to duel with anyone he meets. To gather all fans who love to play as well, he decided to
organize a big Yu-Gi-Oh! tournament and invited 𝑛 players.

Mouf arranged the 𝑛 players in a line, numbered from 1 to 𝑛. They then held 𝑛 − 1 consecutive
duels: for each 𝑖 from 1 to 𝑛 − 1, player 𝑖 faced player 𝑖 + 1 , producing one winner and one loser → Submit?
per match. Afterward, each player reports a value 𝑎𝑖 (0 ≤ 𝑎𝑖 ≤ 1) :
Language: GNU GCC C11 5.1.0
0 indicating they won no duels;
1 indicating they won at least one duel. Choose
Choose File No file chosen
file:
Since some may lie about their results (e.g., reporting a 1 instead of a 0, or vice versa) to
Be careful: there is 50 points penalty for
influence prize outcomes, Mouf will cancel the tournament if he can prove any report to be false. submission which fails the pretests or
resubmission (except failure on the first test,
Given the array 𝑎, determine whether at least one player must be lying. denial of judgement or similar verdicts).
"Passed pretests" submission verdict doesn't
Input guarantee that the solution is absolutely
Each test contains multiple test cases. The first line contains the number of test cases 𝑡 ( correct and it will pass system tests.
1 ≤ 𝑡 ≤ 100). The description of the test cases follows.
Submit
The first line of each test case contains one integer 𝑛 (2 ≤ 𝑛 ≤ 100 ) — the number of players in
the tournament.

The second line of each test case contains 𝑛 integers 𝑎1 , 𝑎2 , … , 𝑎𝑛 (0 ≤ 𝑎𝑖 ≤ 1 ) — denoting → Score table
the report of the 𝑖 -th player.
Score
Output Problem A 486
For each test case, print "YES" (without quotes) if there is at least one liar among the players,
Problem B 972
and "NO" (without quotes) otherwise.
Problem C1 1215
You can output the answer in any case (upper or lower). For example, the strings "yEs",
Problem C2 729
"yes", "Yes", and "YES" will be recognized as positive responses.
Problem C3 486
Example
Problem D 1701
input Copy
Problem E 2430
6
3 Problem F 2916
0 1 0
2 Successful hack 100
0 0
Unsuccessful hack -50
2
1 1 Unsuccessful submission -50
4
0 1 1 1 Resubmission -50
4
* If you solve problem on 00:07 from the first attempt
1 0 0 1
7
0 1 0 1 0 1 0

output Copy
NO
YES
YES
NO

https://codeforces.com/contest/2109/problem/A 1/2
5/17/25, 8:14 PM Problem - A - Codeforces
YES
NO

Note
In the first test case, it is consistent if player 2 defeats both players 1 and 3, so nobody's report
is necessarily false.

In the second test case, in the only match between players 1 and 2, one must win — but both
claimed zero wins, so someone must be lying.

In the third test case, the tournament consists of exactly one duel between players 1 and 2 —
but it's impossible for both to win, concluding that at least one report is false.

In the fourth test case, a possible scenario is that player 2 won against player 1, then 3 won
against 2, and then 4 won against 3. All reports align, so there is no evidence that someone lied.

Codeforces (c) Copyright 2010-2025 Mike Mirzayanov


The only programming contests Web 2.0 platform
Server time: May/17/2025 20:12:20UTC+5.5 (k2).
Desktop version, switch to mobile version.
Privacy Policy | Terms and Conditions

Supported by

https://codeforces.com/contest/2109/problem/A 2/2

You might also like