結果
| 問題 | 
                            No.2622 Dam
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2024-02-09 21:28:24 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 956 bytes | 
| コンパイル時間 | 143 ms | 
| コンパイル使用メモリ | 82,500 KB | 
| 実行使用メモリ | 67,112 KB | 
| 最終ジャッジ日時 | 2024-09-28 13:54:26 | 
| 合計ジャッジ時間 | 3,594 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 1 | 
| other | TLE * 1 -- * 4 | 
ソースコード
# Function to simulate the water flow and check if the dam overflows or runs out
def check_dam(V, X, Fo, Fi, Q, R):
    t = 0
    water_level = X
    while True:
        # Check if the dam overflows
        if water_level > V:
            return "Overflow"
        
        # Check if the dam runs out of water
        if water_level <= 0:
            return "Zero"
        
        # Simulate water outflow
        water_level -= Fo
        
        # Check if there's a rainfall event
        if t % Q == 0:
            water_level += Fi
        
        # Increment time
        t += 1
# Read the number of test cases
T = int(input())
# Iterate over each test case
for _ in range(T):
    # Read input parameters for the test case
    V, X, Fo, Fi, Q, R = map(int, input().split())
    
    # Call the function to check the dam status for the current test case
    result = check_dam(V, X, Fo, Fi, Q, R)
    
    # Output the result
    print(result)