結果
問題 | No.2142 Segment Zero |
ユーザー |
![]() |
提出日時 | 2022-12-02 21:49:07 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,261 bytes |
コンパイル時間 | 341 ms |
コンパイル使用メモリ | 82,024 KB |
実行使用メモリ | 61,048 KB |
最終ジャッジ日時 | 2024-10-09 23:01:55 |
合計ジャッジ時間 | 3,398 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 31 WA * 4 |
ソースコード
import sys #input = sys.stdin.readline #input = sys.stdin.buffer.readline #文字列はダメ #sys.setrecursionlimit(1000000) import math import bisect #import itertools #import random #from heapq import heapify, heappop, heappush from collections import defaultdict from collections import deque #import copy #DeepCopy: hoge = [_[:] for _ in hogehoge] #from functools import lru_cache #@lru_cache(maxsize=None) #MOD = pow(10,9) + 7 MOD = 998244353 #dx = [1,0,-1,0] #dy = [0,1,0,-1] #dx8 = [1,1,0,-1,-1,-1,0,1] #dy8 = [0,1,1,1,0,-1,-1,-1] def make_divisors(n): lower_divisors , upper_divisors = [], [] i = 1 while i*i <= n: if n % i == 0: lower_divisors.append(i) if i != n // i: upper_divisors.append(n//i) i += 1 return lower_divisors + upper_divisors[::-1] def main(): N,K = map(int,input().split()) x = N*(N+1)//2 - K L = make_divisors(x*2) # print(L) for p in L: q = x//p # print(p,q) if (p-q+1)%2 == 1: continue if (p+q-1)%2 == 1: continue a = (p-q+1)//2 b = (p+q-1)//2 # print(a,b) if 0 <= a < b <= N: exit(print(1)) print(2) if __name__ == '__main__': main()