結果
問題 | No.1041 直線大学 |
ユーザー | tomoyaatcoder |
提出日時 | 2020-05-09 23:38:40 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 4,838 bytes |
コンパイル時間 | 142 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 90,260 KB |
最終ジャッジ日時 | 2024-07-06 06:13:37 |
合計ジャッジ時間 | 6,651 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | RE | - |
testcase_02 | RE | - |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | RE | - |
testcase_24 | RE | - |
testcase_25 | RE | - |
testcase_26 | RE | - |
testcase_27 | RE | - |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | RE | - |
testcase_31 | RE | - |
testcase_32 | RE | - |
testcase_33 | RE | - |
testcase_34 | RE | - |
testcase_35 | RE | - |
testcase_36 | RE | - |
testcase_37 | RE | - |
testcase_38 | RE | - |
testcase_39 | RE | - |
ソースコード
import sys import heapq import re from itertools import permutations from bisect import bisect_left, bisect_right from collections import Counter, deque from fractions import gcd from math import factorial, sqrt, ceil from functools import lru_cache, reduce INF = 1 << 60 MOD = 1000000007 sys.setrecursionlimit(10 ** 7) # UnionFind class UnionFind(): def __init__(self, n): self.n = n self.parents = [-1] * n 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.parents[x] > self.parents[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 members(self, x): root = self.find(x) return [i for i in range(self.n) if self.find(i) == root] def roots(self): return [i for i, x in enumerate(self.parents) if x < 0] def group_count(self): return len(self.roots()) def all_group_members(self): return {r: self.members(r) for r in self.roots()} def __str__(self): return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots()) def is_prime(n): if n == 1: return False for i in range(2,int(n**0.5)+1): if n % i == 0: return False return True # ワーシャルフロイド (任意の2頂点の対に対して最短経路を求める) # 計算量n^3 (nは頂点の数) def warshall_floyd(d, n): #d[i][j]: iからjへの最短距離 for k in range(n): for i in range(n): for j in range(n): d[i][j] = min(d[i][j],d[i][k] + d[k][j]) return d # ダイクストラ def dijkstra_heap(s, edge, n): #始点sから各頂点への最短距離 d = [10**20] * n used = [True] * n #True:未確定 d[s] = 0 used[s] = False edgelist = [] for a,b in edge[s]: heapq.heappush(edgelist,a*(10**6)+b) while len(edgelist): minedge = heapq.heappop(edgelist) #まだ使われてない頂点の中から最小の距離のものを探す if not used[minedge%(10**6)]: continue v = minedge%(10**6) d[v] = minedge//(10**6) used[v] = False for e in edge[v]: if used[e[1]]: heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1]) return d # 素因数分解 def factorization(n): arr = [] temp = n for i in range(2, int(-(-n**0.5//1))+1): if temp%i==0: cnt=0 while temp%i==0: cnt+=1 temp //= i arr.append([i, cnt]) if temp!=1: arr.append([temp, 1]) if arr==[]: arr.append([n, 1]) return arr # 2数の最小公倍数 def lcm(x, y): return (x * y) // gcd(x, y) # リストの要素の最小公倍数 def lcm_list(numbers): return reduce(lcm, numbers, 1) # リストの要素の最大公約数 def gcd_list(numbers): return reduce(gcd, numbers) # 素数判定 # limit以下の素数を列挙 def eratosthenes(limit): A = [i for i in range(2, limit+1)] P = [] while True: prime = min(A) if prime > sqrt(limit): break P.append(prime) i = 0 while i < len(A): if A[i] % prime == 0: A.pop(i) continue i += 1 for a in A: P.append(a) return P # 同じものを含む順列 def permutation_with_duplicates(L): if L == []: return [[]] else: ret = [] # set(集合)型で重複を削除、ソート S = sorted(set(L)) for i in S: data = L[:] data.remove(i) for j in permutation_with_duplicates(data): ret.append([i] + j) return ret # ここから書き始める n = int(input()) x = [0 for i in range(n)] y = [0 for i in range(n)] ans = 2 for i in range(n): x[i], y[i] = map(int, input().split()) for i in range(n): for j in range(i + 1, n): cnt = 2 for k in range(j + 1, n): if x[i] == x[j]: if x[i] == x[k]: cnt += 1 elif x[k] != x[i]: katamuki1 = (y[j] - y[i]) / (x[j] - x[i]) katamuki2 = (y[k] - y[i]) / (x[k] - x[i]) if katamuki1 == katamuki2: cnt += 1 ans = max(ans, cnt) print(ans)