結果
| 問題 | 
                            No.1895 Mod 2
                             | 
                    
| コンテスト | |
| ユーザー | 
                             tktk_snsn
                         | 
                    
| 提出日時 | 2022-04-08 22:36:00 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 779 bytes | 
| コンパイル時間 | 193 ms | 
| コンパイル使用メモリ | 82,856 KB | 
| 実行使用メモリ | 1,697,612 KB | 
| 最終ジャッジ日時 | 2024-11-28 13:20:47 | 
| 合計ジャッジ時間 | 30,851 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | TLE * 1 | 
| other | TLE * 10 MLE * 1 | 
ソースコード
import bisect
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
U = 10 ** 15 + 10
P = []
Q = []
for i in range(1, U):
    s = i * i
    if s > U:
        break
    P.append(s)
    Q.append(s * 2)
P.reverse()
Q.reverse()
A = []
while P and Q:
    if P[-1] < Q[-1]:
        A.append(P.pop())
    else:
        A.append(Q.pop())
while P:
    A.append(P.pop())
while Q:
    A.append(Q.pop())
T = int(input())
L = []
R = []
for i in range(T):
    l, r = map(int, input().split())
    L.append((l, i))
    R.append((r, i))
L.sort()
R.sort()
X = [0] * T
Y = [0] * T
p = 0
for n, i in L:
    while A[p] < n:
        p += 1
    X[i] = p
p = 0
for n, i in R:
    while A[p] <= n:
        p += 1
    Y[i] = p
for x, y in zip(X, Y):
    print((y - x) % 2)
            
            
            
        
            
tktk_snsn