結果

問題 No.85 TVザッピング(1)
ユーザー lam6er
提出日時 2025-04-16 15:42:15
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 694 bytes
コンパイル時間 273 ms
コンパイル使用メモリ 82,384 KB
実行使用メモリ 53,228 KB
最終ジャッジ日時 2025-04-16 15:45:21
合計ジャッジ時間 2,136 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m, c = map(int, input().split())

# Calculate the position (X, Y) of channel C
x = (c - 1) // m + 1
y = (c - 1) % m + 1

# Check if the grid is 1x1 (but according to problem statement, at least one of N or M is >=2)
# So no need to handle 1x1 case.

# Check if the grid is single row or column
if n == 1 or m == 1:
    if n * m == 2:
        print("YES")
    else:
        print("NO")
else:
    # Check if either dimension is even
    if n % 2 == 0 or m % 2 == 0:
        print("YES")
    else:
        # Both are odd, check if C is at a corner
        is_corner = (x == 1 or x == n) and (y == 1 or y == m)
        if is_corner:
            print("NO")
        else:
            print("YES")
0