結果
| 問題 | 
                            No.1987 Sandglass Inconvenience
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-06-24 21:43:14 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 619 bytes | 
| コンパイル時間 | 452 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 10,880 KB | 
| 最終ジャッジ日時 | 2024-11-08 17:37:10 | 
| 合計ジャッジ時間 | 1,826 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 16 WA * 6 | 
ソースコード
from itertools import permutations
L = list(map(int, input().split()))
x = int(input())
for P in permutations(range(3)):
    LL = []
    for i in range(3):
        LL.append(L[P[i]])
    for bit in range(3**3):
        Q = []
        bitc = bit
        for i in range(3):
            if bitc % 3 == 0:
                Q.append(0)
            elif bitc % 3 == 1:
                Q.append(1)
            else:
                Q.append(-1)
            bitc //= 3
        res = 0
        for i in range(3):
            res += Q[i] * LL[i]
        if abs(res) == x:
            print("Yes")
            exit()
print("No")