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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s111813446 | p03475 | u934868410 | 1579713513 | Python | PyPy3 (2.4.0) | py | Runtime Error | 180 | 38384 | 282 | import math
n = int(input())
c = []
s = []
f = []
for i in range(n-1):
x,y,z = map(int, input().split())
c += [x]
s += [y]
f += [z]
for i in range(n-1):
ans = s[i]+c[i]
for j in range(i+1, n-1):
ans = (ans//f[j]) * math.ceil(ans/f[j]) + c[j]
print(ans)
print(0) |
s167613481 | p03475 | u934868410 | 1579713429 | Python | PyPy3 (2.4.0) | py | Runtime Error | 181 | 38384 | 280 | import math
n = int(input())
c = []
s = []
f = []
for i in range(n-1):
x,y,z = map(int, input().split())
c += [x]
s += [y]
f += [z]
for i in range(n-1):
ans = s[i]+c[i]
for j in range(i+1, n):
ans = (ans//f[j]) * math.ceil(ans/f[j]) + c[j]
print(ans)
print(0) |
s394108747 | p03475 | u934868410 | 1579713306 | Python | PyPy3 (2.4.0) | py | Runtime Error | 182 | 38384 | 267 | import math
n = int(input())
c = []
s = []
f = []
for i in range(n):
x,y,z = map(int, input().split())
c += [x]
s += [y]
f += [z]
for i in range(n):
ans = s[i]+c[i]
for j in range(i+1, n):
ans = (ans//f[j]) * math.ceil(ans/f[j]) + c[j]
print(ans) |
s816387494 | p03475 | u311636831 | 1575589978 | Python | PyPy2 (5.6.0) | py | Runtime Error | 37 | 28012 | 272 | N=int(input())
C=[0]*N
S=[0]*N
F=[0]*N
for i in range(N-1):
C[i],S[i],F[i]=map(int,input().split())
def calc(n):
t=0
for i in range(n,N-1):
if(t<S[i]):
t=S[i]
t+=t%F[i]
t+=C[i]
print(t)
for i in range(N):
calc(i) |
s517300662 | p03475 | u803617136 | 1575140234 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 490 | N = int(input())
f = [list(map(int, input().split())) for _ in range(N)]
p = [list(map(int, input().split())) for _ in range(N)]
ans = -(10 ** 7)
stk = []
stk.append([0] * N)
for i in range(10):
len_stk = len(stk)
for j in range(len_stk):
total = 0
arr = []
for k in range(N):
... |
s098907715 | p03475 | u842651507 | 1574941950 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3060 | 205 | n=int(input())
c=[0]*n;s=[0]*n;f=[0]*n
for i in range(n):
c[i],s[i],f[i]=map(int,input().split())
for i in range(n):
ans=0
for j in range(i,n):
ans+=c[i]+(s[i]+f[i]-ans)%f[i]
print(ans)
|
s133982594 | p03475 | u815878613 | 1574776164 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3188 | 567 | import math
import sys
read = sys.stdin.buffer.read
def main():
N = int(input())
m = map(int, read().split())
CSF = list(zip(m, m, m))
tt = []
for j in range(N-1):
t = CSF[j][1] + CSF[j][0]
for i in range(j+1, N-1):
if t >= CSF[i][1]:
n = (t - CSF[i][... |
s404597745 | p03475 | u693953100 | 1573955479 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 3 | あ |
s874518834 | p03475 | u408620326 | 1573343270 | Python | PyPy3 (2.4.0) | py | Runtime Error | 164 | 38256 | 446 | import sys
input = sys.stdin.readline
N = int(input().strip())
C = [0] * (N - 1)
S = [0] * (N - 1)
F = [0] * (N - 1)
ans = [0] * (N)
for n in range(N-1):
C, S, F = [int(x) for x in input().strip().split()]
ans[n] = S + C
for i in range(n):
if ans[i] <= S:
ans[i] = S + C
elif ans... |
s065316432 | p03475 | u625963200 | 1571827227 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3060 | 200 | n=int(input())
CSF=[list(map(int,input().split())) for _ in range(n-1)]
for i in range(n):
ans=0
for c,s,f in CSF[i:]:
if ans<s:
ans=s
else:
ans+=f-t%f
ans+=c
print(ans) |
s000696268 | p03475 | u527261492 | 1570069334 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 466 | n=int(input())
lst=[]
for i in range(n):
c,s,f=map(int,input().split())
lst.append([c,s,f])
for j in range(n-1):
time=lst[j][0]+lst[j][1]
ind=j
for k in range(n-j-2):
if time<=lst[ind+1][1] :
time=lst[ind+1][0]+lst[ind+1][1]
ind+=1
elif (time-lst[ind+1][1])%lst[ind+1][2]==0:
time+=ls... |
s729543372 | p03475 | u527261492 | 1570068750 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 479 | n=int(input())
lst=[]
for i in range(n):
c,s,f=map(int,input().split())
lst.append([c,s,f])
time=0
ind=0
for j in range(n-1):
time=lst[j][0]+lst[j][1]
ind=j
for k in range(n-j-1):
if time<=lst[ind+1][1] :
time=lst[ind+1][0]+lst[ind+1][1]
ind+=1
elif (time-lst[ind+1][1])%lst[ind+1][2]==0:
... |
s315633613 | p03475 | u527261492 | 1570068624 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 466 | n=int(input())
lst=[]
for i in range(n):
c,s,f=map(int,input().split())
lst.append([c,s,f])
for j in range(n-1):
time=lst[j][0]+lst[j][1]
ind=j
for k in range(n-j-1):
if time<=lst[ind+1][1] :
time=lst[ind+1][0]+lst[ind+1][1]
ind+=1
elif (time-lst[ind+1][1])%lst[ind+1][2]==0:
time+=ls... |
s272757997 | p03475 | u527261492 | 1570068417 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 399 | n=int(input())
lst=[]
for i in range(n):
c,s,f=map(int,input().split())
lst.append([c,s,f])
for j in range(n-1):
time=lst[j][0]+lst[j][1]
for k in range(n-j-1):
if time<=lst[j+1][1] :
time=lst[j+1][0]+lst[j+1][1]
elif (time-lst[j+1][1])%lst[j+1][2]==0:
time+=lst[j+1][2]
else:
time+... |
s510047333 | p03475 | u933341648 | 1569903126 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 240 | n = int(input())
station = (tuple(map(int, input().split())) for _ in range(n-1))
for i in range(n):
res = 0
for j in range(i, n-1):
c, s, f = station[j]
res += max(s - res, (res+f-1)//f*f - res) + c
print(res)
|
s933580418 | p03475 | u780962115 | 1568987877 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 615 | n=int(input())
lists=[list(map(int,input().split())) for _ in range(n-1)]
lists.append(s)
for x in range(n):
nums=x+1
if nums==n:
print(0)
else:
times=0
while nums<n:
if times>=lists[nums-1][1]:
if (times-lists[nums-1][1])%lists[nums-1][2]!=0:
... |
s651029075 | p03475 | u077291787 | 1566991850 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3060 | 377 | # ABC084C - Special Trains
def main():
N = int(input())
A = tuple(tuple(map(int, input().split())) for _ in range(N - 1))
for i in range(n):
cur = 0
for c, s, f in A[i:]:
if cur <= s:
cur = s + c
else:
cur = (cur + f - 1) // f * f + c
... |
s012151430 | p03475 | u528005130 | 1562977246 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 690 | #include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int main(void){
// Your code here!
long long n, t, j;
vector<vector<long long>> csf(501, vector<long long>(3, 0));
cin >> n;
for(int i = 0; i < n; i++)
cin >> csf[i][0] >> csf[i][1] >> csf[i][2];
for(in... |
s017470198 | p03475 | u652081898 | 1557834533 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 380 | n = (input())
csf = [list(map(int, input().split())) for _ in range(n-1)]
for i in range(n):
point = i
ans = 0
while point < n-1:
c, s, f = csf[point][0], csf[point][1], csf[point][2]
if ans < s:
ans += s-ans+c
else:
if ans%f != 0:
ans += f-(a... |
s002679643 | p03475 | u163320134 | 1557515755 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3192 | 351 | n=int(input())
arr=[list(map(int,input().split())) for _ in range(n-1)]
for i in range(n-1):
ans=arr[i][0]+arr[i][1]
for j in range(i+1,n-1):
if ans<=arr[j][1]:
ans=arr[j][0]+arr[j][1]
else:
if (ans-arr[j][1])%ans[j][2]==0:
ans+=arr[j][0]
else:
ans+=arr[j][0]+arr[j][2]-ans%... |
s605060753 | p03475 | u502389123 | 1556407848 | Python | Python (3.4.3) | py | Runtime Error | 64 | 3064 | 354 | N = int(input())
C = [0] * (N-1)
S = [0] * (N-1)
F = [0] * (N-1)
for i in range(N-1):
C[i], S[i], F[i] = map(int, input().split())
for i in range(N):
time = 0
for j in range(i, N-1):
if time < S[j]:
time = S[j]
elif time % F[j]:
time += F[j] - (t % F[j])
time... |
s845930464 | p03475 | u859897687 | 1555933640 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 227 | n=int(input())
m=[]
for c,s,f in map(int,input().split()):
m.append(0)
for i in range(len(m)):
if m[i]>s:
m[i]=s+((m[i]-s)//f+((m[i]-s)%f>0))*f+c
else:#m[i]<=s
m[i]=s+c
m.append(0)
for i in m:
print(i) |
s250889422 | p03475 | u037430802 | 1555807717 | Python | Python (3.4.3) | py | Runtime Error | 16 | 2940 | 403 | n = int(input())
C = []
S = []
F = []
for i in range(n-1):
c,s,f = map(int, input().split())
C.append(c)
S.append(s)
F.append(f)
for i in range(n):
t = 0
for j in range(i,n-1):
if t < S[j]:
t = S[j]
elif t % F[j] == 0:
;#到着タイミングと発車タイミングが同じなので待ち時間0
else:
t = t + F[j] - (t %... |
s953531226 | p03475 | u859897687 | 1555073340 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 240 | n=int(input())
l=[list(map(int,input().split()))for i in range(n-1)]
for i in range(n-1):
t=0
for j in range(j,n-1):
if t<l[j][1]:
t=l[j][1]
if t%l[j][2]!=0:
t=(t%l[j][2]+1)*l[j][2]
t+=l[j][0]
print(t)
print(0) |
s657343646 | p03475 | u052499405 | 1554481495 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3060 | 421 | n = int(input())
csf = [[int(item) for item in input().split()] for _ in range(n-1)]
for i in range(n):
total_time = 0
for c, s, f in csf[i:]:
time = 0
# wait for start
if total_time < s:
time += s - total_time
# wait for next train
else:
time += ... |
s796287231 | p03475 | u020604402 | 1553971667 | Python | Python (3.4.3) | py | Runtime Error | 2251 | 301300 | 441 | N = int(input())
train = [[] for _ in range(N)]
take_time = []
for cnt in range(N - 1):
x, y , z = map(int,input().split())
take_time.append(x)
for _ in range(15001 ) :
train[cnt].append(y)
y += z
from bisect import bisect_left
for place in range(N):
now = 0
for i in range(place,N -... |
s940947121 | p03475 | u020604402 | 1553970180 | Python | Python (3.4.3) | py | Runtime Error | 251 | 23412 | 439 | N = int(input())
train = [[] for _ in range(N)]
take_time = []
for cnt in range(N - 1):
x, y , z = map(int,input().split())
take_time.append(x)
for _ in range(10**3):
train[cnt].append(y)
y += z
from bisect import bisect_left
for place in range(N):
now = 0
for i in range(place,N - 1... |
s910691921 | p03475 | u020604402 | 1553970092 | Python | PyPy3 (2.4.0) | py | Runtime Error | 405 | 89052 | 439 | N = int(input())
train = [[] for _ in range(N)]
take_time = []
for cnt in range(N - 1):
x, y , z = map(int,input().split())
take_time.append(x)
for _ in range(10**4):
train[cnt].append(y)
y += z
from bisect import bisect_left
for place in range(N):
now = 0
for i in range(place,N - 1... |
s955897934 | p03475 | u837286475 | 1553821954 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 742 |
import math
import bisect
prime = [2,3,5,7,11,13,17,19]
for i in range(prime[-1]+2,100,2):
x = int( math.sqrt(i) )
x += 1 if x%2 == 0 else 0
found = False
for p in prime:
if p>x:
break;
if i % p == 0:
found = True
if not found:
p... |
s294860150 | p03475 | u046187684 | 1553800453 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3184 | 427 | from math import ceil
def solve(string):
pass
n, *csf = map(int, string.split())
f_list = []
for c, s, f in csf:
f_list = [c + ceil((max(_f, s)) / f) * f for _f in f_list]
f_list.append(c + s)
f_list.append(0)
return "\n".join([str(_f) for _f in f_list])
if __name__ == '__mai... |
s967451486 | p03475 | u853900545 | 1546311208 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 338 | n = int(input())
c,s,f = [0]*n,[0]*n,[0]*n
for i in range(n-1):
c[i],s[i],f[i] = map(int,input().split())
for i in range(n):
cnt = 0
j = i
while j < n-1:
if cnt <= s[j]:
cnt += s[j]+c[j]
else:
cnt = s[j]+(cnt - s[j])//f[j]+[0,1]((cnt - s[j])%f[j])+c[j]
j +... |
s235208936 | p03475 | u550943777 | 1545938842 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3064 | 347 | n = int(input())
csf = []
for i in range(n):
csf.append(list(map(int,input().split())))
for i in range(n-1):
time = 0
for j in range(i,n-1):
if time < csf[j][1]:
time = csf[j][0] + csf[j][1]
else:
tmp = (time-csf[j][1])%csf[j][2] +csf[j][0]
time += tmp
... |
s151304401 | p03475 | u037098269 | 1545621150 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3136 | 758 | n = int(input())
c_list = []
s_list = []
f_list = []
def train(i,c_list=c_list,s_list=s_list,f_list=f_list):
global ans
if s_list[i+1] < ans:
ans += (f_list[i+1]-(ans % f_list[i+1])+c_list[i+1])
elif s_list[i+1] == ans:
ans += c_list[i+1]
else:
ans = s_list[i+1] + c_list[i+1... |
s304940364 | p03475 | u037098269 | 1545612691 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 770 | n = int(input())
c_list = []
s_list = []
f_list = []
def train(i=i,c_list=c_list,s_list=s_list,f_list=f_list):
global ans
if s_list[i+1] < ans:
ans += (f_list[i+1]-(ans % f_list[i+1])+c_list[i+1])
elif s_list[i+1] == ans:
ans += c_list[i+1]
else:
ans = s_list[i+1] + c_list[i... |
s349045739 | p03475 | u037098269 | 1545603594 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3128 | 632 | n = int(input())
c_list = []
s_list = []
f_list = []
def train(i):
global ans
if s_list[i+1] < ans:
ans += (f_list[i+1]-(ans % f_list[i+1])+c_list[i+1])
elif s_list[i+1] == ans:
ans += c_list[i+1]
else:
ans = s_list[i+1] + c_list[i+1]
global count
count += 1
if c... |
s005275174 | p03475 | u879870653 | 1539947279 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 431 | N = int(input())
C = []
S = []
F = []
for i in range(N-1) :
c,s,f = map(int,input().split())
C.append(c)
S.append(s)
F.append(f)
for i in range(N) :
if j == N-1 :
print(0)
else :
ans = 0
for j in range(i,N-1) :
if ans < S[j] :
ans = S[j]
... |
s705000622 | p03475 | u879870653 | 1539947235 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 431 | N = int(input())
C = []
S = []
F = []
for i in range(N-1) :
c,s,f = map(int,input().split())
C.append(c)
S.append(s)
F.append(f)
for i in range(N) :
if j == N-1 :
print(0)
else :
ans = 0
for j in range(i,N-1) :
if ans < S[j] :
ans = S[j]
... |
s545183274 | p03475 | u497625442 | 1534909448 | Python | Python (3.4.3) | py | Runtime Error | 64 | 3064 | 472 | N = int(input())
C = [0 for _ in range(N-1)]
S = [0 for _ in range(N-1)]
F = [0 for _ in range(N-1)]
for i in range(N-1):
C[i],S[i],F[i] = map(int,input().split())
def f(i):
s = 0
while i < N-1:
# find the fastest train at time s from i stattion.
if s <= S[i]:
s = S[i]+C[i]
else:
m = (s-S[i]) % F[i]
... |
s232338109 | p03475 | u102902647 | 1533884414 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 690 | # -*- coding: utf-8 -*-
"""
Created on Fri Aug 10 02:27:58 2018
@author: Yuki
"""
N = int(input())
data = []
for i in range(N-1):
c, s, f = map(int, input().split())
# data.append([c, s, f])
def train_time(start_time=0, data_list=[12, 24, 6]):
if data_list[1] <= start_time:
return start_time + (d... |
s085025782 | p03475 | u033616936 | 1528248312 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3064 | 791 | n = input('input N: ')
c, s, f = [], [], []
for i in range(int(n) - 1):
tmp = input('input C, S, F: ').split()
c.append(tmp[0])
s.append(tmp[1])
f.append(tmp[2])
# n = 3
# c = [6, 1]
# s = [5, 10]
# f = [1, 1]
# n = 4
# c = [12, 52, 99]
# s = [24, 16, 2]
# f = [6, 4, 2]
# n = 4
# c = [12, 44, 66]
# s ... |
s397591962 | p03475 | u756988562 | 1528078232 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 399 | = int(input())
C = []
S = []
F = []
for i in range(N-1):
C_temp,S_temp,F_temp = map(int,input().split())
C.append(C_temp)
S.append(S_temp)
F.append(F_temp)
ans = S[0]
for i in range(N):
t = 0
for j in range(i,N-1):
if t<S[j]:
t = S[j]
elif t%F[j] == 0:
pa... |
s593186583 | p03475 | u125205981 | 1521402728 | Python | Python (3.4.3) | py | Runtime Error | 1461 | 987016 | 479 | import bisect
def main():
N = int(input())
CSF = tuple(tuple(map(int, input().split())) for _ in [0] * (N - 1))
start = [[] for _ in [0] * N]
arrival = 50000
for i, (c, s, f) in enumerate(CSF):
start[i] = [j for j in range(s, arrival, f)]
for i in range(N - 1):
sec = 0
... |
s895767453 | p03475 | u125205981 | 1521402478 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3188 | 487 | import bisect
def main():
N = int(input())
CSF = tuple(tuple(map(int, input().split())) for _ in [0] * (N - 1))
start = [[] for _ in [0] * N]
for i, (c, s, f) in enumerate(CSF):
arrival = s + c + 1
start[i] = [j for j in range(s, arrival, f)]
for i in range(N - 1):
sec = 0... |
s693520454 | p03475 | u729707098 | 1521264853 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 267 | n = int(input())
c,s,f = [0]*(n-1)
for i in range(n-1): c[i],s[i],f[i] = map(int,input().split())
for j in range(n-1):
answer = 0
for k in range(j,n-1):
if answer<s[k]: answer = s[k]
elif answer%f[k]: answer += f[k]-(answer%f[k])
answer += c[k]
print(answer) |
s811278125 | p03475 | u092650292 | 1516679282 | Python | Python (3.4.3) | py | Runtime Error | 49 | 3544 | 592 | n = int(input())
c = []
s = []
f = []
for i in range(n-1):
a = list(map(int, input().split(" ")))
c.append(a[0])
s.append(a[1])
f.append(a[2])
def arrivetime(stnum,nowtime):
if stnum is n-1:
print(nowtime)
# return(nowtime)
else:
if nowtime <= s[stnum]:
now... |
s862355976 | p03475 | u092650292 | 1516678930 | Python | Python (3.4.3) | py | Runtime Error | 51 | 3544 | 590 | n = int(input())
c = []
s = []
f = []
for i in range(n-1):
a = list(map(int, input().split(" ")))
c.append(a[0])
s.append(a[1])
f.append(a[2])
def arrivetime(stnum,nowtime):
if stnum is n-1:
print(nowtime)
return nowtime
else:
if nowtime <= s[stnum]:
nowti... |
s702022182 | p03475 | u390958150 | 1516579854 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 383 | n = int(input())
t = 0
st = 0
cn = []
sn = []
fn = []
for i in range(n-1):
c,s,f = map(int,input().split())
cn.append(c)
sn.append(s)
fn.append(f)
for j in range(n-1):
for i in range(j,n-1):
st = sn[i]
if t <= sn[i]:
t = sn[i]
else:
while t <= st :
st += fn[i]
... |
s139211504 | p03475 | u323626540 | 1515199354 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 594 | n = int(input())
data = []
for i in range(n-1):
station_data = [int(x) for x in input().split()]
data.append(station_data)
time_list = []
for i in range(n-1):
total_time = data[i][1] + data[i][0]
for j in range(i+1, n-1):
if total_time <= data[j][1]:
total_time = data[j][1] + data... |
s802660917 | p03475 | u323626540 | 1515199304 | Python | Python (3.4.3) | py | Runtime Error | 91 | 3064 | 610 | n = int(input())
data = []
for i in range(n-1):
station_data = [int(x) for x in input().split()]
data.append(station_data)
time_list = []
for i in range(n-1):
total_time = data[i][1] + data[i][0]
for j in range(i+1, n-1):
if total_time <= data[j][1]:
total_time = data[j][1] + data... |
s394081264 | p03475 | u178888901 | 1515118829 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 353 | def hoge(t, i):
global data
if lists[i][1] > t:
t = lists[i][1]
C, S, F = lists[i][0], lists[i][1], lists[i][2]
return (t // F + 1) * F + C
if __name__ == '__main__':
N = int(input())
data = list()
for i in range(N - 1):
l = input().split()
list.append(l)
for i in range(N):
t = 0
for j in range(N-... |
s118007717 | p03475 | u569906225 | 1514985975 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 416 | # C - Special Trains
import math
N = int(raw_input())
C, S, F = [0]*(N-1), [0]*(N-1), [0]*(N-1)
for i in range(N-1):
C[i], S[i], F[i] = map(int, raw_input().split())
result = [0] * N
for station in range(N):
now = station
time = 0
while now != N-1:
time = S[now] + C[now] if time <= S[now] else int(math.fl... |
s350656630 | p03475 | u499259667 | 1514736735 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 433 | N = int(input())
clis = [];slis =[];flis = []
for i in range(N-1):
c,s,f = map(int,input().split())
clis.append(c);slis.append(s);flis.append(f)
for i in range(N):
count=0
for i2 in range(N-i-1):
c=clis[i+i2];s=slis[i+i2];f=flis[i+i2]
if count <= s:
count=s+c
elif (co... |
s946348190 | p03475 | u813098295 | 1514710159 | Python | Python (2.7.6) | py | Runtime Error | 12 | 2692 | 388 | import math
N = int(raw_input())
CSF = [map(float, raw_input().split()) for _ in range(N-1)]
for i in range(N-1):
ans = CSF[i][0] + CSF[i][1]
for j in range(i+1, N-1):
C, S, F = CSF[j][0], CSF[j][1], CSF[j][2]
if S < ans:
n = math.ceil((ans - S) / F)
ans = C + S + u * n... |
s459748545 | p03475 | u813098295 | 1514710082 | Python | Python (2.7.6) | py | Runtime Error | 12 | 2692 | 388 | import math
N = int(raw_input())
CSF = [map(float, raw_input().split()) for _ in range(N-1)]
for i in range(N-1):
ans = CSF[i][0] + CSF[i][1]
for j in range(i+1, N-1):
C, S, F = CSF[j][0], CSF[j][1], CSF[j][2]
if t < ans:
n = math.ceil((ans - S) / F)
ans = C + S + u * n... |
s460142680 | p03475 | u762471013 | 1514692418 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 742 | N=int(input())
C,S,F=[0]*(N-1),[0]*(N-1),[0]*(N-1)
for i in range(N-1):
C[i],S[i],F[i]=map(int,input().split())
for i in range(N-1): #一周につき一つの駅([0]..[N-2])から[N-1]までの計算
arrivalTime=S[i]+C[i]#最初発車駅の次の駅に着く時間
for j in range(i+1,N-1):
leaveTime=S[j]#現在考慮中の駅から初めて発車する時間
if arrivalTime <leaveTime:
... |
s449266226 | p03475 | u497046426 | 1514692362 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3064 | 439 | # スペース区切りの整数の入力
N = int(input())
C = []
S = []
F = []
for i in range(N-1):
c, s, f= map(int, input().split())
C.append(c)
S.append(s)
F.append(f)
for i in range(N-1):
time = 0
for j in range(i, N-1):
if time < S[j]:
time = S[j]
else:
if time % F[j] != 0:... |
s175750544 | p03475 | u286955577 | 1514689528 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3064 | 460 | N = int(input())
array = []
for i in range(N-1):
_input = str(input().replace('\r','')).split(' ')
print(_input)
array.append((int(_input[0]), int(_input[1], int(_input[2]))))
for i in range(N-1):
time = array[i][0] + array[i][1]
for j in range(i+1, N-1):
if array[j][1] > time:
time = array[j][1]
... |
s093404065 | p03475 | u286955577 | 1514689415 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 427 | N = int(input())
array = []
for i in range(N-1):
_input = str(input()).split(' ')
array.append((int(_input[0]), int(_input[1], int(_input[2]))))
for i in range(N-1):
time = array[i][0] + array[i][1]
for j in range(i+1, N-1):
if array[j][1] > time:
time = array[j][1]
elif time % array[j][2] != 0:... |
s945372935 | p03475 | u810625173 | 1514689130 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 586 | coding:utf-8
N = int(raw_input())
C = []
S = []
F = []
for i in range(N-1):
c, s, f = map(int, raw_input().split())
C.append(c)
S.append(s)
F.append(f)
res = []
T = []
for i in range(N-1):
t = 0
for j in ra... |
s186594375 | p03475 | u286955577 | 1514687940 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 293 | N = int(input())
array = []
for i in N-1:
input = input().split(' ')
array.append((input[0], input[1]))
for i in N-1:
time = array[i][0] + array[i][1]
for j in range(i+1, N-1):
if array[j][1] > time:
time = array[j][1]
time = time + array[j][0]
print(time)
print(0) |
s537389074 | p03476 | u274080981 | 1601144989 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 48664 | 967 | # dataArray :
# 2
def i_input(): return int(input())
def i_map(): return map(int, input().split())
# dataArray :
# 2 3 4
def i_list(): return list(i_map())
# dataArray :
# 2 3 4 5 6
# 1 2 3 4 5
# 2 3 4 5 6
def i_row_list(N): return [i_list() for _ in range(N)]
import numpy as np
def seachPr... |
s650043864 | p03476 | u274080981 | 1601143349 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 27680 | 1073 | # dataArray :
# 2
def i_input(): return int(input())
def i_map(): return map(int, input().split())
# dataArray :
# 2 3 4
def i_list(): return list(i_map())
# dataArray :
# 2 3 4 5 6
# 1 2 3 4 5
# 2 3 4 5 6
def i_row_list(N): return [i_list() for _ in range(N)]
def prime_factorize(n: int) -> ... |
s986980565 | p03476 | u755180064 | 1600409825 | Python | PyPy3 (7.3.0) | py | Runtime Error | 89 | 75532 | 657 |
url = "https://atcoder.jp//contests/abc134/tasks/abc134_d"
def main():
n = int(input())
a = [0]
a.extend(list(map(int, input().split())))
balls = [0]*(n+1)
b = {}
for i in range(n, 0, -1):
ball = 0
for j in range(i, n, i):
ball += balls[j]
if ball % 2 != a[i... |
s047650449 | p03476 | u366963613 | 1599964220 | Python | Python (3.8.2) | py | Runtime Error | 182 | 13712 | 1302 | # -*- coding: utf-8 -*-
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
import copy
import math
sys.setrecursionlimit(10**6)
# lis_of_lis = [[] for _ in range(N)]
def zz(): return list(map(int, sys.stdin.readline().split()))
... |
s965151685 | p03476 | u366963613 | 1599964184 | Python | PyPy3 (7.3.0) | py | Runtime Error | 169 | 80792 | 1302 | # -*- coding: utf-8 -*-
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
import copy
import math
sys.setrecursionlimit(10**6)
# lis_of_lis = [[] for _ in range(N)]
def zz(): return list(map(int, sys.stdin.readline().split()))
... |
s067216430 | p03476 | u889919275 | 1599655862 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9144 | 449 | def prime_num(n):
for i in range(2, int(n**0.5)+1):
while n % i == 0:
return False
return True
N = int(input())
for _ in range(N):
nmin, nmax = map(int, input())
if nmin < 2:
nmin = 3
ans = 0
for i in range(nmin, nmax+1, 2):
judge1 = prime_num(i)
if... |
s635442102 | p03476 | u105608888 | 1599011819 | Python | Python (3.8.2) | py | Runtime Error | 396 | 9104 | 607 | ALL = []
cnt = 0
import math
def decide_sosuu(n):
if n <= 1:
return False
else:
for i in range(2, int(math.sqrt(n)) + 1):
if n % i == 0:
return False
return True
for i in range(1,int((10**5)/2)):
if decide_sosuu(i):
if decide_sosuu((i*2)-1):
... |
s677487188 | p03476 | u105608888 | 1599011578 | Python | Python (3.8.2) | py | Runtime Error | 388 | 9076 | 549 | ALL = []
cnt = 0
import math
def decide_sosuu(n):
if n <= 1:
return False
else:
for i in range(2, int(math.sqrt(n)) + 1):
if n % i == 0:
return False
return True
for i in range(1,int((10**5)/2)):
if decide_sosuu(i):
if decide_sosuu((i*2)-1):
... |
s717419882 | p03476 | u493520238 | 1598578141 | Python | PyPy3 (7.3.0) | py | Runtime Error | 173 | 74412 | 809 | def primes(n):
is_prime = [True] * (n + 1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(n**0.5) + 1):
if not is_prime[i]:
continue
for j in range(i * 2, n + 1, i):
is_prime[j] = False
return [i for i in range(n + 1) if is_prime[i]]
sums = [0,... |
s992402323 | p03476 | u262481526 | 1598555576 | Python | Python (3.8.2) | py | Runtime Error | 30 | 12552 | 586 | def eratosthenes(n):
prime_list = []
num_list=[i for i in range(2, n+1)]
limit = math.sqrt(n)
while True:
if limit <= num_list[0]:
return prime_list + num_list
prime_list.append(num_list[0])
num_list = [e for e in num_list if e % num_list[0] != 0]
Q = int(inp... |
s368850149 | p03476 | u262481526 | 1598555469 | Python | Python (3.8.2) | py | Runtime Error | 23 | 9076 | 596 | import math
def eratosthenes(n):
prime_list = []
num_list=[i for i in range(2, n+1)]
limit = math.sqrt(n)
while True:
if limit <= num_list[0]:
return prime_list + num_list
prime_list.append(num_list[0])
num_list = [e for e in num_list if e % num_list[0] != 0]
... |
s287563002 | p03476 | u731362892 | 1598373618 | Python | PyPy3 (7.3.0) | py | Runtime Error | 106 | 74740 | 531 | import numpy
x=int(input())
n=10**5
import math
def eratosthenes(n):
prime = []
limit = math.sqrt(n)
data = [i + 1 for i in range(1, n)]
while True:
p = data[0]
if limit <= p:
return prime + data
prime.append(p)
data = [e for e in data if e % p != 0]
q=eratost... |
s136409577 | p03476 | u602677143 | 1597889424 | Python | Python (3.8.2) | py | Runtime Error | 1343 | 13564 | 749 | import math
from itertools import accumulate
def eratosthenes(n):
prime_list = []
num_list=[i for i in range(2, n+1)]
limit = math.sqrt(n)
while True:
if limit <= num_list[0]:
return prime_list + num_list
prime_list.append(num_list[0])
num_list = [e for e in num_list... |
s426649534 | p03476 | u602677143 | 1597889276 | Python | Python (3.8.2) | py | Runtime Error | 1355 | 13308 | 728 | import math
from itertools import accumulate
def eratosthenes(n):
prime_list = []
num_list=[i for i in range(2, n+1)]
limit = math.sqrt(n)
while True:
if limit <= num_list[0]:
return prime_list + num_list
prime_list.append(num_list[0])
num_list = [e for e in num_list... |
s568201656 | p03476 | u602677143 | 1597806233 | Python | Python (3.8.2) | py | Runtime Error | 1293 | 13196 | 536 | import math
def eratosthenes(n):
prime_list = []
num_list=[i for i in range(2, n+1)]
limit = math.sqrt(n)
while True:
if limit <= num_list[0]:
return prime_list + num_list
prime_list.append(num_list[0])
num_list = [e for e in num_list if e % num_list[0] != 0]
ls = er... |
s758024738 | p03476 | u602677143 | 1597806024 | Python | PyPy3 (7.3.0) | py | Runtime Error | 230 | 85016 | 533 | import math
def eratosthenes(n):
prime_list = []
num_list=[i for i in range(2, n+1)]
limit = math.sqrt(n)
while True:
if limit <= num_list[0]:
return prime_list + num_list
prime_list.append(num_list[0])
num_list = [e for e in num_list if e % num_list[0] != 0]
ls = er... |
s270319655 | p03476 | u602677143 | 1597805997 | Python | PyPy3 (7.3.0) | py | Runtime Error | 91 | 73572 | 521 | def eratosthenes(n):
prime_list = []
num_list=[i for i in range(2, n+1)]
limit = math.sqrt(n)
while True:
if limit <= num_list[0]:
return prime_list + num_list
prime_list.append(num_list[0])
num_list = [e for e in num_list if e % num_list[0] != 0]
ls = eratosthenes(1... |
s826498851 | p03476 | u602677143 | 1597454927 | Python | Python (3.8.2) | py | Runtime Error | 869 | 9448 | 517 | def prime_eratosthenes(n):
prime_list = []
num_list=[]
for i in range(2, n+1):
if i not in num_list:
prime_list.append(i)
for j in range(i*i, n+1, i):
num_list.append(j)
return prime_list
ls = prime_eratosthenes(10000)
ls2 = [i+1 for i in range(10000)]
Q ... |
s481238591 | p03476 | u602677143 | 1597454720 | Python | Python (3.8.2) | py | Runtime Error | 867 | 9520 | 517 | def prime_eratosthenes(n):
prime_list = []
num_list=[]
for i in range(2, n+1):
if i not in num_list:
prime_list.append(i)
for j in range(i*i, n+1, i):
num_list.append(j)
return prime_list
ls = prime_eratosthenes(10000)
ls2 = [i+1 for i in range(10000)]
Q ... |
s282999320 | p03476 | u133864042 | 1597348003 | Python | PyPy3 (7.3.0) | py | Runtime Error | 85 | 74812 | 216 | import math
def is_prime(x):
if x == 1:
return False
elif x == 2:
return True
else:
for i in range(3, math.sqrt(x)//1+1):
if x%i == 0:
return False
return True
print(is_prime(3)) |
s500811080 | p03476 | u232873434 | 1596944404 | Python | PyPy3 (7.3.0) | py | Runtime Error | 884 | 102636 | 585 | Q = int(input())
ls = [list(map(int,input().split())) for i in range(Q)]
n_max = max(ls)[1]
prime = []
data = [i for i in range(2,n_max+1)]
limit = n_max**(1/2)
while True:
p = data[0]
if limit<=p:
break
prime.append(p)
data = [i for i in data if i%p!=0]
prime = prime +data
ans_ls = [0]*(1+n_... |
s153783855 | p03476 | u572193732 | 1596022229 | Python | Python (3.8.2) | py | Runtime Error | 338 | 10772 | 683 | def eratosthenes(n):
is_prime = [True for i in range(n+1)]
is_prime[0], is_prime[1] = False, False
prime = []
for i in range(2, n+1):
if is_prime[i]:
prime.append(i)
for j in range(2*i, n+1, i):
is_prime[j] = False
return prime
Q = int(input())
N... |
s116907516 | p03476 | u395816772 | 1595461021 | Python | Python (3.8.2) | py | Runtime Error | 192 | 30372 | 800 | import math
import numpy as np
def get_prime(n):
if n<= 1:
return[]
prime = [2]
limit = int(math.sqrt(n))
data = [i + 1 for i in range(2,n,2)]
while limit > data[0]:
prime.append(data[0])
data = [j for j in data if j % data[0] != 0]
return prime + data
def is_prime(n... |
s317228050 | p03476 | u502731482 | 1595125842 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9096 | 611 | q = int(input())
l, r = [0] * q, [0] * q
for i in range(q):
l[i], r[i] = map(int, input().split())
mini = min(min(l), min(r))
maxi = max(max(l), max(r))
ans = [0] * (maxi + 1)
prime = [0] * (maxi + 1)
def judge_prime(n):
for i in range(2, int(n ** 0.5) + 1):
if n % i == 0:
return False
... |
s463432862 | p03476 | u760771686 | 1594996979 | Python | Python (3.8.2) | py | Runtime Error | 32 | 9268 | 355 | B = [False]*10005
C = [0]*10005
for i in range(2,10001):
if not B[i]:
for j in range(i+i,10001,i):
B[j]=True
for i in range(3,10001,2):
if not B[i] and not B[(i+1)//2]:
C[i]+=1
for i in range(3,10001):
C[i]=C[i]+C[i-1]
N = int(input())
for _ in range(N):
a, b = map(int,inp... |
s769654938 | p03476 | u760771686 | 1594996786 | Python | Python (3.8.2) | py | Runtime Error | 30 | 9256 | 356 | B = [False]*10005
C = [0]*10005
for i in range(2,10001):
if not B[i]:
for j in range(i+i,10001,i):
B[j]=True
for i in range(3,10001,2):
if not B[i] and not B[(i+1)//2]:
C[i]+=1
for i in range(3,10001):
C[i]=C[i]+C[i-1]
N = int(input())
for _ in range(N):
a, b = map(int,inp... |
s967485097 | p03476 | u760771686 | 1594996325 | Python | Python (3.8.2) | py | Runtime Error | 35 | 9184 | 380 | B = [False]*10010
C = [0]*10010
for i in range(2,10005):
if not B[i]:
j = i+i
while j < 10005:
B[j]= True
j+=i
for i in range(3,10005,2):
if not B[i] and not B[(i+1)//2]:
C[i]+=1
for i in range(3,10005):
C[i]=C[i]+C[i-1]
N = int(input())
for _ in range(N)... |
s369913749 | p03476 | u760771686 | 1594996187 | Python | Python (3.8.2) | py | Runtime Error | 29 | 9176 | 384 | B = [False]*10010
C = [0]*10010
for i in range(2,10005):
if not B[i]:
j = i+i
while j < 10005:
B[j]= True
j+=i
for i in range(3,10005,2):
if not B[i] and not int(B[(i+1)/2]):
C[i]+=1
for i in range(3,10005):
C[i]=C[i]+C[i-1]
N = int(input())
for _ in rang... |
s729271630 | p03476 | u760771686 | 1594996016 | Python | Python (3.8.2) | py | Runtime Error | 30 | 9144 | 380 | B = [False]*10010
C = [0]*10010
for i in range(2,10005):
if not B[i]:
j = i+i
while j < 10005:
B[j]= True
j+=i
for i in range(3,10005,2):
if not B[i] and not B[(i+1)//2]:
C[i]+=1
for i in range(3,10005):
C[i]=C[i]+C[i-1]
N = int(input())
for _ in range(N)... |
s670262850 | p03476 | u760771686 | 1594995904 | Python | Python (3.8.2) | py | Runtime Error | 21 | 8768 | 371 | B = [False]*10010
C = [0]*10010
for i in range(2,10005):
if !B[i]:
j = i+i
while j < 10005:
B[j]= True
j+=i
for i in range(3,10005,2):
if !B[i] and !B[(i+1)//2]:
C[i]+=1
for i in range(3,10005):
C[i]=C[i]+C[i-1]
N = int(input())
for _ in range(N):
a, ... |
s108301233 | p03476 | u626881915 | 1593397589 | Python | PyPy3 (7.3.0) | py | Runtime Error | 100 | 70416 | 497 | data = sorted(list(range(10**5+1)))
prime_bool = [True]*(10**5+1)
prime_bool[0] = False
for i in range(len(data)):
p = data[i]
if prime_bool[p]:
k = 2
while k*p <= max(a):
prime_bool[k*p] = False
k += 1
count_list = [0]*(10**5+1)
for i in range(1, 10**5+1):
count_list[i] = count_list[i-1]
... |
s994082240 | p03476 | u841531687 | 1593317753 | Python | PyPy3 (7.3.0) | py | Runtime Error | 282 | 88920 | 825 | #ABC 084 D - 2017 Like Number
from itertools import accumulate
def isPrime(x):
if x == 2: flag = True
else:
flag = True
if x % 2 == 0:
flag = False
i = 3
while i**2 <= x and flag == True:
if x % i == 0:
flag = False
el... |
s809718260 | p03476 | u373047809 | 1592770335 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9060 | 424 | def era(M):
p = [1] * M
p[0] = p[1] = 0
for x in range(2, int(~-M**.5) + 1):
if p[x]:
for y in range(x*x, M, x):
p[y] = 0
return p
INF = 10**5 + 1
E = erat(INF)
Q = [0] * INF
from itertools import*
for i in range(INF):
q[i] = i%2 * p[i] * p[-~i//2]
*a, = accumulat... |
s510415043 | p03476 | u502126017 | 1592512871 | Python | Python (3.4.3) | py | Runtime Error | 296 | 11004 | 372 | q=int(input())
l=[]
r=[]
for i in range(q):
ll,rr=map(int,input().split())
l.append(ll)
r.append(rr)
similar=[]
cnt=0
for i in range(10**5+2):
if i<=2:
similar.append(0)
else:
if is_prime(i)==True and (is_prime((i+1)/2))==True:
cnt+=1
similar.append(cnt)
for i i... |
s907683080 | p03476 | u035453792 | 1592509849 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 409 | a=[3, 5, 13, 37, 61, 73, 157, 193, 277, 313, 397, 421, 457, 541, 613, 661, 673, 733, 757, 877, 997, 1093, 1153, 1201, 1213, 1237, 1321, 1381, 1453, 1621, 1657, 1753, 1873, 1933, 1993, 2017]
A=[]
B=[]
c=0
ans=0
for i in range(2017):
if i in a:
c+=1
B.append(c)
q=int(input())
for i in range(q):
l... |
s745520702 | p03476 | u035453792 | 1592509718 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 407 | a=[3, 5, 13, 37, 61, 73, 157, 193, 277, 313, 397, 421, 457, 541, 613, 661, 673, 733, 757, 877, 997, 1093, 1153, 1201, 1213, 1237, 1321, 1381, 1453, 1621, 1657, 1753, 1873, 1933, 1993, 2017]
A=[]
B=[]
c=0
ans=0
for i in range(2017):
if i in a:
c+=1
B.append(c)
q=int(input())
for i in range(q):
l... |
s343434857 | p03476 | u035453792 | 1592506766 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 411 | a=[3, 5, 13, 37, 61, 73, 157, 193, 277, 313, 397, 421, 457, 541, 613, 661, 673, 733, 757, 877, 997, 1093, 1153, 1201, 1213, 1237, 1321, 1381, 1453, 1621, 1657, 1753, 1873, 1933, 1993, 2017]
for i in (sosuu):
if (i+1)/2 in sosuu:
a.append(i)
q=int(input())
for i in range(q):
l,r=map(int,input().split())
... |
s683508862 | p03476 | u024340351 | 1592485045 | Python | Python (3.4.3) | py | Runtime Error | 585 | 3316 | 484 | import math
Q = int(input())
def prime(n):
if n > 1:
for i in range(2,math.floor(math.sqrt(n))+1):
if (n % i) == 0:
return(False)
break
else:
return(True)
else:
return(False)
Numero = [0]*10001
for i in range (0, 10001):
if prime(i) == 1 and prime(int((i+1)/2)) == 1:
Numero[i]+=1
else:
co... |
s271650492 | p03476 | u401452016 | 1592439103 | Python | PyPy3 (2.4.0) | py | Runtime Error | 310 | 60380 | 836 | #ABC084D
def main():
import sys
Q = int(sys.stdin.readline())
LR = [tuple(map(int, sys.stdin.readline().split())) for _ in range(Q)]
#print(LR)
check = [1 for _ in range(10**5+1)]
check[0], check[1] = 0, 0
for i in range(2, 10**5+1):
if check[i] ==0:
continue
... |
s680454938 | p03476 | u176582473 | 1591974400 | Python | Python (3.4.3) | py | Runtime Error | 634 | 7652 | 965 | def calc_prime(n):
primes = set(list(range(3, n, 2)))
primes.add(2)
for a in range(3, n, 2):
for i in range(a, n):
x = a * i
if x >= n:
break
if x in primes:
primes.remove(x)
return primes
def collect_likes(ps):
likes = s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.