結果
問題 | No.826 連絡網 |
ユーザー | ゆるく |
提出日時 | 2019-05-05 04:02:56 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 958 bytes |
コンパイル時間 | 77 ms |
コンパイル使用メモリ | 10,812 KB |
実行使用メモリ | 26,264 KB |
最終ジャッジ日時 | 2023-09-05 23:23:04 |
合計ジャッジ時間 | 5,054 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 34 ms
14,764 KB |
testcase_01 | AC | 33 ms
10,388 KB |
testcase_02 | AC | 35 ms
10,364 KB |
testcase_03 | AC | 65 ms
10,440 KB |
testcase_04 | AC | 78 ms
10,544 KB |
testcase_05 | AC | 49 ms
10,328 KB |
testcase_06 | AC | 48 ms
10,528 KB |
testcase_07 | AC | 70 ms
10,468 KB |
testcase_08 | AC | 52 ms
10,272 KB |
testcase_09 | AC | 75 ms
10,384 KB |
testcase_10 | AC | 40 ms
10,316 KB |
testcase_11 | AC | 60 ms
10,436 KB |
testcase_12 | TLE | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
ソースコード
# coding: UTF-8 import sys #sys.setrecursionlimit(n) import heapq import re import bisect import random import math import itertools from collections import defaultdict, deque from copy import deepcopy from decimal import * def find(x): if node[x] < 0: return x else: node[x] = find(node[x]) return node[x] def unite(x, y): x = find(x) y = find(y) if x != y: if rank[x] > rank[y]: node[x] += node[y] node[y] = x else: node[y] += node[x] node[x] = y if rank[x] == rank[y]: rank[y] += 1 def is_same(x, y): return find(x) == find(y) def size(x): return -node[find(x)] n, p = map(int, input().split()) node = [-1 for i in range(n + 1)] rank = [0 for _ in range(n + 1)] for i in range(2,n + 1): for j in range(i, n + 1, i): if i + j > n: break unite(i, i + j) print(size(find(p)))