s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1
value | original_language stringclasses 11
values | filename_ext stringclasses 1
value | status stringclasses 1
value | cpu_time stringlengths 1 5 | memory stringlengths 1 7 | code_size stringlengths 1 6 | code stringlengths 1 539k |
|---|---|---|---|---|---|---|---|---|---|---|---|
s041144727 | p02548 | u081060730 | 1600543219 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9152 | 91 | N=int(input())
import sympy
a=0
for i in range(1,N):
a+=len(sympy.divisors(i))
print(a) |
s922370519 | p02548 | u581579603 | 1600543176 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9164 | 181 | N = int(input())
import sympy as sy
kotae = 0
for C in range(1, N):
sa = N - C
if sa == 1:
kotae += 1
else:
kotae += sy.divisor_count(sa)
print(kotae) |
s195715810 | p02548 | u607884285 | 1600543118 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9088 | 109 | import sympy
N=int(input())
count=0
for i in range(1,N):
count+=len(sympy.divisors(i))
print(count) |
s451406005 | p02548 | u811612390 | 1600543031 | Python | Python (3.8.2) | py | Runtime Error | 31 | 9096 | 196 | import sympy
def main():
n = int(input())
res = 0
for c in range(1,n):
ab = n - c
res += sympy.divisor_count(ab)
print(res)
if __name__ == "__main__":
main() |
s771136034 | p02548 | u720492855 | 1600543025 | Python | Python (3.8.2) | py | Runtime Error | 29 | 9088 | 142 | n=input()
c=0
for i in range(n):
for j in range(n-2):
for k in range(n-3):
if(i*j+k==n):
c+=1
print(c) |
s055802821 | p02548 | u107915058 | 1600542990 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9156 | 103 | n = int(input())
import sympy
ans = 0
for i in range(1,n):
ans += sympy.divisor_count(i)
print(ans) |
s327985534 | p02548 | u720492855 | 1600542974 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9088 | 142 | n=input()
c=0
for i in range(n):
for j in range(n-2):
for k in range(n-3):
if(i*j+k==n):
c+=1
print(c) |
s196719924 | p02548 | u919730120 | 1600542954 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8972 | 124 | n=int(input())
ans=0
for a in range(1,n-1):
for b in range(1,n-a):
if n-a*b<=0:
continue
else:
ans=+=1
print(ans) |
s588685223 | p02548 | u748311048 | 1600542952 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9092 | 105 | import sympy
n = int(input())
cnt = 0
for i in range(1, n):
cnt+=len(sympy.divisors(n-i))
print(cnt)
|
s644055104 | p02548 | u755801379 | 1600542951 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9156 | 97 | n=int(input())
import sympy
ans=0
for i in range(1,n):
ans+=len(sympy.divisors(i))
print(ans) |
s557525698 | p02548 | u777800738 | 1600542951 | Python | Python (3.8.2) | py | Runtime Error | 2107 | 3523080 | 141 | import numpy as np
num=int(input())-1
m=np.outer([a+1 for a in range(num)],[a+1 for a in range(num)])
m=np.where(m<=num,1,0)
print(np.sum(m)) |
s888439372 | p02548 | u107915058 | 1600542933 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9092 | 103 | import sympy
n = int(input())
ans = 0
for i in range(1,n):
ans += sympy.divisor_count(i)
print(ans) |
s667483194 | p02548 | u777800738 | 1600542924 | Python | Python (3.8.2) | py | Runtime Error | 2314 | 3512828 | 150 | import numpy as np
num=int(input())-1
m=np.outer([a+1 for a in range(num)],[a+1 for a in range(num)])
print(m)
m=np.where(m<=num,1,0)
print(np.sum(m)) |
s000968952 | p02548 | u827261928 | 1600542831 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9084 | 101 | import sympy
N=int(input())
s=0
for i in range(1,N):
x=N-i
s+=len(sympy.divisors(x))
print(s) |
s599714652 | p02548 | u206890818 | 1600542749 | Python | Python (3.8.2) | py | Runtime Error | 381 | 91764 | 525 | import math
import collections
import bisect
from collections import deque
from copy import copy, deepcopy
import time
import numpy as np
import numba
from numba import njit, b1, i4, i8, f8
from numba import jit
def main():
N = int(input())
count=0
ans=False
for i in range(N):
a,b = map(int,i... |
s391537479 | p02548 | u074220993 | 1600542598 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9096 | 228 | def main():
N = input()
ans = 0
for c in range(1, N):
ans += solve(N-c)
print(ans)
def solve(n):
res = 0
for i in range(1,n//2):
if n % i == 0:
res += 1
return res
main() |
s606140245 | p02549 | u665452497 | 1600716914 | Python | PyPy3 (7.3.0) | py | Runtime Error | 90 | 74648 | 285 | import numpypy as np
N,K=map(int,input().split())
arr=np.array([0]*N)
for _ in range(K):
l,r=map(int,input().split())
arr[l-1:r]+=1
#print(arr)
dp=np.array([0]*(2*N))
dp[1]=1
for n in range(2,N+1):
dp[n:n+N]+=(arr*(dp[n-1]%998244353))
#print(dp)
print(dp[N]%998244353) |
s714881826 | p02549 | u523885719 | 1600706380 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2208 | 104276 | 480 |
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10000)
N, K = map(int, input().split())
LR = [list(map(int, input().split())) for _ in range(K)]
m = 998244353
S = []
for lr in LR:
S.extend(range(lr[0], lr[1]+1))
p = ['a']*N
p[0] = 1
def getpi(i):
if i<0:
return 0
if p[i] == 'a':
... |
s032419036 | p02549 | u523885719 | 1600705087 | Python | PyPy3 (7.3.0) | py | Runtime Error | 481 | 89220 | 450 | import sys
input = sys.stdin.readline
N, K = map(int, input().split())
LR = [list(map(int, input().split())) for _ in range(K)]
m = 998244353
S = []
for lr in LR:
S.extend(range(lr[0], lr[1]+1))
p = ['a']*N
p[0] = 1
def getpi(i):
if i<0:
return 0
if p[i] == 'a':
t = 0
for s in S... |
s738107559 | p02549 | u523885719 | 1600704136 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 18900 | 450 | import sys
input = sys.stdin.readline
N, K = map(int, input().split())
LR = [list(map(int, input().split())) for _ in range(K)]
m = 998244353
S = []
for lr in LR:
S.extend(range(lr[0], lr[1]+1))
p = ['a']*N
p[0] = 1
def getpi(i):
if i<0:
return 0
if p[i] == 'a':
t = 0
for s in S... |
s897894587 | p02549 | u236885379 | 1600703910 | Python | PyPy3 (7.3.0) | py | Runtime Error | 101 | 74620 | 571 | #include <iostream>
using namespace std;
using ll = __int128_t;
ll dp[1000005] = {0};
pair<int, int> p[10];
int main()
{
int n, k;
cin >> n >> k;
for (int i = 0; i < k; ++i)
{
cin >> p[i].first >> p[i].second;
}
ll cur = 1;
for (int i = 1; i < n; ++i)
{
cur += dp[i];
... |
s551762384 | p02549 | u236885379 | 1600703891 | Python | PyPy3 (7.3.0) | py | Runtime Error | 91 | 74588 | 566 | #include <iostream>
using namespace std;
using ll = __int128_t;
ll dp[1000005] = {0};
pair<int, int> p[10];
int main()
{
int n, k;
cin >> n >> k;
for (int i = 0; i < k; ++i)
{
cin >> p[i].first >> p[i].second;
}
ll cur = 1;
for (int i = 1; i < n; ++i)
{
cur += dp[i];
... |
s406347813 | p02549 | u499317876 | 1600701532 | Python | Python (3.8.2) | py | Runtime Error | 440 | 17628 | 501 | N,K=map(int,input().split())
LR=[]
move=[]
P=998244353
for i in range(K):
temp=list(map(int,input().split()))
LR.append(temp)
for j in range(temp[0],temp[1]+1):
move.append(j)
move.sort()
l=len(move)
stamp={0:1}
def dp(N):
if N<0:
return 0
elif N in stamp.keys():
re... |
s936576080 | p02549 | u499317876 | 1600700702 | Python | Python (3.8.2) | py | Runtime Error | 455 | 17644 | 524 | N,K=map(int,input().split())
LR=[]
move=[]
for i in range(K):
temp=list(map(int,input().split()))
LR.append(temp)
for j in range(temp[0],temp[1]+1):
move.append(j)
move.sort()
l=len(move)
ishere={0:1}
def dp(N):
if N<0:
return 0
elif N==0:
return 1
elif N in ish... |
s256718151 | p02549 | u200916944 | 1600700408 | Python | PyPy3 (7.3.0) | py | Runtime Error | 1051 | 135220 | 360 | N,K,*LR=map(int,open(0).read().split())
S=set()
for i in range(0,K*2,2):
S |= set(range(LR[i],LR[i+1]+1))
cache={1:1}
def count(n):
if n in cache:
return cache[n]
ans=0
for s in S:
ns=n-s
if ns==1:
ans+=1
elif ns>1:
ans+=count(ns)
cache[n]=ans
... |
s375732160 | p02549 | u502731482 | 1600699399 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2208 | 85944 | 393 | n, k = map(int, input().split())
l, r = [0] * k, [0] * k
mod = 998244353
data = []
for i in range(k):
l, r = map(int, input().split())
data.append(l)
data.append(r)
data = list(set(data))
ans = 0
def check(i):
global ans
if i >= n:
if i == n:
ans += 1
return
for j i... |
s189064245 | p02549 | u502731482 | 1600699350 | Python | Python (3.8.2) | py | Runtime Error | 2205 | 9348 | 393 | n, k = map(int, input().split())
l, r = [0] * k, [0] * k
mod = 998244353
data = []
for i in range(k):
l, r = map(int, input().split())
data.append(l)
data.append(r)
data = list(set(data))
ans = 0
def check(i):
global ans
if i >= n:
if i == n:
ans += 1
return
for j i... |
s330460944 | p02549 | u422990499 | 1600691979 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 19052 | 548 | def f(L,n):
x=0
if n<1:
return 0
if n==1:
return 1
if n>1:
for i in range(len(L)):
x+=f(L,n-L[i])
x=x%998244353
return x
def f2(L,a,b):
for i in range(min(a,b),max(a,b)+1):
L[i]=1
return L
N,K=map(int,input().split())
M=[]
for... |
s217530463 | p02549 | u789542708 | 1600690091 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 9540 | 434 | def a(num, b):
ans = 0
for i in range(len(b)):
if(num - b[i] == 0):
ans = ans + 1
elif(num - b[i] > 0):
ans +=a(num - b[i], b)
return ans
N ,K = map(int, input().split())
S = []
for i in range(K):
for n in ... |
s880584741 | p02549 | u894521144 | 1600689752 | Python | PyPy3 (7.3.0) | py | Runtime Error | 150 | 97796 | 617 | def main(N, S):
dp = [0 if n != 0 else 1 for n in range(N)] # 初期値
lst_S = sorted(list(S))
for i in range(N):
if dp[i] == 0: # 計算時間削減のため, 時間さえ間に合えば不要かも.
continue
for j in lst_S:
if i + j > N - 1:
break
else:
dp[i+j] = (dp[i... |
s975317017 | p02549 | u889405092 | 1600686913 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9040 | 309 | N,K=map(int,input().split())
X=[list (map(int,input().split())) for i in range(K)]
Y=[]
for i in range(K):
for j in range(X[i-1][0],X[i-1][1]+1):
Y.append(j)
else:
else:
Z=[0]*(max(Y)-1)+[1]
for i in range(N-1):
a=0
for j in Y:
a=a+Z[len(Z)-j]
break
Z.append(a):
break
print(Z(-1))
|
s699578848 | p02549 | u889405092 | 1600686731 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9044 | 309 | N,K=map(int,input().split())
X=[list (map(int,input().split())) for i in range(K)]
Y=[]
for i in range(K):
for j in range(X[i-1][0],X[i-1][1]+1):
Y.append(j)
else:
else:
Z=[0]*(max(Y)-1)+[1]
for i in range(N-1):
a=0
for j in Y:
a=a+Z[len(Z)-j]
else:
Z.append(a):
else:
print(Z(-1))
|
s968905710 | p02549 | u889405092 | 1600686582 | Python | Python (3.8.2) | py | Runtime Error | 22 | 8936 | 317 | N,K=map(int,input().split())
X=[list (map(int,input().split())) for i in range(K)]
Y=[]
for i in range(K):
for j in range(X[i-1][0],X[i-1][1]+1):
Y.append(j)
else:
else:
Z=[0]*(max(Y)-1)+[1]
for i in range(N-1):
a=0
for j in Y:
a=a+Z[len(Z)-j]
else:
Z.append(a):
else:
print(Z(N+max(Y)-2))
|
s073057291 | p02549 | u997641430 | 1600648622 | Python | Python (3.8.2) | py | Runtime Error | 678 | 24696 | 310 | p = 998244353
n, k = map(int, input().split())
LRs = [tuple(map(int, input().split())) for _ in range(k)]
A = [0] * (2 * n)
for lj, rj in LRs:
A[lj] += 1
A[rj + 1] -= 1
s = 0
for i in range(1, n):
s = (s + A[i]) % p
for lj, rj in LRs:
A[i + lj] += s
A[i + rj + 1] -= s
print(s)
|
s348154718 | p02549 | u653837719 | 1600632037 | Python | PyPy3 (7.3.0) | py | Runtime Error | 99 | 76296 | 469 | n, k = map(int, input().split())
sec = [list(map(int, input().split())) for _ in range(k)]
sec.sort()
mod = 998244353
dp = [0] * n
dp[0] = 1
sum_dp = [0, 1]
for i in range(1, n):
for l, r in sec:
if i - l < 0:
break
elif i - r > 0:
dp[i] = ((dp[i] + sum_dp[i-l+1]) % mod - s... |
s618421869 | p02549 | u348293370 | 1600627774 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 39444 | 604 | mod = 998244353
n,k = map(int, input().split())
num_list = [list(map(int, input().split())) for _ in range(k)]
cnt_list = [0]*n
cnt_list[0] = 1
s_list = []
set_list = [0]*n
for i in range(len(num_list)):
if num_list[i][0] == num_list[i][1]:
s_list.append(num_list[i][0])
else:
for j in range(nu... |
s547134121 | p02549 | u348293370 | 1600627747 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 39440 | 604 | mod = 998244353
n,k = map(int, input().split())
num_list = [list(map(int, input().split())) for _ in range(k)]
cnt_list = [0]*n
cnt_list[0] = 1
s_list = []
set_list = [0]*n
for i in range(len(num_list)):
if num_list[i][0] == num_list[i][1]:
s_list.append(num_list[i][0])
else:
for j in range(nu... |
s290781056 | p02549 | u306412379 | 1600627034 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 26340 | 397 | from functools import lru_cache
n, k = map(int, input().split())
a = set()
for i in range(k):
l, r = map(int, input().split())
for j in range(l, r + 1):
a.add(j)
a = list(a)
x = [0] * n
x[0] = 1
@lru_cache
def mov(i):
y = 0
for d in a:
if i == 1:
return 1
elif i -... |
s125510775 | p02549 | u683116963 | 1600613279 | Python | Python (3.8.2) | py | Runtime Error | 2205 | 9652 | 455 | div = 998244353
N, K = map(int, input().split())
L = set()
for _ in range(K):
L = L.union(set(list(map(int, input().split()))))
Lst = list(L)
Lst.sort()
def cntroot(remaining, cnt, Lst):
for x in Lst:
if (remaining - x) > 0:
cnt = cntroot(remaining - x, cnt, Lst)
elif (remaining ... |
s148667121 | p02549 | u334712262 | 1600613211 | Python | PyPy2 (7.3.0) | py | Runtime Error | 508 | 84788 | 4682 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacem... |
s039435300 | p02549 | u334712262 | 1600613166 | Python | PyPy2 (7.3.0) | py | Runtime Error | 321 | 84248 | 4682 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacem... |
s783841222 | p02549 | u683116963 | 1600613139 | Python | Python (3.8.2) | py | Runtime Error | 2205 | 9496 | 448 | div = 998244353
N, K = map(int, input().split())
L = set()
for _ in range(K):
L = L.union(set(list(map(int, input().split()))))
Lst = list(L)
Lst.reverse()
print(Lst)
def cntroot(remaining, cnt, Lst):
for x in Lst:
if (remaining - x) > 0:
cnt = cntroot(remaining - x, cnt, Lst)
el... |
s829393125 | p02549 | u054514819 | 1600610558 | Python | PyPy3 (7.3.0) | py | Runtime Error | 127 | 77452 | 421 | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)
N, K = mapint()
dp = [0]*(N*2+1)
dp[1] = 1
dp[2] = -1
mod = 998244353
LR = [list(mapint()) for _ in range(K)]
for i in range(1, N+1):
dp[i] = (dp[i]+dp[i-1])%mod
for l, r in L... |
s980090597 | p02549 | u805332733 | 1600610387 | Python | PyPy3 (7.3.0) | py | Runtime Error | 106 | 69896 | 570 | # 配るDP
def resolve():
base = 998244353
N, K = map(int, input().split(" "))
LRs = []
for _ in range(K):
(L, R) = map(int, input().split(" "))
LRs.append((L, R))
dp = [0] * (N+1)
dp[1] = 1
for i in range(1, N):
dp[i] += dp[i-1]
for lr in LRs:
left = i + lr[0]
right = i + lr[1... |
s256716342 | p02549 | u239228953 | 1600605834 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9128 | 338 | n,k = list(map(int,list(input().split())))
s = []
for i in range(k):
s.append(list(map(int.list(input().split()))))
l = []
for i in s:
l.extend(i)
l = list(set(l))
dp=[0]*(n+1)
for i in l:
dp[i]=1
for i in range(n+1):
for j in l:
if i-j>0:
dp[i]+=dp[i-j]
#print(dp)
print... |
s957014963 | p02549 | u239228953 | 1600605478 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9024 | 338 | n,k = list(map(int.list(input().split())))
s = []
for i in range(k):
s.append(list(map(int.list(input().split()))))
l = []
for i in s:
l.extend(i)
l = list(set(l))
dp=[0]*(n+1)
for i in l:
dp[i]=1
for i in range(n+1):
for j in l:
if i-j>0:
dp[i]+=dp[i-j]
#print(dp)
print... |
s493645971 | p02549 | u576432509 | 1600603013 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2210 | 217432 | 694 | from bisect import bisect_left,bisect
icase=0
if icase==0:
n,k=map(int,input().split())
s=[]
for i in range(k):
li,ri=list(map(int,input().split()))
for i in range(li,ri+1):
s.append(i)
elif icase==1:
n,k=5,2
s=[1, 3, 4]
elif icase==2:
n,k=60,3
s=[5, 6, 7, 8... |
s148527491 | p02549 | u692054751 | 1600595546 | Python | PyPy3 (7.3.0) | py | Runtime Error | 87 | 74676 | 370 | n, K = [int(a) for a in input().split()]
s = [[int(a) for a in input().split()] for _ in range(K)]
MOD = 998244353
dp = [0] * (n + 1)
dp_sum = [0] * (n + 1)
dp[1] = 1
for i in range(1, n+1):
for l, r in s:
dp[i] += dp_sum[i-l if (i-l) > 0 else 0] - dp_sum[(i-r-1) if (i-r-1) > 0 else 0]
dp_sum[i]... |
s170600462 | p02549 | u145145077 | 1600594083 | Python | Python (3.8.2) | py | Runtime Error | 1480 | 26028 | 371 | n,k=map(int,input().split())
lr=[list(map(int,input().split())) for _ in range(k)]
mod = 998244353
dp = [0] * (n+1)
sdp = [0] * (n+1)
dp[1] = 1
sdp[1] = 1
for i in range(n+1):
for j in range(k):
left = max(0, i-lr[j][1])
right = max(0, i-lr[j][0]+1)
dp[i] += sdp[right] - sdp[left]
if i+1 <= n:
... |
s596993854 | p02549 | u347502437 | 1600593027 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9200 | 243 | N, K = map(int, input().split())
S = []
for i in range(K):
L, R = map(int, input().split())
S += [i in range(L, R+1)]
A = [1]
for n in range(1,N):
s = sum(A[n - i] for i in S if n - i >= 0) % 998244353
A.append(s)
print(A[N-1]) |
s047605934 | p02549 | u099006712 | 1600591096 | Python | Python (3.8.2) | py | Runtime Error | 318 | 37860 | 452 | def count(n, S, memo):
if n < 0:
return 0
elif n == 1:
return 1
elif memo[n] > -1:
return memo[n]
else:
x = 0
for s in S:
x += count(n - s, S, memo)
memo[n] = x
return memo[n]
N, K = map(int, input().split())
S = set()
for i in range(... |
s066543043 | p02549 | u602500004 | 1600589530 | Python | PyPy3 (7.3.0) | py | Runtime Error | 88 | 74888 | 857 | import math
import sys
import os
import numpy as np
sys.setrecursionlimit(10**7)
def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))
if os.getenv("LOCAL"):
inputFile = basename_without_ext = os.path.splitext(os.path.bas... |
s106833394 | p02549 | u326609687 | 1600583615 | Python | Python (3.8.2) | py | Runtime Error | 109 | 27324 | 1780 | import sys
if sys.argv[-1] == 'ONLINE_JUDGE':
import os
import re
with open(__file__) as f:
source = f.read().split('###''nbacl')
for s in source[1:]:
s = re.sub("'''.*", '', s)
sp = s.split(maxsplit=1)
if os.path.dirname(sp[0]):
os.makedirs(os.path.dirname(sp... |
s771327182 | p02549 | u851125702 | 1600580794 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2210 | 134508 | 361 | N,K=map(int,input().split())
x=998244353
S=[]
for i in range(K):
l,r=map(int,input().split())
for j in range(l,r+1):
S.append(j)
S=list(set(S))
dp=[0 for i in range(N)]
for i in range(len(S)):
dp[S[i]]=1
for i in range(N):
for j in range(len(S)):
if(i-S[j]>0):
dp[i]+=dp[i-S[j]]... |
s168788905 | p02549 | u851125702 | 1600580527 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 29080 | 360 | N,K=map(int,input().split())
x=998244353
S=[]
for i in range(K):
l,r=map(int,input().split())
for j in range(l,r+1):
S.append(j)
S=list(set(S))
dp=[0 for i in range(N)]
for i in range(len(S)):
dp[S[i]]=1
for i in range(N):
for j in range(len(S)):
if(i-S[j]>0):
dp[i]+=dp[i-S[j]]... |
s425182841 | p02549 | u515740713 | 1600577819 | Python | PyPy3 (7.3.0) | py | Runtime Error | 90 | 74800 | 1450 | # -*- coding: Shift-JIS -*-
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 998244353
class BIT2:
""" 区間加算BIT(区間加算・区間合計取得) """
def __init__(self, N):
self.N = (N+1)
self.data0 = [0] * (N+1)
self.data1 = [0] * (N+... |
s442933516 | p02549 | u332657092 | 1600569079 | Python | PyPy3 (7.3.0) | py | Runtime Error | 109 | 74316 | 311 | n, k = map(int, input().split())
s = []
for i in range(k):
l, r = map(int, input().split())
s += list(range(l, r+1)
mod = 998244353
dp = [0] * (n+1)
dp[1] = 1
s = sorted(s)
for i in range(1, n):
dp[i] %= mod
for add in s:
if i+add <= n:
dp[i+add] += dp[i]
print(dp[n] % mod) |
s585078445 | p02549 | u469254913 | 1600566533 | Python | Python (3.8.2) | py | Runtime Error | 251 | 16920 | 944 | # import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)
# from numba import njit,i8
# @njit(i8(i8,i8,i8,i8[:,:],i8[:],i8,i8))
def give_dp(N,K,mod,LR,dp,l,r):
for i in range(N):
if i > 0:
dp[i] += dp[i... |
s303552476 | p02549 | u448406471 | 1600566491 | Python | Python (3.8.2) | py | Runtime Error | 2211 | 238144 | 614 | import sys
sys.setrecursionlimit(200000)
K, N = map(int, input().split())
num_list = []
for i in range(N):
L, R = map(int, input().split())
num_list += list(range(L, R+1))
num_set = set(sorted(num_list))
counted = {}
def recursion(n, count):
if n == 0:
return 1
elif n < 0:
return... |
s838276566 | p02549 | u448406471 | 1600566358 | Python | Python (3.8.2) | py | Runtime Error | 211 | 44100 | 547 | import sys
sys.setrecursionlimit(20000)
K, N = map(int, input().split())
num_list = []
for i in range(N):
L, R = map(int, input().split())
num_list += list(range(L, R+1))
num_set = set(sorted(num_list))
counted = {}
def recursion(n):
count = 0
for i in num_set:
if n-i < 0:
continu... |
s149804902 | p02549 | u789622053 | 1600560212 | Python | PyPy2 (7.3.0) | py | Runtime Error | 423 | 86196 | 919 | # inp.readline()
# int(inp.readline())
# out.write()
# raw_input()
# map(int,raw_input().split())
# map(int,inp.readline().split())
# for _ in xrange(input()):
# print "Case #"+str(_+1)+": "+
if __name__ == "__main__":
from sys import stdin as inp, stdout as out,setrecursionlimit as srl
from collections import... |
s534262624 | p02549 | u568426505 | 1600560202 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8996 | 1131 | #include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <list>
#include <string>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip> // setprecisionを使用するのに必要 cout << fixed << setprecision(15) << p でpを小数点以下15桁表示
using namespace std;
#define REPD(i, a, b) f... |
s671931665 | p02549 | u448406471 | 1600559382 | Python | Python (3.8.2) | py | Runtime Error | 253 | 31096 | 608 | K, N = map(int, input().split())
num_list = []
for i in range(N):
L, R = map(int, input().split())
num_list += list(range(L, R+1))
num_set = set(sorted(num_list))
counted = {}
def recursion(n):
count = 0
if n == 0:
return 1
elif n < 0:
return 0
for i in num_set:
if i<=0:... |
s971809429 | p02549 | u395252999 | 1600557620 | Python | Python (3.8.2) | py | Runtime Error | 358 | 25936 | 603 | import sys
input = sys.stdin.readline
def main():
N, K = map(int, input().split())
LR = [tuple(map(int, input().split())) for _ in range(K)]
S = set()
for start, end in LR:
for i in range(start, end + 1):
S.add(i)
M = dict()
answer = calc(N, S, M)
print(answer % 9982443... |
s870203673 | p02549 | u539969758 | 1600557530 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9184 | 544 | N,X,M = map(int,input().split())
ans = X
A = X
TF = True
srt = 1000000
retu = dict()
retu[X] = 1
loop = X
for i in range(N-1):
if TF:
A = A**2 % M
if retu.get(A) != None:
srt = j
goal = i
TF = False
break
if TF:
retu[A] = 1
loop... |
s201444755 | p02549 | u395252999 | 1600557155 | Python | Python (3.8.2) | py | Runtime Error | 387 | 26000 | 640 | import sys
input = sys.stdin.readline
def main():
N, K = map(int, input().split())
LR = [tuple(map(int, input().split())) for _ in range(K)]
S = set()
for (start, end) in LR:
for i in range(start, end + 1):
S.add(i)
M = dict()
answer = calc(N, S, M)
print(answer % 99824... |
s281961779 | p02549 | u395252999 | 1600556917 | Python | Python (3.8.2) | py | Runtime Error | 363 | 26032 | 628 | import sys
input = sys.stdin.readline
def main():
N, K = map(int, input().split())
LR = [tuple(map(int, input().split())) for _ in range(K)]
S = set()
for (start, end) in LR:
for i in range(start, end + 1):
S.add(i)
M = dict()
answer = calc(N, S, M)
print(answer % 99824... |
s840925909 | p02549 | u829999015 | 1600556851 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 29732 | 391 | mod = 998244353
N, K = map(int, input().split())
LR = [map(int, input().split()) for _ in range(K)]
L, R = [list(i) for i in zip(*LR)]
a = []
for i in range(K):
a.extend(list(range(L[i], R[i] + 1)))
LR = list(set(a))
DP = [0]*N
DP[0] = 1
for i in range(N):
if i + LR[-1] >= N:
LR.pop(-1)
if len(LR) < 1:
... |
s759989503 | p02549 | u395252999 | 1600556690 | Python | PyPy3 (7.3.0) | py | Runtime Error | 1032 | 105696 | 628 | import sys
input = sys.stdin.readline
def main():
N, K = map(int, input().split())
LR = [tuple(map(int, input().split())) for _ in range(K)]
S = set()
for (start, end) in LR:
for i in range(start, end + 1):
S.add(i)
M = dict()
answer = calc(N, S, M)
print(answer % 99824... |
s816518157 | p02549 | u829999015 | 1600556177 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 30824 | 415 | mod = 998244353
N, K = map(int, input().split())
LR = [map(int, input().split()) for _ in range(K)]
L, R = [list(i) for i in zip(*LR)]
a = []
for i in range(K):
a.extend(list(range(L[i], R[i] + 1)))
LR = list(set(a))
print(LR)
DP = [0]*N
DP[0] = 1
for i in range(N):
if i + LR[-1] >= N:
LR.pop(-1)
if len(LR... |
s910618463 | p02549 | u911856499 | 1600555624 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9316 | 802 | import sys
import copy
#import math
#import itertools
#import numpy as np
#import re
def func(x,m):
return x**2%m
N,X,M=[int(c) for c in input().split()]
myset = {X}
mydict = {0:X}
A = []
A.append(X)
s = X
i = 0
i_stop = i
#i=0は計算したので1から
for i in range(1,N):
A.append(func(A[i-1],M))
if A[i] in myset:
... |
s546741675 | p02549 | u829999015 | 1600555436 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 29696 | 396 | mod = 998244353
N, K = map(int, input().split())
LR = [map(int, input().split()) for _ in range(K)]
L, R = [list(i) for i in zip(*LR)]
a = []
for i in range(K):
a.extend(list(range(L[i], R[i] + 1)))
LR = list(set(a))
DP = [0]*N
DP[0] = 1
for i in range(N):
if i + LR[-1] > N:
LR.pop(-1)
for s in LR:
loc... |
s304917057 | p02549 | u331105860 | 1600554211 | Python | Python (3.8.2) | py | Runtime Error | 535 | 107908 | 698 | import numpy as np # noqa
import numba
from numba import njit, b1, i4, i8, f8
m = 998244353
N, K = map(int, input().split())
jumps = []
for i in range(K):
l, r = map(int, input().split())
jumps.append(np.array([l, r]))
jumps = np.array(jumps)
@njit((i8, i8, i8[:, :]), cache=True)
def main(N, m, jumps):
... |
s450480041 | p02549 | u479475321 | 1600554120 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 12864 | 708 | n,k = map(int, input().split())
hani = [0 for i in range(n)]#i-1がふくまれているか
kumi = [-1 for i in range(n+1)] #iマス目に行く通り
min = n
for i in range(k):
l,r = map(int,input().split())
if l < min:
min = l
for j in range(l-1,r):
hani[j] = 1
kumi[0] = 1
for i in range(1,min):
kumi[i] = 0
kumi[min] =... |
s520083227 | p02549 | u479475321 | 1600554025 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 12820 | 727 | n,k = map(int, input().split())
hani = [0 for i in range(n)]#i-1がふくまれているか
kumi = [-1 for i in range(n+1)] #iマス目に行く通り
min = n
for i in range(k):
l,r = map(int,input().split())
if l < min:
min = l
for j in range(l-1,r):
hani[j] = 1
kumi[0] = 1
if min > 1:
for i in range(1,min):
kum... |
s042727523 | p02549 | u479475321 | 1600553827 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 12772 | 708 | n,k = map(int, input().split())
hani = [0 for i in range(n)]#i-1がふくまれているか
kumi = [-1 for i in range(n+1)] #iマス目に行く通り
min = n
for i in range(k):
l,r = map(int,input().split())
if l < min:
min = l
for j in range(l-1,r):
hani[j] = 1
kumi[0] = 1
for i in range(1,min):
kumi[i] = 0
kumi[min] =... |
s770287279 | p02549 | u331105860 | 1600553770 | Python | Python (3.8.2) | py | Runtime Error | 1726 | 107740 | 688 | import numpy as np # noqa
import numba
from numba import njit, b1, i4, i8, f8
m = 998244353
N, K = map(int, input().split())
jumps = []
for i in range(K):
l, r = map(int, input().split())
jumps.append([l, r])
jumps = np.array(jumps)
@njit((i8, i8, i8[:, :]), cache=True)
def main(N, m, jumps):
dpsum = ... |
s399909437 | p02549 | u287742786 | 1600553640 | Python | Python (3.8.2) | py | Runtime Error | 27 | 8980 | 577 | # -*- coding: utf-8 -*-
def input_int_array():
return map(int, input().split())
def answer():
n, k = input_int_array()
spans = [tuple(input_int_array()) for x in range(k)]
count = [0 for x in range(n)]
count[0] = 1
for i in range(n):
if i > 0:
count[i] += count[i-1]
... |
s091804391 | p02549 | u095094246 | 1600552917 | Python | Python (3.8.2) | py | Runtime Error | 315 | 16748 | 336 | #配るDP
n,k=map(int,input().split())
l=[0]*k
r=[0]*k
for j in range(k):
l[j],r[j] = map(int,input().split())
p=998244353
dp=[0]*(n+100)
dp[1]=1
dp[2]=-1
for i in range(1,n+1):
dp[i] += dp[i-1]
dp[i] %= p
for lj,rj in zip(l,r):
dp[i+lj] += dp[i]
dp[i+lj] %= p
dp[i+rj+1] -= dp[i]
dp[i+rj+1] %= p
... |
s758415294 | p02549 | u997641430 | 1600552435 | Python | Python (3.8.2) | py | Runtime Error | 976 | 16868 | 445 | p = 998244353
n, k = map(int, input().split())
LRs = []
for j in range(k):
lj, rj = map(int, input().split())
LRs.append((lj, rj))
A = [0] * n
i0 = min(lj for lj, rj in LRs)
A[0] = 1
A[i0] = 1
for i in range(i0 + 1, n):
A[i] = A[i - 1]
for j in range(k):
lj, rj = LRs[j]
if i - lj >= 0:
... |
s926804576 | p02549 | u479475321 | 1600551943 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 12904 | 666 | n,k = map(int, input().split())
hani = [0 for i in range(n)]
kumi = [-1 for i in range(n)]
min = n
for i in range(k):
l,r = map(int,input().split())
if l < min:
min = l
for j in range(l-1,r):
hani[j] = 1
for j in range(min-1):
kumi[j] = 0
kumi[min-1] = 1
def countt(n,hani,kumi):
an ... |
s862403037 | p02549 | u525302207 | 1600551877 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8980 | 377 | mod = 998244353
n,k = map(int,input().split())
t = [False] * 20
for i in range(k):
l,r = map(int,input().split())
for j in range(l,r+1,1):
t[j] = True
s = []
for i,v in enumerate(t):
if v == True:
s.append(i)
dp = [0] * (n+5)
dp[1] = 1
for i in range(2,n+1,1):
for d in s:
if... |
s458143661 | p02549 | u479475321 | 1600551831 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 12784 | 588 | n,k = map(int, input().split())
hani = [0 for i in range(n)]
kumi = [-1 for i in range(n)]
min = n
for i in range(k):
l,r = map(int,input().split())
if l < min:
min = l
for j in range(l-1,r):
hani[j] = 1
for j in range(min-1):
kumi[j] = 0
kumi[min-1] = 1
def countt(n,hani,kumi):
an ... |
s701070550 | p02549 | u479475321 | 1600551332 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 12904 | 634 | n,k = map(int, input().split())
hani = [0 for i in range(n)]
kumi = [-1 for i in range(n)]
for i in range(k):
l,r = map(int,input().split())
for j in range(l-1,r):
hani[j] = 1
def countt(n,hani,kumi):
if n == 1:
if hani[0] == 1:
kumi[0] = 1
else:
kumi[0] = 0... |
s585987516 | p02549 | u860002137 | 1600551235 | Python | Python (3.8.2) | py | Runtime Error | 34 | 18272 | 345 | n, k = map(int, input().split())
MOD = 998244353
lr = []
for _ in range(k):
l, r = map(int, input().split())
lr += (list(range(l, r + 1)))
lr.sort()
lr = np.array(lr)
dp = np.zeros(n + n, dtype=np.int64)
dp[0] = 1
dp2 = dp.copy()
for i in range(n):
idx = i + lr
dp2[idx] += dp[i]
dp2 %= MOD
d... |
s752607082 | p02549 | u388164885 | 1600550244 | Python | Python (3.8.2) | py | Runtime Error | 223 | 26572 | 414 | import functools
n, k = map(int, input().split())
s = set()
for i in range(k):
k1, k2 = map(int, input().split())
for i in range(k1, k2+1):
s.add(i)
@functools.lru_cache(None)
def dp(cur):
ret = 0
if cur == n:
ret += 1
for i in s:
temp = i + cur
if temp > n:
... |
s471009734 | p02549 | u380854465 | 1600550149 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2208 | 84404 | 418 | import sys
import itertools
N, K = map(int, input().split())
S = set()
dp = [0] * (N)
dp[0]=0
q = []
for i in range(K):
a, b = map(int, input().split())
for j in range(a-1, b):
dp[j+1] = 1
q.append(j+1)
q = sorted(q)
for i in range(1, N):
for j in q:
if i - j < 1:
... |
s926094336 | p02549 | u448406471 | 1600549946 | Python | Python (3.8.2) | py | Runtime Error | 220 | 31308 | 594 | K, N = map(int, input().split())
num_list = []
for i in range(N):
L, R = map(int, input().split())
num_list += list(range(L, R+1))
num_set = set(sorted(num_list))
counted = {}
def recursion(n):
global counted
count = 0
if n == 0:
return 1
elif n < 0:
return 0
for i in n... |
s775721356 | p02549 | u448406471 | 1600549913 | Python | Python (3.8.2) | py | Runtime Error | 213 | 31112 | 575 | K, N = map(int, input().split())
num_list = []
for i in range(N):
L, R = map(int, input().split())
num_list += list(range(L, R+1))
num_set = set(sorted(num_list))
counted = {}
def recursion(n):
count = 0
if n == 0:
return 1
elif n < 0:
return 0
for i in num_set:
if ... |
s870858470 | p02549 | u629454253 | 1600549610 | Python | PyPy3 (7.3.0) | py | Runtime Error | 89 | 68612 | 288 | MOD = 998244353
N, K = map(int, input().split())
seg = [tuple(map(int, input().split())) for _ in range(K)]
dp = [0] * (N+1)
dp[0] = 1
for i in range(N):
for s, t in seg:
dp[i+s] += dp[i]
dp[i+t;1] -= dp[i]
dp[i+1] += dp[i]
dp[i+1] %= MOD
print(dp[N-1])
|
s198446456 | p02549 | u525302207 | 1600548952 | Python | Python (3.8.2) | py | Runtime Error | 33 | 9084 | 402 | mod = 998244353
n,k = map(int,input().split())
t = [False] * 20
for i in range(k):
l,r = map(int,input().split())
for j in range(l,r+1,1):
t[j] = True
s = []
for i,v in enumerate(t):
if v == True:
s.append(i)
dp = [0] * (n+5)
dp[1] = 1
for i in range(2,n+1,1):
for d in s:
if... |
s036971773 | p02549 | u525302207 | 1600548888 | Python | Python (3.8.2) | py | Runtime Error | 31 | 9164 | 424 | mod = 998244353
n,k = map(int,input().split())
t = [False] * 20
for i in range(k):
l,r = map(int,input().split())
for j in range(l,r+1,1):
t[j] = True
s = []
for i,v in enumerate(t):
if v == True:
s.append(i)
dp = [0] * (n+5)
dp[1] = 1
for i in range(2,n+1,1):
for d in s:
if... |
s947311179 | p02549 | u876438858 | 1600548741 | Python | PyPy3 (7.3.0) | py | Runtime Error | 85 | 74704 | 466 | #!/usr/bin/env python3
import sys
import numpy as np
input = sys.stdin.readline
mod = 998244353
def I():
return int(input())
def MI():
return map(int, input().split())
N, K = MI()
steps = set()
for _ in range(K):
l, r = MI()
steps |= set(range(l, r + 1))
dp = np.zeros(N)
dp[0] = 1
for i in ra... |
s901503904 | p02549 | u525302207 | 1600548496 | Python | Python (3.8.2) | py | Runtime Error | 32 | 9184 | 402 | mod = 998244353
n,k = map(int,input().split())
t = [False] * 20
for i in range(k):
l,r = map(int,input().split())
for j in range(l,r+1,1):
t[j] = True
s = []
for i,v in enumerate(t):
if v == True:
s.append(i)
dp = [0] * (n+5)
dp[1] = 1
for i in range(2,n+1,1):
for d in s:
if... |
s622361908 | p02549 | u932758529 | 1600548441 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2208 | 98576 | 492 | from sys import stdin
#再起?
CON = 998244353
cnt = 0
def move(N, S):
global cnt
if N == 0:
cnt += 1
#print('ok')
return
elif N < 0:
return
else:
for x in S:
#print(x)
move(N-x, S)
S = set()
N, K = [int(x) for x in stdin.readline().rstrip().sp... |
s329975212 | p02549 | u617515020 | 1600548358 | Python | PyPy3 (7.3.0) | py | Runtime Error | 92 | 68764 | 287 | import numpy as np
P=998244353
N,K=map(int,input().split())
LR=[]
for _ in range(K):
l,r=map(int,input().split())
LR+=range(l,r+1)
LR=list(set(LR))
LR=np.array(LR)
c=[0]*N
c[0]=1
for k in range(N):
S=list(LR[LR<=k])
while len(S):
c[k]+=c[k-S[-1]]%P
S.pop()
print(c[-1]%P) |
s914623720 | p02549 | u856519712 | 1600548330 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 17668 | 482 | # -*- coding: utf-8 -*-
N, K = map(int, input().split())
D = []
S = []
T = []
mod = 998244353
for i in range(K):
D.append(list(map(int, input().split())))
while(D[i][0] <= D[i][1]):
S.append(D[i][0])
D[i][0] += 1
def func(x,S,T):
for i in range(len(T)):
if x == T[i][0]:
return T[i][1]
count =... |
s632149337 | p02549 | u932758529 | 1600548267 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2208 | 105520 | 490 | from sys import stdin
#再起?
cnt = 0
def move(N, S):
global cnt
if N == 0:
cnt += 1
cnt %= 998244353
#print('ok')
return
elif N < 0:
return
else:
for x in S:
#print(x)
move(N-x, S)
S = set()
N, K = [int(x) for x in stdin.readline().rs... |
s160354367 | p02549 | u035210736 | 1600548247 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 9404 | 258 | n, k = map(int, input().split())
a = list(set(sum([list(map(int, input().split())) for i in range(k)], [])))
def dfs(i):
cnt = 0
if i > n:
return 0
elif i == n:
return 1
for x in a:
cnt += dfs(i+x)
return cnt
print(dfs(1) % 998244353) |
s033016257 | p02549 | u465284486 | 1600548211 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2208 | 95224 | 916 | from collections import deque
import bisect
N, K = list(map(int, input().split(" ")))
S = []
for _ in range(K):
a, b = list(map(int, input().split(" ")))
S.extend(range(a, b+1))
combinations = [0] * (N + 1)
combinations[1] = 1
checked = [False] * (N + 1)
S.sort()
next_node = []
for i in S:
next_node.appe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.