結果
| 問題 |
No.3033 エルハートの数え上げ
|
| コンテスト | |
| ユーザー |
qwewe
|
| 提出日時 | 2025-05-14 13:14:05 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,951 bytes |
| コンパイル時間 | 328 ms |
| コンパイル使用メモリ | 82,720 KB |
| 実行使用メモリ | 67,532 KB |
| 最終ジャッジ日時 | 2025-05-14 13:15:10 |
| 合計ジャッジ時間 | 2,847 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 3 |
| other | RE * 20 |
ソースコード
import sys
# Read the input values N, M, X from standard input.
# N: The total number of people besides Alice.
# M: The number of honest people among the N people.
# X: The number of people Alice met.
# The input values are expected to be space-separated integers on a single line.
n, m, x = map(int, sys.stdin.readline().split())
# Calculate the total number of liars among the N people.
# If there are N people in total and M are honest, the rest must be liars.
num_liars = n - m
# Determine the maximum number of liars Alice could have possibly met among the X people.
# This number is limited by two factors:
# 1. The total number of people Alice met (x). She cannot have met more liars than the total number of people she met.
# 2. The total number of liars available in the population (num_liars). She cannot have met more liars than exist.
# Therefore, the maximum number of liars she could have met is the minimum of these two quantities.
max_liars_met = min(x, num_liars)
# Calculate the minimum number of honest people Alice must have met.
# To find the minimum number of honest people, we consider the scenario where Alice met the maximum possible number of liars.
# If Alice met 'x' people in total, and the maximum number of them that could potentially be liars is 'max_liars_met',
# then the remaining people she met must be honest. This gives the minimum guaranteed number of honest people.
min_honest_met = x - max_liars_met
# The problem asks if we can be certain that Alice met 3 or more honest people.
# This certainty exists if and only if the minimum possible number of honest people she could have met is at least 3.
if min_honest_met >= 3:
# If the minimum guaranteed number of honest people is 3 or greater, we know for sure.
print("YES")
else:
# If the minimum number of honest people could be less than 3 (i.e., 0, 1, or 2),
# then we cannot be sure that she met at least 3 honest people.
print("NO")
qwewe