結果

問題 No.3078 Difference Sum Query
ユーザー qwewe
提出日時 2025-05-14 13:11:02
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,252 bytes
コンパイル時間 243 ms
コンパイル使用メモリ 82,688 KB
実行使用メモリ 51,968 KB
最終ジャッジ日時 2025-05-14 13:13:02
合計ジャッジ時間 5,022 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

def solve():
    """
    Solves the Very Simple Traveling Salesman Problem.

    Reads the number of vertices N and edges M from the input.
    Since the problem specifies that the graph is complete (M = N*(N-1)/2)
    and all edge weights are 1, any Hamiltonian cycle (visiting each
    vertex exactly once and returning to the start) will consist of
    exactly N edges.
    The total weight of any such cycle is the sum of the weights of its
    N edges. Since each edge has weight 1, the total weight is N * 1 = N.
    Therefore, the minimum weight of such a cycle is always N.

    The code only needs to read N and print it. The edge details are
    not required for the calculation.
    """
    # Read N and M from the first line of input
    # n, m = map(int, sys.stdin.readline().split())
    
    # We only actually need N
    line1 = sys.stdin.readline().split()
    n = int(line1[0])

    # The rest of the input lines describe the edges, but we don't need them.
    # for _ in range(m):
    #     sys.stdin.readline() # Read and discard edge lines if needed

    # The minimum weight of a Hamiltonian cycle in a complete graph
    # where all edge weights are 1 is simply N.
    print(n)

if __name__ == "__main__":
    solve()
0