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
s619098001
p03909
u205561862
1536802761
Python
Python (3.4.3)
py
Runtime Error
17
2940
458
#include <bits/stdc++.h> #define FOR(I,X,Y) for(int (I)=(X);(I)<(Y);(I)++) #define REP(I,X,Y) for(int (I)=(Y)-1;(I)>=(X);(I)--) #define ALL(X) (X).begin(),(X).end() #define INF 1000000007 #define LINF 1000000000000000007 typedef long long ll; using namespace std; int main(){ int H,W; string S; cin >> H >> W; F...
s912349729
p03909
u749173850
1481688454
Python
Python (3.4.3)
py
Runtime Error
22
3064
323
# -*- coding: utf-8 -*- def findSnuke(H, W): for i in range(H): row = input().split() for j in range(W): if row[j] == "snuke": return [i, j] H, W = map(int, input().split()) alphabet = "ABCDEFGHIJKLMNOPQRSTU" col, row = findSnuke(H, W) print(alphabet[row] + str(col+1...
s135482349
p03909
u749173850
1481688064
Python
Python (3.4.3)
py
Runtime Error
23
3064
253
# -*- coding: utf-8 -*- H, W = map(int, input().split()) alphabet = "ABCDEFGHIJKLMNOPQRSTU" for i in range(H): row = input().split() for j in range(W): if row[j] == "snuke": print(alphabet[j] + str(i+1)) break
s562687279
p03909
u506127000
1480187571
Python
PyPy3 (2.4.0)
py
Runtime Error
198
39408
488
N, M = [int(i) for i in input().split()] X = [0] * (10 ** 5) # X = [0] * (10) for i in map(int, input().split()): X[i] += 1 Y = [sum(X[i::M]) for i in range(M)] ans = Y[0] // 2 Y[0] = 0 for i in range(1, M//2+M%2): j = M - i tmp = min(Y[i], Y[j]) ans += tmp Y[i] -= tmp Y[j] -= tmp for i, n in en...
s430909863
p03909
u506127000
1480184481
Python
PyPy3 (2.4.0)
py
Runtime Error
204
38640
172
import bisect N = int(input()) S = tuple(map(lambda x: (x**2+x)//2, range(5000))) while N > 0: i = bisect.bisect_left(S, N) N -= i #print(i, N, S) print(i)
s922120087
p03909
u296290704
1480181560
Python
Python (2.7.6)
py
Runtime Error
16
2568
207
h, w = map(int, raw_input().split()) S = [raw_input().split() for i in xrange(h)] for i in xrange(h): for j in xrange(w): if S[i][j] == "snuke": print "%s%d" % ("ABCDEFGHIJ"[j], i+1)
s577221241
p03910
u348293370
1600826343
Python
Python (3.8.2)
py
Runtime Error
30
9268
196
n = int(input()) score = 0 i = 0 ans_list = [] while score < n: i += 1 score += i ans_list.append(i) ans_list.remove(score - n) for k in range(len(ans_list)): print(ans_list[k])
s129437056
p03910
u341267151
1599877801
Python
Python (3.8.2)
py
Runtime Error
23
9288
1358
n = int(input()) def ts(x): return x * (x + 1) m = n for i in range(math.ceil(math.sqrt(2 * n) - 2), math.floor(math.sqrt(2 * n)) + 1, 1): if ts(i) < 2 * n <= ts(i + 1): m = i + 1 break a = n % (m + 1) b = n // (m + 1) if m % 2 == 0: if a != 0: print(a) i = 1 c = 0 ...
s153781956
p03910
u341267151
1599877145
Python
Python (3.8.2)
py
Runtime Error
29
8980
1367
import math n=int(input()) def ts(x): return x*(x+1) m=n for i in range(math.ceil(math.sqrt(2*n)-2),math.floor(math.sqrt(2*n))+1,1): if ts(i)<=2*n<=ts(i+1): m=i+1 break a=n%(m+1) b=n//(m+1) if m%2==0: if a!=0: print(a) i=1 c=0 while c!=b: if i!=a and m+1-i!=a: ...
s977467334
p03910
u341267151
1599876370
Python
Python (3.8.2)
py
Runtime Error
22
9136
2010
import math n=int(input()) def ts(x): return x*(x+1) m=n for i in range(math.ceil(math.sqrt(2*n)-2),math.floor(math.sqrt(2*n))+1,1): if ts(i)<=2*n<=ts(i+1): m=i+1 break a=n%(m+1) b=n//(m+1) if m%2==0: if a!=0: print(a) i=1 c=0 while c!=b: if i!=a and m+1-i!=a: ...
s044773026
p03910
u349449706
1599030476
Python
PyPy3 (7.3.0)
py
Runtime Error
129
77840
341
def is_ok(m, n): return m*(m+1)//2>=n def meguru_bisect(ng, ok, n): while (abs(ok - ng) > 1): mid = (ok + ng) // 2 if is_ok(mid, n): ok = mid else: ng = mid return ok def f(n): if n>0: m = meguru_bisect(0,10**7, n) print(m) f(n-m) N...
s048345771
p03910
u349449706
1599029441
Python
PyPy3 (7.3.0)
py
Runtime Error
94
75016
375
def is_ok(n): global N return n*(n+1)//2>=N def meguru_bisect(ng, ok): while (abs(ok - ng) > 1): mid = (ok + ng) // 2 if is_ok(mid): ok = mid else: ng = mid return ok N = int(input()) n = meguru_bisect(0,10**7) s = list(range(1, n+1)) d = n-2 while sum(s) ...
s828882065
p03910
u603958124
1596341951
Python
Python (3.8.2)
py
Runtime Error
666
602704
1165
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement from collections import deque,defaultdict,Counter from bisect import bisect_left,bisect_right from operator ...
s068402750
p03910
u054514819
1595899430
Python
PyPy3 (7.3.0)
py
Runtime Error
90
74664
305
import sys def input(): return sys.stdin.readline().strip() def mapint(): return map(int, input().split()) sys.setrecursionlimit(10**9) N = int(input()) cnt = 0 s = set() for i in range(1, N): cnt += i s.add(i) if cnt>=N: break if N!=cnt: s.remove(cnt-N) for i in s: print(i)
s193453822
p03910
u591503175
1595793393
Python
Python (3.8.2)
py
Runtime Error
2219
404728
694
def resolve(): ''' code here ''' N = int(input()) ans_list = [i*(i+1)//2 for i in range(1, N+1)] delta = 0 if N > 1: for i in range(1, N+1): if ans_list[i-1] < N < ans_list[i]: delta = ans_list[i] - N res_list = list(range(1, i+2)) ...
s145454839
p03910
u591503175
1595792798
Python
Python (3.8.2)
py
Runtime Error
2220
404792
536
def resolve(): ''' code here ''' N = int(input()) ans_list = [i*(i+1)//2 for i in range(1, N+1)] if N > 1: for i in range(1, N+1): if ans_list[i-1] < N < ans_list[i]: delta = ans_list[i] - N res = list(range(1, i+2)) res.remov...
s689448469
p03910
u370721525
1595246551
Python
Python (3.8.2)
py
Runtime Error
448
9616
256
N = int(input()) l = [] def main(n): global l i = 1 while True: tmp = i*(i+1)//2 if tmp >= n: l.append(i) if n-i == 0: return l else: return main(n-i) i += 1 li = main(N) for n in li: print(n)
s172615201
p03910
u370721525
1595246269
Python
Python (3.8.2)
py
Runtime Error
445
9584
334
N = int(input()) l = [] def main(n): global l i = 1 if n == 1: l.append(1) return l else: while True: tmp = i*(i+1)//2 if tmp >= n: l.append(i) if n-i == 0: return l else: return main(n-i) i += 1 li = main(N) li.sort() for n in ...
s932581777
p03910
u498487134
1595129221
Python
PyPy3 (7.3.0)
py
Runtime Error
84
74864
467
import sys input = sys.stdin.readline def I(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(map(int, input().split())) def main(): mod=10**9+7 N=I() if N==1: print(1) exit() temp=0 ans=[] for i in range(1,N): temp+=i ans.a...
s611607693
p03910
u781262926
1594883680
Python
Python (3.8.2)
py
Runtime Error
29
9320
620
class BisectSearch: def __init__(self, f, l=0, r=10**9): self.f = f self.l = l self.r = r def __call__(self, dist): f = self.f l = self.l r = self.r if dist <= f(l): return l if f(r) <= dist: return r while r-l > 1: ...
s788715962
p03910
u662860343
1593638631
Python
PyPy3 (7.3.0)
py
Runtime Error
1120
660440
263
def f(x): return x * (x + 1) // 2 if __name__ == "__main__": N = int(input()) sum_ = [(i, f(i)) for i in range(0, N + 1) if f(i) >= N] l = list(range(1, sum_[0][0] + 1)) remove = sum_[0][1] - N l.remove(remove) print(*l, sep="\n")
s357583196
p03910
u453642820
1593002232
Python
Python (3.8.2)
py
Runtime Error
33
9408
413
N=int(input()) ans=0 A=[] for i in range(1,N+1): if ans+i==N: A.append(i) break if N-(ans+i)>=i+1: A.append(i) ans+=i else: del A[-1] ans-=i-1 if (N-ans)%2==0: A.append((N-ans)//2-1) A.append((N-ans)//2+1) else: ...
s049573429
p03910
u485319545
1592439164
Python
Python (3.4.3)
py
Runtime Error
22
3572
279
n=int(input()) ans=[1] i=1 s=1 while True: if s>=n: break i+=1 s+=i ans.append(i) dif = s-n if dif==0: for i in range(len(ans)): print(ans[i]) exit(0) for i in range(len(ans)): if a[i]==dif: continue print(ans[i])
s331741052
p03910
u616252029
1591740573
Python
Python (3.4.3)
py
Runtime Error
17
2940
126
n=int(input()) s=0 l=[] for i in range(1,n+1): s+=i l.append(i) if s>=n: for j in l: if j!=s-n: print(j) break
s544652272
p03910
u489124637
1591159520
Python
Python (3.4.3)
py
Runtime Error
318
201368
662
#import itertools #import bisect import math N = int(input()) L = [i for i in range((N+1)//2+1)] num = math.ceil(pow(2*(N-1),0.5)) for i in range(num,len(L)): if N == i*(i+1)//2: index = i Max = i*(i+1)//2 break elif N < i*(i+1)//2: index = i Max = i*(i+1)//2 ...
s105641096
p03910
u272525952
1591081703
Python
Python (3.4.3)
py
Runtime Error
17
3064
191
n=int(input()) i=1 num=0 suml=[0] while num<=10**2: num+=i suml.append(num) i+=1 j=1 while n>suml[j]: j+=1 k=suml[j]-n for ii in range(1,j+1): if ii!=k: print(ii)
s522320818
p03910
u801049006
1590877316
Python
Python (3.4.3)
py
Runtime Error
19
3444
171
n = int(input()) s = 0 i = 0 while s < n: s += i i += 1 if i == 1: print(1) exit() ans = list(range(1,i)) ans.remove(s-n) print('\n'.join(map(str,ans)))
s952557602
p03910
u276204978
1589855317
Python
Python (3.4.3)
py
Runtime Error
18
3060
261
def solve(): N = int(input()) score = 0 for i in range(1, n+1): score += i if score >= n: break x = score - n res = list(range(1, x)) + list(range(x+1, i+1)) return '\n'.join(map(str, res)) print(solve())
s016531867
p03910
u028973125
1589675014
Python
PyPy3 (2.4.0)
py
Runtime Error
204
42352
344
import sys N = int(sys.stdin.readline().strip()) i = 1 for i in range(1, N): sum_i = i * (i + 1) // 2 if N <= sum_i: break max_i = i sum_i = i * (i + 1) // 2 res = sum_i - N # print("sum", sum_i) # print("res", res) # print(i) ans = set([i for i in range(1, max_i+1)]) if res: ans.remove(res) fo...
s167810350
p03910
u183840468
1589543723
Python
Python (3.4.3)
py
Runtime Error
22
3316
305
n = int(input()) if n == 1: print(1) else: m = n //2 for i in range(1,m+1): if i * (i + 1) <= 2 *n < (i+1)*(i+2): right = i + 1 break diff = right * (right+1) //2 - n for i in range(1,right+1): if i != diff: print(i)
s764370070
p03910
u103902792
1588367238
Python
Python (3.4.3)
py
Runtime Error
18
3064
229
n = int(input()) r = 10**7+1 l = 1 def f(n): return n**2+n while r-l>1: if f((l+r)//2)>n: r = (l+r)//2 else: l = (l+r)//2 l = l+1 rm = (l+1)*l//2-n ans = list(range(1, l+1)) ans.remove(rm) for a in ans: print(a)
s276091644
p03910
u253681061
1588128526
Python
Python (3.4.3)
py
Runtime Error
22
3316
238
n = int(input()) if n == 1: print(1) else: for x in range(1,n): tmp = (1+x)*x//2 if tmp >= n: l = x break d = tmp - n for x in range(1,l+1): if x != d: print(x)
s102339571
p03910
u457898721
1587819657
Python
Python (3.4.3)
py
Runtime Error
18
3064
298
import math N = int(input()) n = round((N//2) ** 0.5) a,b = n+2, n+3 if a*(a+1)//2 > abs(a*(a+1)//2 - N): number = abs(a*(a+1)//2 - N) n = a elif b*(b+1)//2 >= abs(b*(b+1)//2 - N): number = abs(b*(b+1)//2 - N) n = b for i in range(1, n+1): if i == number: continue print(i)
s762661477
p03910
u457898721
1587819609
Python
Python (3.4.3)
py
Runtime Error
18
3064
297
import math N = int(input()) n = round((N//2) ** 0.5) a,b = n+2, n+3 if a*(a+1)//2 > abs(a*(a+1)//2 - N): number = abs(a*(a+1)//2 - N) n = a elif b*(b+1)//2 > abs(b*(b+1)//2 - N): number = abs(b*(b+1)//2 - N) n = b for i in range(1, n+1): if i == number: continue print(i)
s689317760
p03910
u896741788
1586208677
Python
Python (3.4.3)
py
Runtime Error
19
3188
191
from math import sqrt n=int(input()) d=min(-(-int(sqrt(8*n+1))//2),n) l=list(range(1,d+1)) remain=(d*(d+1))//2-n while remain<=l[-1]: remain-=l[-1] l.pop() print(set(l)-set([remain]))
s248576678
p03910
u430247423
1586205431
Python
Python (3.4.3)
py
Runtime Error
21
3316
311
# CODE FESTIVAL 2016 Final # B - Exactly N points # https://atcoder.jp/contests/cf16-final/tasks/codefestival_2016_final_b N = int(input()) for i in range(1, N): if i*(i+1)//2 >= N: k = i break S = k*(k+1)//2 sub = S-N for i in range(1, k+1): if i == sub: continue print(i)
s847036894
p03910
u397384480
1583873737
Python
PyPy3 (2.4.0)
py
Runtime Error
252
44144
426
N = int(input()) def su(n): s = 0 for i in range(1,n+1): s += i return s if N == 1: print(1) else: for i in range(N): if su(i) >= N: M = i break print(M) now = N-M for i in range(1,M): if now - (M-i) >=(M-i): now -= M-i ...
s867093984
p03910
u871352270
1583872422
Python
Python (3.4.3)
py
Runtime Error
22
3572
353
N = int(input()) if N == 1 or N == 2: print(N) else: for i in range(N): if i*(i+1)//2 > N: num = i-1 break ans = [] for i in range(num): ans.append(i+1) if num*(num+1)//2 != N: cnt = N-num*(num+1)//2 ans.pop(num-cnt) ans.append(num+1) ...
s275123743
p03910
u871352270
1583872290
Python
Python (3.4.3)
py
Runtime Error
22
3572
358
N = int(input()) if N == 1 or N == 2: print(N) else: for i in range(N): if i*(i+1)//2 > N: num = i-1 break ans = [] for i in range(num): ans.append(i+1) if num*(num+1)//2 != N: cnt = N-num*(num+1)//2 ans.remove(num+1-cnt) ans.append(num...
s426554400
p03910
u861141787
1581858962
Python
Python (3.4.3)
py
Runtime Error
21
3572
164
n = int(input()) a = [] m = 0 for i in range(1, n): if m >= n: break a.append(i) m += i if m == n: print(*a) else: a.remove(m-n) print(*a)
s160172426
p03910
u861141787
1581858685
Python
Python (3.4.3)
py
Runtime Error
20
3572
162
n = int(input()) a = [] m = 0 for i in range(1, n): if m >= n: break a.append(i) m += i if m == n: print(*a) else: a.pop(m-n) print(*a)
s104265287
p03910
u861141787
1581857336
Python
Python (3.4.3)
py
Runtime Error
2104
3064
448
n = int(input()) if n == 1 or n == 2: print(n) else: a = [] m = 0 for i in range(1, n): if m > n: break a.append(i) m += i b = [] for i in range(len(a) ** 2): g = [] for j in range(len(a)): if ((i >> j) & 1): g.append(a[j]) ...
s306811515
p03910
u580697892
1581293995
Python
Python (3.4.3)
py
Runtime Error
21
3408
244
# coding: utf-8 N = int(input()) if N == 1: print(1) exit() ans = 0 for i in range(1, N+1): if ans < N: ans += i else: end = i break res = ans - N for i in range(1, end): if i != res: print(i)
s961144959
p03910
u358254559
1580679209
Python
Python (3.4.3)
py
Runtime Error
34
3700
190
n = int(input()) import math def getk(n): return int((1+math.sqrt(8*n-7))/2) while(True): k = getk(n) print(k,end="") print(" ",end="") if k ==1: break n-=k
s466867023
p03910
u572142121
1579625807
Python
Python (3.4.3)
py
Runtime Error
22
3316
83
N=int(input()) a=1 while N-a>=a: print(a) b=N-a N-=a a+=1 print(b)
s083784762
p03910
u089142196
1578010747
Python
Python (3.4.3)
py
Runtime Error
21
3408
153
N=int(input()) for i in range(1,N): if i*(i+1)//2 >= N: k=i break c = int(k*(k+1)//2 - N) for j in range(1,k+1): if j!=c: print(j)
s177095247
p03910
u089142196
1578010706
Python
Python (3.4.3)
py
Runtime Error
18
2940
153
N=int(input()) for i in range(1,N): if i*(i+1)//2 >= N: i=k break c = int(k*(k+1)//2 - N) for j in range(1,k+1): if j!=c: print(j)
s868660114
p03910
u089142196
1578010583
Python
Python (3.4.3)
py
Runtime Error
21
3408
145
N=int(input()) for i in range(1,N): if i*(i+1)//2 >= N: break c = int(i*(i+1)//2 - N) for j in range(1,i+1): if j!=c: print(j)
s154696003
p03910
u089142196
1577988125
Python
Python (3.4.3)
py
Runtime Error
21
3316
140
N=int(input()) for i in range(1,N): if i*(i+1)//2 >= N: break c = i*(i+1)//2 - N for j in range(1,i+1): if j!=c: print(j)
s761486577
p03910
u089142196
1577988009
Python
Python (3.4.3)
py
Runtime Error
21
3316
144
N=int(input()) a=0 for i in range(1,N): if i*(i+1)//2 >= N: break c = i*(i+1)//2 - N for j in range(1,i+1): if j!=c: print(j)
s518468914
p03910
u878326845
1577755728
Python
Python (3.4.3)
py
Runtime Error
22
3316
150
n = int(input()) for i in range(1,n): if i*(i+1)//2 > n: x = i y = i*(i+1)//2 - n break for i in range(1,x+1): if i != y: print(i)
s649633357
p03910
u707444776
1575782852
Python
Python (3.4.3)
py
Runtime Error
21
3572
287
N = int(input()) ans = 0 for i in range(1, N + 1): tmp = (i * (i - 1)) // 2 if tmp >= N: ans = i - 1 break anslst = [i for i in range(ans, 0, -1)] tmp = N - anslst[0] print(anslst[0]) for i in anslst[1:]: if tmp == 0: break tmp -= i print(i)
s404276034
p03910
u945181840
1575686957
Python
Python (3.4.3)
py
Runtime Error
21
3620
331
from itertools import accumulate from math import sqrt, floor from bisect import bisect_left N = int(input()) n = list(accumulate(range(floor(sqrt(2 * N)) + 1))) r = bisect_left(n, N) if n[r] == N: print('\n'.join(map(str, range(1, r + 1)))) exit() d = n[r] - N for i in range(1, r + 1): if i != d: ...
s631011052
p03910
u945181840
1575686650
Python
Python (3.4.3)
py
Runtime Error
18
3188
318
from itertools import accumulate from math import sqrt from bisect import bisect_left N = int(input()) n = list(accumulate(range(int(sqrt(N)) + 5))) r = bisect_left(n, N) if n[r] == N: print('\n'.join(map(str, range(1, r + 1)))) exit() d = n[r] - N for i in range(1, r + 1): if i != d: print(i)
s432003125
p03910
u945181840
1575686602
Python
Python (3.4.3)
py
Runtime Error
18
3188
318
from itertools import accumulate from math import sqrt from bisect import bisect_left N = int(input()) n = list(accumulate(range(int(sqrt(N)) + 3))) r = bisect_left(n, N) if n[r] == N: print('\n'.join(map(str, range(1, r + 1)))) exit() d = n[r] - N for i in range(1, r + 1): if i != d: print(i)
s999654981
p03910
u141574039
1575390694
Python
PyPy3 (2.4.0)
py
Runtime Error
587
191540
152
N=int(input()) S=[1] for i in range(1,N): S.append(S[i-1]+i+1) p=0 j=0 while N>=S[j]: j += 1 p=S[j]-N for i in range(1,j+2): if i!=p: print(i)
s927884718
p03910
u296150111
1573001132
Python
Python (3.4.3)
py
Runtime Error
23
3316
133
n=int(input()) for i in range(n): if i**2+i>=2*n: p=i break total=(p*(p+1))//2 for i in range(1,p+1): if total-n!=i: print(i)
s383019124
p03910
u296150111
1573001037
Python
Python (3.4.3)
py
Runtime Error
22
2940
145
n=int(input()) for i in range(int(n**0.5)+3): if i**2+i>=2*n: p=i break total=(p*(p+1))//2 for i in range(1,p+1): if total-n!=i: print(i)
s742802108
p03910
u905203728
1572121354
Python
Python (3.4.3)
py
Runtime Error
25
3956
274
n=int(input()) A=[] cnt=0 add=0 for i in range(4471): cnt +=i+1 A.append((cnt,i+1)) for i in range(len(A)-1): if A[i][0]<=n<=A[i+1][0]: add=(A[i+1][1],A[i+1][0]-n) break for i in range(add[0]): if i+1==add[1]: continue print(i+1)
s331882347
p03910
u598229387
1571848193
Python
Python (3.4.3)
py
Runtime Error
23
3316
183
n=int(input()) for i in range(n): if i+i**2>=2*n: check=i break total=(1+check)*check//2 out=total-n for i in range(1,check+1): if i!=out: print(i)
s935495817
p03910
u703890795
1568430051
Python
Python (3.4.3)
py
Runtime Error
17
2940
64
import math print(math.floor((math.sqrt(i+8*int(input()))-1)/2))
s246139153
p03910
u438160204
1560194784
Python
Python (3.4.3)
py
Runtime Error
20
3408
218
import math N=int(input()) for i in range(int(math.sqrt(N)) , int(math.sqrt(2*N))+1): if (i*(i+1))//2 >= N: ansmax=i dif=(i*(i+1))//2 - N for j in range(1,ansmax+1): if j!=dif: print(j)
s790462030
p03910
u623819879
1558150732
Python
Python (3.4.3)
py
Runtime Error
17
2940
234
n=int(input()) for i in range((2*n)**0.5-3,n**0.5+2): if i*(i+1)//2=n: for j in range(1,i+1): print(j) break elif i*(i+1)//2>n: k=i*(i+1)//2-n for j in range(1,i+1): ifr j!=k: print(j) break
s841357672
p03910
u969190727
1558067573
Python
Python (3.4.3)
py
Runtime Error
2104
3444
176
def f(n): for i in range(n): if i*(i+1)>=2*n: return(i) break n=int(input()) Ans=[] while n>1: Ans.append(f(n)) n-=f(n) Ans.append(1) print(*Ans,sep="\n")
s379092881
p03910
u782441844
1546658715
Python
Python (3.4.3)
py
Runtime Error
18
3060
299
N = int(input()) ctr = 1 tmp = 0 for i in range(N) : if tmp == ctr : ctr += 1 tmp = 1 else : tmp += 1 L.append(ctr) ma = L[-1] va = N-ma print(ma) for i in range(ma-1,0,-1) : if (va - i) >= 0 : print(i) va -= i elif va < 0 : break
s932736562
p03911
u888337853
1597605939
Python
PyPy3 (7.3.0)
py
Runtime Error
97
74804
1965
import sys import math import collections import bisect import itertools import numpy as np sys.setrecursionlimit(10 ** 7) INF = 10 ** 20 MOD = 10 ** 9 + 7 # MOD = 998244353 ni = lambda: int(sys.stdin.readline().rstrip()) ns = lambda: map(int, sys.stdin.readline().rstrip().split()) na = lambda: list(map(int, sys.std...
s028657126
p03911
u588794534
1592439759
Python
PyPy3 (2.4.0)
py
Runtime Error
1615
86360
1448
import sys sys.setrecursionlimit(2147483647) n,m=map(int,input().split()) #n,m<=10**5 class UnionFind(): def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.find(self...
s242015016
p03911
u588794534
1592439647
Python
PyPy3 (2.4.0)
py
Runtime Error
1610
84696
1488
import sys sys.setrecursionlimit(2147483647) n,m=map(int,input().split()) #n,m<=10**5 class UnionFind(): def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.find(self...
s380944336
p03911
u588794534
1592439285
Python
PyPy3 (2.4.0)
py
Runtime Error
2108
84952
1456
import sys sys.setrecursionlimit(2147483647) n,m=map(int,input().split()) #n,m<=10**5 class UnionFind(): def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.find(self...
s185370083
p03911
u588794534
1592439255
Python
PyPy3 (2.4.0)
py
Runtime Error
2109
84952
1410
n,m=map(int,input().split()) #n,m<=10**5 class UnionFind(): def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.find(self.parents[x]) return self.parents[x...
s993983245
p03911
u366541443
1591475050
Python
PyPy3 (2.4.0)
py
Runtime Error
176
38460
27
4 6 3 1 2 3 2 4 2 2 4 6 1 6
s085917438
p03911
u760248716
1590785335
Python
Python (3.4.3)
py
Runtime Error
2134
1990292
217
from scipy.sparse import* (n,m),*t=[map(int,t.split())for t in open(0)] *b,a=zip(*[(i,j+n,1)for i,(_,*t)in enumerate(t)for j in t]) print('YNEOS'[1in csgraph.connected_components(csr_matrix((a,b),[n*m]*2))[1][:n]::2])
s388662364
p03911
u760248716
1590785278
Python
Python (3.4.3)
py
Runtime Error
549
68136
217
from scipy.sparse import* (n,m),*t=[map(int,t.split())for t in open(0)] *b,a=zip(*[(i,j+n,1)for i,(_,*t)in enumerate(t)for j in t]) print('YNEOS'[1in csgraph.connected_components(csr_matrix((a,b),[n*9]*2))[1][:n]::2])
s390470781
p03911
u760248716
1590785255
Python
Python (3.4.3)
py
Runtime Error
535
68132
217
from scipy.sparse import* (n,m),*t=[map(int,t.split())for t in open(0)] *b,a=zip(*[(i,j+n,1)for i,(_,*t)in enumerate(t)for j in t]) print('YNEOS'[1in csgraph.connected_components(csr_matrix((a,b),[m*9]*2))[1][:n]::2])
s919343426
p03911
u760248716
1590785216
Python
Python (3.4.3)
py
Runtime Error
541
61096
217
from scipy.sparse import* (n,m),*t=[map(int,t.split())for t in open(0)] *b,a=zip(*[(i,j+n,1)for i,(_,*t)in enumerate(t)for j in t]) print('YNEOS'[1in csgraph.connected_components(csr_matrix((a,b),[m*3]*2))[1][:n]::2])
s294691872
p03911
u760248716
1590785194
Python
Python (3.4.3)
py
Runtime Error
524
61096
217
from scipy.sparse import* (n,m),*t=[map(int,t.split())for t in open(0)] *b,a=zip(*[(i,j+n,1)for i,(_,*t)in enumerate(t)for j in t]) print('YNEOS'[1in csgraph.connected_components(csr_matrix((a,b),[n*3]*2))[1][:n]::2])
s616960401
p03911
u760248716
1590784587
Python
Python (3.4.3)
py
Runtime Error
519
61084
221
from scipy.sparse import*;(n,m),*t=[map(int,t.split())for t in open(0)];*b,a=zip(*[(i,j+n-1,1)for i,(_,*t)in enumerate(t)for j in t]);print("YNEOS"[1in csgraph.connected_components(csr_matrix(((a,t)),[n+m]*2))[1][:n]::2])
s428682155
p03911
u952165951
1590781839
Python
Python (3.4.3)
py
Runtime Error
478
61156
253
from numpy import*;from scipy.sparse import*;(n,m),*p=[map(int,o.split())for o in open(0)];e,*f=array([(i,j+n-1,1)for i,q in enumerate(p)for j in list(q)[1:]]).T[:3];print("YNEOS"[1in csgraph.connected_components(csr_matrix(((f,e)),[n+m]*2))[1][:n]::2])
s005344899
p03911
u798818115
1588293119
Python
Python (3.4.3)
py
Runtime Error
654
32760
592
N,M=map(int,input().split()) def dfs(num): visited[num]=1 for item in way[num]: if visited[item]==0: dfs(item) return mem=[-1]*M way=[[] for i in range(N)] visited=[0]*N for n in range(N): temp=list(map(int,input().split())) for i in range(temp[0]): if mem[temp[i+...
s969553689
p03911
u520276780
1587182301
Python
PyPy3 (2.4.0)
py
Runtime Error
839
162156
717
n,m = map(int, input().split( )) p= [i for i in range(n)]+[n+j for j in range(m)] rk = [0]*(n+m) def rt(a): if a==p[a]: return a p[a] = rt(p[a]) return p[a] def uni(a,b): ra = rt(a);rb=rt(b) if ra==rb: return if rk[ra]>rk[rb]: p[rb] = ra else: if rk[ra]==rk[rb...
s615771810
p03911
u521602455
1586921141
Python
Python (3.4.3)
py
Runtime Error
658
61260
510
N,M=map(int,input().split()) D=[set() for i in range(M)]#i番目の言語を話せる人 L=[set() for i in range(N)]#i番目の人が話せる言語 for i in range(N): Li=list(map(int,input().split()))[1:] for l in Li: L[i].add(l-1) D[l-1].add(i) seen=[False for i in range(N)] seen[0]=True def dfs(i): for l in L[i]: for k ...
s281094997
p03911
u691896522
1586632821
Python
PyPy3 (2.4.0)
py
Runtime Error
623
101660
494
n,m = map(int, input().split()) adjacent_list = [[] for i in range(n+1+m+1)] for i in range(1,n+1): for j in list(map(int, input().split()))[1:]: adjacent_list[i].append(j) adjacent_list[i].append(j) finished = set() def dfs(node): finished.add(node) for i in adjacent_list[node]: if ...
s740744342
p03911
u814986259
1582034395
Python
Python (3.4.3)
py
Runtime Error
406
12084
869
class unionFind: parent = [] def __init__(self, N): self.parent = [i for i in range(N)] def root(self, x): if self.parent[x] == x: return(x) else: self.parent[x] = self.root(self.parent[x]) return(self.parent[x]) def same(self, x, y): ...
s679031565
p03911
u947883560
1579381798
Python
PyPy3 (2.4.0)
py
Runtime Error
2161
950188
1423
#!/usr/bin/env python3 import sys sys.setrecursionlimit(10**8) INF = float("inf") def yes(): print("YES") # type: str def no(): print("NO") # type: str class Graph(object): def __init__(self, N): self.N = N self.E = defaultdict(list) def add_edge(self, f, t, w=1): self....
s193468196
p03911
u600402037
1578255964
Python
Python (3.4.3)
py
Runtime Error
349
36400
737
import sys stdin = sys.stdin ri = lambda: int(rs()) rl = lambda: list(map(int, stdin.readline().split())) # applies to numbers only rs = lambda: stdin.readline().rstrip() # ignores trailing space #人は0からN-1,言語は1からMまで N, M = rl() KL = [rl() for _ in range(N)] speak_lan = [[] for _ in range(M+1)] #0は使わない for i, x in ...
s453458299
p03911
u076917070
1577408182
Python
Python (3.4.3)
py
Runtime Error
18
3060
313
import sys input = sys.stdin.readline def main(): N = int(input()) ans = set() for i in range(1, N): ans.add(i) if sum(ans) >= N: break m = sum(ans) - N if m in ans: ans.remove(m) for i in ans: print(i) if __name__ == '__main__': main()
s506410777
p03911
u469268229
1575250219
Python
Python (3.4.3)
py
Runtime Error
1062
804532
796
import sys import numpy as np from scipy.sparse.csgraph import dijkstra from scipy.sparse import csr_matrix def main(): n, m = map(int, sys.stdin.readline().split()) can_speak = [[] for _ in range(m + 1)] for i in range(n): *languages, = map(int, sys.stdin.readline().split()) for l in lang...
s927598733
p03911
u650477665
1573403863
Python
PyPy3 (2.4.0)
py
Runtime Error
581
88864
1272
from collections import defaultdict # python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline class UnionFind: """ sizeによる実装 """ def __init__(self, N): self.parent = [i for i in range(N)] self.size = [1 for _ in range(N)] def find(self, x):...
s007371375
p03911
u650477665
1573403721
Python
PyPy3 (2.4.0)
py
Runtime Error
465
76064
1272
from collections import defaultdict # python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline class UnionFind: """ sizeによる実装 """ def __init__(self, N): self.parent = [i for i in range(N)] self.size = [1 for _ in range(N)] def find(self, x):...
s349878248
p03911
u650477665
1573403604
Python
PyPy3 (2.4.0)
py
Runtime Error
579
87712
1244
from collections import defaultdict # python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline class UnionFind: """ sizeによる実装 """ def __init__(self, N): self.parent = [i for i in range(N)] self.size = [1 for _ in range(N)] def find(self, x):...
s570867406
p03911
u223904637
1572124908
Python
PyPy3 (2.4.0)
py
Runtime Error
168
38384
1160
class UnionFind: def __init__(self, n): self.par = [i for i in range(n+1)] self.rank = [0] * (n+1) # 検索 def find(self, x): if self.par[x] == x: return x else: self.par[x] = self.find(self.par[x]) return self.par[x] # 併合 def union(...
s543269599
p03911
u009348313
1570579580
Python
PyPy3 (2.4.0)
py
Runtime Error
789
135128
537
N,M = map(int,input().split()) L = [] for i in range(N): tmp = list(map(int,input().split())) L.append(tmp[1:]) #print(L) # 人(0~N-1)と言語(N~M-1)の間で二部グラフを作る E = [set() for _ in range(N+M)] for i in range(N): for l in L[i]: E[i].add(l+N-1) E[l+N-1].add(i) #print(E) # 人のノードすべてに到達可能であればYES Visited = [0 for _ ...
s100039350
p03911
u009348313
1570551884
Python
PyPy3 (2.4.0)
py
Runtime Error
2138
839220
657
N,M = map(int,input().split()) L = [] for i in range(N): tmp = list(map(int,input().split())) L.append(tmp[1:]) dicL = {} for i in range(N): for l in L[i]: if l not in dicL: dicL[l] = [i] else: dicL[l].append(i) #print(dicL) E = [[] for _ in range(N)] for k,v in dicL.items(): if len(v) > 1:...
s383414387
p03911
u654470292
1570246852
Python
PyPy3 (2.4.0)
py
Runtime Error
436
67420
1495
import sys def input(): return sys.stdin.readline()[:-1] inf=float("inf") class UnionFind: def __init__(self, n): # 親要素のノード番号を格納。par[x] == xの時そのノードは根 self.par = [i for i in range(n+1)] # 木の高さを格納する(初期状態では0) self.rank = [0] * (n+1) # 検索 # 根ならその番号を返す def find(self, x): ...
s978550197
p03911
u471684875
1569202566
Python
Python (3.4.3)
py
Runtime Error
2109
29316
568
n,m=map(int,input().split()) l=[] for i in range(n): t=(list(map(int,input().split()))) l.append(set(t[1:])) #print(l) lll=[] for i in range(n): ll={} for j in range(i+1,n): if set(l[i])&set(l[j]): ll=set(ll)|set(l[i])|set(l[j]) lll.append(ll) lll=lll[:-1] #print(lll) l_l={} for ...
s265447808
p03911
u792670114
1568493142
Python
Python (3.4.3)
py
Runtime Error
744
29508
552
N, M = map(int, input().split()) L = [] for i in range(N): Ls = list(map(int, input().split())) Ls.pop(0) Ls = [l-1 for l in Ls] L.append(Ls) #print(L) UF = list(range(N+M)) def par(m): if UF[m] == m: return m r = par(UF[m]) UF[m] = r return r def unite(m, n): i = par(m) j = par(n) UF[j] = i f...
s110851133
p03911
u792670114
1568492583
Python
Python (3.4.3)
py
Runtime Error
718
40536
578
N, M = map(int, input().split()) L = [] S = [[] for i in range(M)] for i in range(N): Ls = list(map(int, input().split())) Ls.pop(0) Ls = [l-1 for l in Ls] L.append(Ls) for l in Ls: S[l].append(i) #print(L) #print(S) UF = list(range(N+M)) def par(m): if UF[m] == m: return m r = par(UF[m]) UF[m] ...
s618084534
p03911
u794250528
1567632283
Python
Python (3.4.3)
py
Runtime Error
427
35400
355
import collections n, m = map(int, input().split()) d = [set() for _ in range(m)] # key=言語 val=利用者一覧 for i in range(n): line = list(map(int, input().split())) for l in line[1:]: d[l - 1].add(i) s = set(d[0]) for i in range(1, n): if s & d[i]: s |= d[i] else: print('NO') ...
s404801971
p03911
u794250528
1567632231
Python
PyPy3 (2.4.0)
py
Runtime Error
623
71660
355
import collections n, m = map(int, input().split()) d = [set() for _ in range(m)] # key=言語 val=利用者一覧 for i in range(n): line = list(map(int, input().split())) for l in line[1:]: d[l - 1].add(i) s = set(d[0]) for i in range(1, n): if s & d[i]: s |= d[i] else: print('NO') ...
s687558622
p03911
u350997995
1566637894
Python
Python (3.4.3)
py
Runtime Error
2106
111184
396
import sys sys.setrecursionlimit(100000) N,M = map(int,input().split()) R = [[] for _ in range(N+M)] for i in range(N): L = list(map(lambda x:int(x)-1+N,input().split()))[1:] R[i]+=L for l in L: R[l].append(i) A = [0]*(N+M) def f(v): global R,A A[v] = 1 for c in R[v]: if c<N and ...