結果

問題 No.2142 Segment Zero
ユーザー ygd.ygd.
提出日時 2022-12-02 21:54:15
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,262 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 60,032 KB
最終ジャッジ日時 2024-04-18 05:48:16
合計ジャッジ時間 3,752 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 67 ms
58,880 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 54 ms
59,264 KB
testcase_05 AC 57 ms
59,520 KB
testcase_06 WA -
testcase_07 AC 58 ms
59,264 KB
testcase_08 AC 67 ms
59,264 KB
testcase_09 AC 60 ms
59,392 KB
testcase_10 AC 66 ms
59,008 KB
testcase_11 AC 66 ms
59,776 KB
testcase_12 AC 67 ms
59,648 KB
testcase_13 AC 66 ms
59,136 KB
testcase_14 AC 67 ms
59,136 KB
testcase_15 AC 68 ms
59,136 KB
testcase_16 WA -
testcase_17 AC 63 ms
59,136 KB
testcase_18 AC 52 ms
59,136 KB
testcase_19 AC 54 ms
59,136 KB
testcase_20 AC 60 ms
59,520 KB
testcase_21 AC 55 ms
59,392 KB
testcase_22 AC 63 ms
59,264 KB
testcase_23 AC 55 ms
59,648 KB
testcase_24 AC 57 ms
59,392 KB
testcase_25 AC 56 ms
59,264 KB
testcase_26 AC 59 ms
59,264 KB
testcase_27 AC 56 ms
59,392 KB
testcase_28 AC 59 ms
59,264 KB
testcase_29 AC 59 ms
59,136 KB
testcase_30 AC 62 ms
59,264 KB
testcase_31 AC 52 ms
59,264 KB
testcase_32 AC 54 ms
59,136 KB
testcase_33 AC 55 ms
60,032 KB
testcase_34 AC 55 ms
59,136 KB
testcase_35 WA -
testcase_36 AC 54 ms
59,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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()
0