結果
| 問題 |
No.3315 FPS Game
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2025-03-02 01:15:58 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,715 bytes |
| コンパイル時間 | 622 ms |
| コンパイル使用メモリ | 82,408 KB |
| 実行使用メモリ | 91,700 KB |
| 最終ジャッジ日時 | 2025-05-02 20:01:29 |
| 合計ジャッジ時間 | 7,420 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | WA * 25 |
ソースコード
# 制約確認
from collections import deque, defaultdict as dd
from copy import deepcopy
from heapq import heappop, heappush, heappushpop, heapify
from random import randint, seed, shuffle, choice, choices, sample
from time import time
INF = 1 << 60
MOD = 998244353
class Unionfind:
def __init__(self, num):
self.num = num
self.parents = [-1for _ in range(num)]
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = self.find(x)
y = self.find(y)
if x == y:
return
if self.find(x) > self.find(y):
x, y = y, x
self.parents[x] += self.parents[y]
self.parents[y] = x
def size(self, x):
return -self.parents[self.find(x)]
def same(self, x, y):
return self.find(x) == self.find(y)
def main():
n, u, v = map(int, input().split())
e = [list(map(int, input().split())) for _ in range(n-1)]
assert 3 <= n <= 100000
assert 1 <= u < v <= n-1
uf = Unionfind(n)
for u, v in e:
assert 1 <= u < v <= n
if uf.same(u-1, v-1):
assert 1 < 0
uf.union(u-1, v-1)
def no():
print(n, s, t)
for i in range(m - 1):
print(i + 1, i + 2)
for i in range(m, n):
print(randint(2, m - 1), i + 1)
def nso():
with open("output.txt", "w") as f:
print(n, s, t, file=f)
for i in range(m - 1):
print(i + 1, i + 2, file=f)
for i in range(m, n):
print(randint(2, m - 1), i + 1, file=f)
if __name__ == "__main__":
main()