input
stringlengths
20
127k
target
stringlengths
20
119k
problem_id
stringlengths
6
6
n = int(eval(input())) A = list(map(int, input().split())) ans = 0 sm = 0 for i in range(n): if i % 2 == 0: if sm + A[i] > 0: sm += A[i] elif sm + A[i] <= 0: num = -(sm + A[i]) + 1 sm += A[i] + num ans += num else: if sm + A[...
import sys input = sys.stdin.readline n = int(eval(input())) A = list(map(int, input().split())) ans = 0 sm = 0 for i in range(n): if i % 2 == 0: if sm + A[i] > 0: sm += A[i] elif sm + A[i] <= 0: num = -(sm + A[i]) + 1 sm += A[i] + num ans...
p03739
n,a=int(eval(input())),list(map(int,input().split()));ans=0 if a[0]==0: bol=True for i in range(1,n): if a[i-1]!=a[i]: bol=False if a[i]>0:a[0]=(1if i%2==0else-1) else:a[0]=(1if i%2!=0else-1) ans+=1;break if bol:print((n*2-1));exit() b=[a[0]];m=("+"if a[0]<0else"-") for i in r...
n=int(eval(input())) A=list(map(int,input().split())) ans=10**15 for i in[-1,1]: ansi,sum=0,0 for a in A: sum+=a if sum*i<=0:ansi+=abs(sum-i);sum=i i*=-1 ans=min(ans,ansi) print(ans)
p03739
n = int(eval(input())) a = list(map(int,input().split())) count=0 if a[0]>0: for i in range(n): if i%2==0: if sum(a[:i+1])<0: count+=-1*sum(a[:i+1])+1 a[i]+=-1*sum(a[:i+1])+1 else: if sum(a[:i+1])>0: count+=sum(a[:i+1])+1 a[i]-=sum(a[:i+1])-1 else: f...
n=eval(input()) a=[int(i) for i in input().split()] def chk(a,t): ans=0 x=0 for i in a: x+=i if t==True and x<1: ans+=1-x x=1 elif t==False and x>-1: ans+=x+1 x=-1 t=not t return ans print((min(chk(a,True),chk...
p03739
N = int(eval(input())) A = list(map(int, input().split())) x = 0 tmp = 0 for i in range(N): tmp += A[i] if i & 1 == 0: if tmp < 1: x += 1-tmp tmp = 1 else: if tmp > -1: x += 1+tmp tmp = -1 y = 0 tmp = 0 for i in range(N): ...
n = int(eval(input())) a = list(map(int, input().split())) def check(flag): acc = 0 cnt = 0 flag = flag for i in a: acc += i if (flag == 1 and flag > acc) or (flag == -1 and flag < acc) or i == 0: cnt += abs(flag - acc) acc = flag flag *= -1...
p03739
n = int(eval(input())) a = list(map(int, input().split())) # プラススタート ------------------ ans01 = 0 temp = a[0] if (temp > 0): pass else: add = abs(temp) + 1 ans01 += add temp = 1 for i in range(1, n): tar = temp + a[i] if (tar * temp < 0): temp = tar else: ...
n = int(eval(input())) a = list(map(int, input().split())) def calc(val): # valには、1か−1を入れる。 if (val * a[0] > 0): # 狙った符号のパターン temp = a[0] ans01 = 0 else: # 違うパターン add = abs(a[0]) + 1 ans01 = add temp = val for i in range(1, n):...
p03739
import sys def solve(): n = int(eval(input())) a = [int(i) for i in input().split()] ans1 = 0 if a[0] > 0 else abs(a[0] - 1) v = a[0] if a[0] > 0 else 1 for i in range(1, n): if v * (v + a[i]) < 0: v += a[i] else: if v > 0: ans...
import sys def solve(): n = int(eval(input())) a = [int(i) for i in input().split()] ans1 = scan(a, -1) ans2 = scan(a, 1) ans = min(ans1, ans2) print(ans) def scan(a, sgn): if a[0] * sgn > 0: res = 0 v = a[0] else: res = abs(a[0] - sgn) ...
p03739
n = int(eval(input())) li = list(map(int,input().split())) ans = 0 cnt = 0 s = 0 for i in range(n): if i == 0: ans += li[i] if ans > 0: s = 1 else: s = -1 else: ans += li[i] if ans <= 0 and s == -1: while True: ...
n = int(eval(input())) li = list(map(int,input().split())) ans = 0 cnt = 0 s = 1 for i in range(n): ans += li[i] if ans <= 0 and s == -1: cnt += abs(ans) + 1 ans = 1 if ans >= 0 and s == 1: cnt += abs(ans) + 1 ans = -1 s *= -1 res1 = cnt ans...
p03739
import copy n=int(eval(input())) a=[int(x) for x in input().rstrip().split()] ac=copy.deepcopy(a) now=0 ans1=0 for i in range(n): now+=a[i] if i%2==0: if now<=0: ans1+=abs(now)+1 now=1 else: if 0<=now: ans1+=abs(now)+1 now=-1 now=0 ans2=0 for i in range(n): ...
import copy n=int(eval(input())) a=[int(x) for x in input().rstrip().split()] now=0 ans1=0 for i in range(n): now+=a[i] if i%2==0: if now<=0: ans1+=abs(now)+1 now=1 else: if 0<=now: ans1+=abs(now)+1 now=-1 now=0 ans2=0 for i in range(n): now+=a[i] if i%...
p03739
n = int(eval(input())) a_list = list(map(int, input().split())) total = 0 count = 0 pos_or_neg = True # True = +, False = - if sum(a_list) >= 0: if n % 2 == 0: pos_or_neg = False else: pos_or_neg = True else: if n % 2 == 0: pos_or_neg = True else: pos_o...
n = int(eval(input())) a_list = list(map(int, input().split())) total = 0 count = 0 pos_or_neg = True # True = +, False = - for a in a_list: total += a if pos_or_neg: if total <= 0: count += -total + 1 total += -total + 1 pos_or_neg = False else: ...
p03739
n = int(eval(input())) a = list(map(int, input().split())) sum = a[0] count = 0 for i in range(1, n) : temp = sum sum += a[i] if temp > 0 and sum > 0 : while sum >= 0 : count += 1 sum -= 1 elif temp < 0 and sum < 0 : while sum <= 0 : c...
n = int(eval(input())) a = list(map(int, input().split())) sum = a[0] count1 = 0 count2 = 0 sum1 = 0 sum2 = 0 for i in range(n) : sum1 += a[i] sum2 += a[i] if i % 2 == 0 : if sum1 >= 0 : count1 += abs(sum1) + 1 sum1 = -1 if sum2 <= 0 : ...
p03739
n = int(eval(input())) a = list(map(int,input().split())) A = [n for n in a] cnt1 = 0 cnt2 = 0 S = 0 if a[0] > 0: for i in range(n-1): S += a[i] if a[i] > 0: while S + a[i+1] >= 0: a[i+1] -= 1 cnt1 += 1 elif a[i] < 0: ...
n = int(eval(input())) a = list(map(int,input().split())) S1 = 0 S2 = 0 #S1が奇数番目が正の場合、S2が偶数番目が負の場合 cnt1 = 0 cnt2 = 0 for i,num in enumerate(a): S1 += num if i % 2 == 0 and S1 <= 0: cnt1 += 1 - S1 S1 = 1 if i % 2 != 0 and S1 >= 0: cnt1 += 1 + S1 S1 = -1 ...
p03739
n = int(eval(input())) a = tuple(list(map(int, input().split()))) #aをtupleにしておかないとb = aとしたときにb変更するとa変更されてしまう リストーのコピー def puramai(a): b = list(a) hikaku = 0 ans = 0 for i in range(n): if i % 2 == 0 and hikaku + b[i] <= 0: b[i] = -hikaku+1 ans += abs(b[i]-a[i]) ...
N = int(eval(input())) a = [int(i) for i in input().split()] def pura(a): A = a[:] ans = 0 check = 0 if A[0] <= 0: ans += 1 + abs(A[0]) A[0] = 1 check += A[0] for i in range(1, N): if i % 2 != 0: if check + A[i] >= 0: ...
p03739
n = int(eval(input())) al = list(map(int, input().split())) import itertools alsum = list(itertools.accumulate(al)) temp1 = 0 temp2 = 0 for i in range(n): if i % 2 ==0: if alsum[i] >0: pass else: y = abs(alsum[i])+1 temp1 += y alsum...
n = int(eval(input())) al = list(map(int, input().split())) import itertools alsum = list(itertools.accumulate(al)) temp1 = 0 temp2 = 0 res = 0 for i in range(n): res += al[i] if i % 2 ==0: if res >0: pass else: y = res*(-1)+1 temp1 += y ...
p03739
from itertools import accumulate n, *A = list(map(int, open(0).read().split())) B = list(accumulate(A)) p0 = n0 = p1 = n1 = 0 for i, b in enumerate(B): if i % 2 == 0: if b+p0-n0 <= 0: p0 += abs(b+p0-n0)+1 if b+p1-n1 >= 0: n1 += abs(b+p1-n1)+1 else: if b...
n = int(eval(input())) a = list(map(int,input().split())) def calc(t): ans = su = 0 for i in range(n): su += a[i] if i % 2 == t: if su > 0: pass else: x = 1 - su ans += abs(x) su = 1 else: if su < 0: pass else: x ...
p03739
n = int(eval(input())) a = [int(_) for _ in input().split()] new_a_plus = [a[i] for i in range(n)] new_a_minus = [a[i] for i in range(n)] count_plus = 0 if a[0] <= 0: new_a_plus[0] = 1 count_plus += 1 - a[0] for i in range(1, n): if i % 2 == 0: if sum(new_a_plus[:i+1]) <= 0: ...
n = int(eval(input())) a = [int(_) for _ in input().split()] new_a_plus = [a[i] for i in range(n)] new_a_minus = [a[i] for i in range(n)] count_plus = 0 now_total_plus = 0 for i in range(0, n): if i % 2 == 0: if now_total_plus + a[i] <= 0: new_a_plus[i] = - now_total_plus + 1 ...
p03739
from copy import copy n = int(eval(input())) a = [int(x) for x in input().split()] ans1=[(-1)**i for i in range(n)] b=copy(a) res_b=0 c=copy(a) res_c=0 for i in range(n): if ans1[i]*sum(b[:i+1])>0: pass else: b[i]=ans1[i]-sum(b[:i]) res_b+=abs(b[i]-a[i]) if -1*ans1[i]*sum(c[:i+1])>0: ...
from copy import copy n = int(eval(input())) a = [int(x) for x in input().split()] ans1=[(-1)**i for i in range(n)] b=copy(a) res_b=0 sb=0 c=copy(a) res_c=0 sc=0 for i in range(n): sb+=a[i] if ans1[i]*sb>0: pass else: b[i]=ans1[i]-(sb-b[i]) sb=sb-a[i]+b[i] res_b+=abs(b[i]-a[i]) ...
p03739
import sys input = sys.stdin.readline n = int(eval(input())) a = [int(i) for i in input().split()] # i番目までの和が正(i: 奇数) res1 = 0 cum = 0 for i in range(n): cum += a[i] if i % 2 == 1: while cum <= 0: cum += 1 res1 += 1 else: while cum >= 0: ...
import sys input = sys.stdin.readline n = int(eval(input())) a = [int(i) for i in input().split()] # i番目までの和が正(i: 奇数) res1 = 0 cum = 0 for i in range(n): cum += a[i] if i % 2 == 1: if cum <= 0: res1 += (1 - cum) cum = 1 else: if cum >= 0: ...
p03739
def sign(x): if x>0: return 1 elif x<0: return -1 else: return 0 n = int(eval(input())) a = [int(i) for i in input().split()] s = [sum(a[:i+1]) for i in range(n)] sp = [s[i] for i in range(n)] sm = [s[i] for i in range(n)] P0=0 M0=0 if s[0]==0: P0+=1 M0+=1...
def sign(p): if p<0: return -1 elif p>0: return 1 else: return 0 N=int(eval(input())) a=[int(i) for i in input().split()] m=[0,0] for sgn in [-1,1]: x=0 S=0 for i in range(N): S+=a[i] if sign(S)==sgn*(-1)**(i%2) or sign(S)==0: x...
p03739
n=int(eval(input())) a=list(map(int,input().split())) # 0 1 2 3 evn odd # kevn + - + - + - # kodd - + - + - + a0=a[0] if a0<0: kevn=1-a0 sevn=1 elif a0==0: kevn=1 sevn=1 elif a0>0: kevn=0 sevn=a0 for i in range(1,n): ai=a[i] if i%2==0: ...
n=int(eval(input())) a=list(map(int,input().split())) # 0 1 2 3 evn odd # kevn + - + - + - # kodd - + - + - + def kf(a,flag,n): a0=a[0]*flag if a0<=0: kevn=1-a0 sevn=1 elif a0>0: kevn=0 sevn=a0 for i in range(1,n): ai=a[i...
p03739
n = int(eval(input())) a = list(map(int, input().split())) minA = 0 sumA = 0 # 奇数項を正としたときの操作回数minA for i in range(n): sumA += a[i] if i%2 == 0: if sumA <= 0: minA += abs(sumA)+1 sumA += abs(sumA)+1 else: if sumA >= 0: minA += abs(sumA)+1 sumA -= abs(sumA)+1...
def F(list_A, sign): total = 0 cnt = 0 for a in list_A: total += a if sign==True and total < 1: cnt += 1- total total = 1 elif sign==False and total > -1: cnt += total + 1 total = -1 sign = not sign return cnt N = int(eval(input())) A = list(map(int,...
p03739
import copy n = int(eval(input())) a = list(map(int,input().split())) b = copy.copy(a) #sum_a = [] #sum_b = [] ans_a = 0 ans_b = 0 for i in range(n): if i%2==0: if sum(a[:i+1])>0: #sum_a.append(sum(a[:i+1])) tmp = 0 else: tmp = abs(sum(a[:i+1]))+1 ...
import copy n = int(eval(input())) a = list(map(int,input().split())) b = copy.copy(a) ans_a = 0 ans_b = 0 sum_a = 0 sum_b = 0 for i in range(n): if i%2==0: if sum_a+a[i]>0: tmp = 0 else: tmp = abs(sum_a+a[i])+1 a[i] += tmp ans_a += tmp ...
p03739
from collections import defaultdict def solve(pre_is_positive, total, ans, a_list): for a in a_list: total += a if pre_is_positive: if total == 0: ans += 1 total = -1 elif total > 0: ans += abs(total) + 1 ...
from collections import defaultdict def solve(pre_is_positive, a_list): total = 0 ans = 0 for a in a_list: total += a if pre_is_positive and total >= 0: ans += abs(total) + 1 total = -1 elif not pre_is_positive and total <= 0: ans += ...
p03739
n = int(eval(input())) a = list(map(int,input().split())) sum1 = sum2 = cost1 = cost2 = 0 for i in range(n): cur = a[i] sum1 += cur if (sum1<=0, sum1>=0)[i%2]: cost1 += 1+sum1*[-1,1][i%2] sum1 = [1,-1][i%2] sum2 += cur if (sum2>=0, sum2<=0)[i%2]: cost2 += 1+sum2*[1...
def solve(): n = int(eval(input())) a = list(map(int,input().split())) sum1 = sum2 = cost1 = cost2 = 0 for i in range(n): cur = a[i] sum1 += cur if (sum1<=0, sum1>=0)[i%2]: cost1 += 1+sum1*[-1,1][i%2] sum1 = [1,-1][i%2] sum2 += cur ...
p03739
import sys, os, math, bisect, itertools, collections, heapq, queue # from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall from decimal import Decimal from collections import defaultdict, deque # import fractions sys.setrecursionlimit(10000000) ii = lambda: int(sys.stdin.buffer.readline().rstr...
import sys, os, math, bisect, itertools, collections, heapq, queue # from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall from decimal import Decimal from collections import defaultdict, deque # import fractions sys.setrecursionlimit(10000000) ii = lambda: int(sys.stdin.buffer.readline().rstr...
p03739
import sys, os, math, bisect, itertools, collections, heapq, queue # from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall from decimal import Decimal from collections import defaultdict, deque # import fractions sys.setrecursionlimit(10000000) ii = lambda: int(sys.stdin.buffer.readline().rstr...
import sys, os, math, bisect, itertools, collections, heapq, queue # from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall from decimal import Decimal from collections import defaultdict, deque sys.setrecursionlimit(10000000) ii = lambda: int(sys.stdin.buffer.readline().rstrip()) il = lambda: li...
p03739
eval(input()) iter_ = iter(map(int, input().rstrip("\n").split())) sum_ = next(iter_) ans = 0 for num in iter_: if sum_ == 0: sum_ += 1 ans += 1 presum = sum_ sum_ += num while presum * sum_ >= 0: sum_ += -1 if presum > 0 else 1 ans += 1 print(ans)
eval(input()) seq = list(map(int, input().rstrip("\n").split())) iter_ = iter(seq) ans1 = 0 for i, num in enumerate(iter_): if i == 0: sum_ = num if sum_ > 0: pass else: ans1 += abs(sum_ - 1) sum_ = 1 else: sum_ += num i...
p03739
from collections import Counter,defaultdict import sys,heapq,bisect,math,itertools,string,queue,fractions mod = 10**9+7 def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) def inpln(n): return list(int(sys.stdin.readline()) for i in range(n)) def inpl_str():...
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify from bisect import bisect_left,bisect_right import sys,math,itertools,fractions,pprint sys.setrecursionlimit(10**8) mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(m...
p03739
# -*- coding: utf-8 -*- # 整数の入力 n=int(eval(input())) a=input().split() b=a[:] c=a[:] # a[0]の符号をそのままにした場合の計算 counter_1=0 S=int(a[0]) for i in range(1,n): if S<0 and S+int(a[i])<=0: counter_1+=-S-int(a[i])+1 a[i]=-S+1 elif S>0 and S+int(a[i])>=0: counter_1+=S+int(a[i])+1 a[i]=-S-1 S+...
# -*- coding: utf-8 -*- # 整数の入力 n=int(eval(input())) a=list(map(int, input().split())) b=a[:] c=a[:] # a[0]の符号をそのままにした場合の計算 counter_1=0 S=int(a[0]) for i in range(1,n): if S<0 and S+int(a[i])<=0: counter_1+=-S-int(a[i])+1 a[i]=-S+1 elif S>0 and S+int(a[i])>=0: counter_1+=S+int(a[i])+1 ...
p03739
# -*- coding: utf-8 -*- # 整数の入力 n=int(eval(input())) a=list(map(int, input().split())) b=a[:] c=a[:] # a[0]の符号をそのままにした場合の計算 counter_1=0 S=int(a[0]) for i in range(1,n): if S<0 and S+int(a[i])<=0: counter_1+=-S-int(a[i])+1 a[i]=-S+1 elif S>0 and S+int(a[i])>=0: counter_1+=S+int(a[i])+1 ...
# -*- coding: utf-8 -*- # 整数の入力 n=int(eval(input())) a=list(map(int, input().split())) b=a[:] c=a[:] # a[0]の符号をそのままにした場合の計算 counter_1=0 S=int(a[0]) for i in range(1,n): if S<0 and S+a[i]<=0: counter_1+=-S-a[i]+1 a[i]=-S+1 elif S>0 and S+a[i]>=0: counter_1+=S+a[i]+1 a[i]=-S-1 S+=a[i...
p03739
import sys,queue,math,copy,itertools,bisect,collections,heapq def main(): sys.setrecursionlimit(10**7) INF = 10**18 MOD = 10**9 + 7 LI = lambda : [int(x) for x in sys.stdin.readline().split()] NI = lambda : int(sys.stdin.readline()) n = NI() bit = [0] * (n+1) A = LI() d...
import sys,queue,math,copy,itertools,bisect,collections,heapq def main(): sys.setrecursionlimit(10**7) INF = 10**18 MOD = 10**9 + 7 LI = lambda : [int(x) for x in sys.stdin.readline().split()] NI = lambda : int(sys.stdin.readline()) n = NI() bit = [0] * (n+1) def add(i,x):...
p03739
import sys,queue,math,copy,itertools,bisect,collections,heapq def main(): sys.setrecursionlimit(10**7) INF = 10**18 MOD = 10**9 + 7 LI = lambda : [int(x) for x in sys.stdin.readline().split()] NI = lambda : int(sys.stdin.readline()) n = NI() bit = [0] * (n+1) def add(i,x):...
import sys,queue,math,copy,itertools,bisect,collections,heapq def main(): sys.setrecursionlimit(10**7) INF = 10**18 MOD = 10**9 + 7 LI = lambda : [int(x) for x in sys.stdin.readline().split()] NI = lambda : int(sys.stdin.readline()) n = NI() a = LI() ans = INF for s in ...
p03739
N = int(eval(input())) A = list(map(int, input().split())) currentSum = 0 count1 = 0 count2 = 0 count3 = 0 count4 = 0 for i in range(N): restSum = currentSum currentSum += A[i] if currentSum <= 0 and restSum < 0: count1 += abs(currentSum) + 1 currentSum = 1 elif currentSum...
N = int(eval(input())) A = list(map(int, input().split())) currentSum = 0 count3 = 0 count4 = 0 currentSum = 0 for i in range(N): restSum = currentSum currentSum += A[i] if currentSum <= 0 and restSum < 0: count3 += abs(currentSum) + 1 currentSum = 1 elif currentSum >= 0 an...
p03739
n = int(eval(input())) a = list(map(int, input().split())) cnt = 0 if a[0] < 0: flag = -1 else: flag = 1 for i in range(1,n): if flag == -1: if sum(a[0:i]) + a[i] <= 0: cnt += -(sum(a[0:i]) + a[i]) + 1 a[i] = -sum(a[0:i]) + 1 flag = 1 elif flag == 1: ...
n = int(eval(input())) a = list(map(int,input().split())) ans1,ans2 = 0,0 sum1,sum2 = 0,0 for i in range(n): sum1 += a[i] if i%2 == 1 and sum1 >= 0: ans1 += sum1 + 1 sum1 = -1 elif i%2 == 0 and sum1 <= 0: ans1 += -sum1 + 1 sum1 = 1 for i in range(n): sum2 += ...
p03739
n = int(eval(input())) a = list(map(int, input().split(" "))) res1 = 0 sum = 0 # sei, hu, sei, hu.... # guu, ki, guu, ki for i in range(n): sum += a[i] if sum <= 0 and i%2 == 0: res1 += abs(sum) + 1 sum = 1 elif sum >= 0 and i%2 == 1: res1 += abs(sum) + 1 ...
n = int(eval(input())) a = list(map(int, input().split(" "))) def solve(s1, s2): "if start == true, assume the first of the sum is positive." res = 0 sum = 0 for i in range(n): sum += a[i] if sum <= 0 and i % 2 == s1: res += abs(sum) + 1 sum = 1 ...
p03739
n = int(eval(input())) A = list(map(int,input().split())) ans = 10**15 for i in [-1,1]: ansi,sum=0,0 for a in A: sum+=a if sum*i<=0: ansi+=abs(sum-i) sum=i i*=-1 ans=min(ans,ansi) print(ans)
N = int(eval(input())) A = list(map(int,input().split())) ans = 10**15 for s in [1,-1]: cos = 0 tot = 0 for a in A: tot+=a if s*tot<=0: cos+=abs(tot-s) tot=s s*=-1 ans=min(ans,cos) print(ans)
p03739
N = int(eval(input())) src = list(map(int, input().split())) sum1 = sum2 = src[0] op1 = op2 = 0 if sum1 < 1: op1 += (1 - sum1) sum1 = 1 if sum2 > -1: op2 += (sum2 + 1) sum2 = -1 for i in range(1,N): if i%2 == 1: if sum1 + src[i] > -1: op1 += (sum1 + src[i] + 1) ...
N = int(eval(input())) src = list(map(int,input().split())) cum1 = cum2 = 0 ans1 = ans2 = 0 for i,a in enumerate(src): cum1 += a cum2 += a if i%2: if cum1 >= 0: ans1 += cum1+1 cum1 = -1 if cum2 <= 0: ans2 += 1-cum2 cum2 = 1 ...
p03739
N = int(eval(input())) A = list(map(int,input().split())) ans1 = c = 0 for i,a in enumerate(A): c += a if i%2: if c < 1: ans1 += 1-c c = 1 else: if c > -1: ans1 += c+1 c = -1 ans2 = c = 0 for i,a in enumerate(A): c += a ...
N = int(eval(input())) A = list(map(int,input().split())) ans1 = 0 s = 0 for i,a in enumerate(A): s += a if i%2: if s > -1: ans1 += s+1 s = -1 else: if s < 1: ans1 += 1-s s = 1 ans2 = 0 s = 0 for i,a in enumerate(A): s ...
p03739
# #    ⋀_⋀  #   (・ω・) # ./ U ∽ U\ # │* 合 *│ # │* 格 *│ # │* 祈 *│ # │* 願 *│ # │*   *│ #  ̄ # import sys sys.setrecursionlimit(10**6) input=sys.stdin.readline from math import floor,ceil,sqrt,factorial,log #log2ないyp from heapq import heappop, heappush, heappushpop from collections import ...
# #    ⋀_⋀  #   (・ω・) # ./ U ∽ U\ # │* 合 *│ # │* 格 *│ # │* 祈 *│ # │* 願 *│ # │*   *│ #  ̄ # import sys sys.setrecursionlimit(10**6) input=sys.stdin.readline from math import floor,ceil,sqrt,factorial,log #log2ないyp from heapq import heappop, heappush, heappushpop from collections import ...
p03739
def f(flg, an): accum = 0 ret = 0 for i, ai in enumerate(an): accum += ai if i % 2: if flg and 0 <= accum: ret += accum + 1 accum = -1 elif not flg and accum <= 0: ret += -accum + 1 accum = 1 ...
def f(flg, an): accum = 0 ret = 0 for i, ai in enumerate(an): accum += ai if flg: flg = False if accum <= 0: ret += -accum + 1 accum = 1 else: flg = True if 0 <= accum: ret +=...
p03739
n=int(eval(input())) a=list(map(int,input().split())) b=a[:] for i in range(n): if i%2:b[i]=min(-sum(b[j] for j in range(i))-1,b[i]) else: b[i]=max(-sum(b[j] for j in range(i))+1,b[i]) s=sum(abs(b[i]-a[i]) for i in range(n)) c=a[:] for i in range(n): if i%2:c[i]=max(-sum(c[j] for j in range(i))...
n=int(eval(input())) a=list(map(int,input().split())) s1=c1=s2=c2=0 for i in range(n): if i%2: c1+=max(0,a[i]+s1+1); s1+=min(-s1-1,a[i]) c2+=max(0,-s2+1-a[i]); s2+=max(-s2+1,a[i]) else: c1+=max(0,-s1+1-a[i]); s1+=max(-s1+1,a[i]) c2+=max(0,a[i]+s2+1); s2+=min(-s2-1,a[i]...
p03739
import itertools n = int(eval(input())) a = list(map(int,input().split())) sum = list(itertools.accumulate(a)) #'+-+-...'と'-+-+...'でそれぞれ求める res1 = 0 res2 = 0 dif1 = 0 dif2 = 0 for i in range(n): s = sum[i] + dif1 t = sum[i] + dif2 if i%2==0: if s<1: dif1 += 1 - s ...
import itertools n = int(eval(input())) a = list(map(int,input().split())) #'+-+-...'と'-+-+...'でそれぞれ求める res1 = 0 res2 = 0 dif1 = 0 dif2 = 0 for i,j in enumerate(itertools.accumulate(a)): s = j + dif1 t = j + dif2 if i%2==0: if s<1: dif1 += 1 - s res1 += 1 - s ...
p03739
n = int(eval(input())) a = list(map(int,input().split())) s = [] for i in range(n): s.append(sum(a[0:i+1])) count = 0 ans1 = 0 for i in range(n): if i%2 == 0: if s[i]+count > 0: continue else: ans1 += 1-(s[i]+count) count += 1-(s[i]+count) ...
n = int(eval(input())) a = list(map(int,input().split())) s = [] for i in range(n): if i == 0: s.append(a[0]) else: s.append(a[i]+s[-1]) count = 0 ans1 = 0 for i in range(n): if i%2 == 0: if s[i]+count > 0: continue else: ans1 += 1-(s[...
p03739
# -*- coding: utf-8 -*- n = int(eval(input())) a = list(map(int, input().split())) def solve(bl): if bl: tmp = -1 else: tmp = 0 sm = 0 cnt = 0 for i, ele in enumerate(a): sm += ele if i % 2 + tmp: if sm < 1: cnt += 1 - s...
n = int(eval(input())) a = list(map(int, input().split())) sm = a[0] def f(sm): ret = 0 for e in a[1:]: if sm * (sm + e) < 0: sm += e continue else: if sm > 0: a_mx = -sm - 1 ret += e - a_mx ...
p03739
n = int(eval(input())) a = [int(i) for i in input().split()] b = a[:] s1 = s2 = 0 for i in range(n): c = sum(a[0:i+1]) if (i % 2 == 0 and c <= 0): s1 += abs(c) + 1 a[i] += abs(c) + 1 elif(i % 2 == 1 and c >= 0): s1 += abs(c) + 1 a[i] -= abs(c) + 1 for i in range(n): c = sum(b[0:i+1]...
n = int(eval(input())) a = [int(i) for i in input().split()] s1 = s2 = su = 0 for i in range(n): su += a[i] if (i % 2 == 0 and su <= 0): s1 += abs(su) + 1 su = 1 elif(i % 2 == 1 and su >= 0): s1 += abs(su) + 1 su = -1 su = 0 for i in range(n): su += a[i] if (i % 2 == 0 and su >= ...
p03739
n = int(eval(input())) an = list(map(int, input().split())) sum_an = [] tmp = 0 for a in an: tmp += a sum_an.append(tmp) c = 0 before_positive = sum_an[0] <= 0 for i in range(n): if before_positive and sum_an[i] >= 0: p = abs(sum_an[i]) + 1 c += p for j in range(i, n...
n = int(eval(input())) an = list(map(int, input().split())) c1 = 0 c2 = 0 sum1 = 0 # 偶数番目が正 sum2 = 0 # 奇数番目が正 for i in range(n): sum1 += an[i] sum2 += an[i] if i%2 == 0: if sum1 <= 0: p = abs(sum1) + 1 c1 += p sum1 += p if sum2 >= 0: ...
p03739
def c_Sequence(N, A): total = 0 # 変化量の総量 tmp1 = 0 # 条件を満たすために今見ている項をどれだけ変化させるか for i in range(N): total += A[i] # 奇数番目を正に、偶数番目を負にする(0-indexedで) if i % 2 == 0: if total >= 0: tmp1 += abs(-1 - total) total -= abs(-1 - total) ...
def c_sequence(): N = int(eval(input())) A = [int(i) for i in input().split()] def solver(sign): ret, total = 0, 0 for a in A: total += a if sign * total <= 0: ret += abs(sign - total) # 総和がsignになるまでaを変化させる total = sign ...
p03739
n = int(eval(input())) A = list(map(int,input().split())) cnt = 0 for i in range(1,n): if A[0] >= 0: if i%2!=0 and A[i]>=0: cnt += A[i] A[i] -= A[i] while sum(A[:i+1])>=0: A[i] -= 1 cnt += 1 elif i%2==0 and A[i]<0: cnt += abs(A[i]) A[i] += abs(A[i]) ...
n = eval(input()) a = [int(i) for i in input().split()] def chk(a, t): ans = 0 x = 0 for i in a: x += i if t == True and x < 1: ans+=1-x x=1 elif t == False and x>-1: ans+=x+1 x=-1 t=not t return ans print((min(chk(a,True),chk(a,False))))
p03739
def main(): import sys input = sys.stdin.readline n = int(eval(input())) a = list(map(int, input().split())) A = [] A_append = A.append cnt = 0 for i in range(n-1): A_append((a[i])) x = sum(A) if x > 0 and x + a[i+1] > 0: y = -(x + a[i+...
n = eval(input()) A = list(map(int, input().split())) def Chk(a, pos): cnt = 0 tmp = 0 for a in A: tmp += a if pos and tmp < 1: cnt += 1 - tmp tmp = 1 elif not pos and tmp > -1: cnt += 1 + tmp tmp = -1 pos =...
p03739
n=int(eval(input())) count=0 A=[int(i) for i in input().split()] if A[0]==0: A[0]+=1 count+=1 elif A[0]<0: for i in range(len(A)): A[i]*=(-1) for i in range(1,len(A)): s=sum(A[:i+1]) if i%2==0: if s<=0: A[i]+=1-s count+=1-s else: if s>=0: A[i]-=1+s count...
n=eval(input()) a=[int(i) for i in input().split()] def chk(a,t): ans=0 x=0 for i in a: x+=i if t==True and x<1: ans+=1-x x=1 elif t==False and x>-1: ans+=x+1 x=-1 t=not t return ans print((min(chk(a,True),chk...
p03739
n = int(eval(input())) A = [int(i) for i in input().split()] def f(A, op, acc = 0, cnt = 0): for i in range(n): acc += A[i] if i % 2 == 0 and acc * op >= 0: cnt += op * acc + 1 acc = - op if i % 2 == 1 and acc * op <= 0: ...
n = int(eval(input())) A = [int(i) for i in input().split()] def f(A, op, acc = 0, cnt = 0): for i in range(n): acc += A[i] if i % 2 == 0 and op * acc <= 0: cnt += - op * acc + 1 acc = op if i % 2 == 1and op * acc >= 0: ...
p03739
n = int(eval(input())) A = [int(i) for i in input().split()] ans = 0 cnt = 0 for i in range(n): if i % 2 == 0: if cnt + A[i] < 0: cnt += A[i] else: ans += abs(cnt + A[i] - (-1)) cnt = -1 else: if cnt + A[i] > 0: cnt += A[i] ...
n = int(eval(input())) A = [int(i) for i in input().split()] def f(x): ans = 0 cnt = 0 for i in range(n): if i % 2 == x: if cnt + A[i] < 0: cnt += A[i] else: ans += abs(cnt + A[i] - (-1)) cnt = -1 else: ...
p03739
def main(): n = int(eval(input())) A = list(map(int, input().split())) res = 0 sums = [] for i in range(n): sums.append(sum(A[:i]) + A[i]) if i == 0: if A[i] == 0: index = -1 for num in A: if num != 0: ...
def main(): n = int(eval(input())) A = list(map(int, input().split())) res = 0 sums = [] for i in range(n): if i == 0: sums.append(A[i]) if A[i] == 0: sums[i] = 1 res += 1 elif A[i] < 0: res +...
p03739
import collections N=int(eval(input())) A=list(map(int,input().split())) c = collections.Counter(A) for i in range(N): if list(c.values())[i]>1: print('NO') exit() print('YES')
import collections N=int(eval(input())) A=list(map(int,input().split())) li=list(collections.Counter(A).values()) for i in range(len(li)): if li[i]>1: print('NO') exit() print('YES')
p02779
def hantei(n,data): for x in range(n-1): for y in range(x+1,n): if data[x] == data[y]: return "NO" return "YES" n = int(eval(input())) data = [int(x) for x in input().split()] print((hantei(n,data)))
def hantei(n,data): data.sort() for x in range(n-1): if data[x] == data[x+1]: return "NO" return "YES" n = int(eval(input())) data = [int(x) for x in input().split()] print((hantei(n,data)))
p02779
n=int(eval(input())) l=input().split() q=[] f=1 for i in l: if i not in q: q.append(i) else: f=0 break if f==1: print('YES') else: print('NO')
n=int(eval(input())) l=input().split() l.sort() flag=1 for i in range(n-1): if l[i]==l[i+1]:flag=0 if flag==1:print("YES") else:print("NO")
p02779
l=int(eval(input())) list = list(map(int, input().split())) i=0 r="YES" while(i<l): j=i+1 while(j<l): if(list[i]==list[j]): r="NO" j+=1 i+=1 print(r)
l=int(eval(input())) list = list(map(int, input().split())) def has_duplicates(seq): return len(seq) != len(set(seq)) r=has_duplicates(list) if(str(r)=="False"): print("YES") else: print("NO")
p02779
n=int(eval(input())) a=list(map(int,input().split())) s="YES" for i in range(n): for j in range(i+1,n): if a[i]==a[j]: s="NO" break print(s)
n=int(eval(input())) a=list(map(int,input().split())) a.sort() s="YES" for i in range(n-1): if a[i]==a[i+1]: s="NO" break print(s)
p02779
n = int(eval(input())) a = list(map(int, input().split())) l = [0 for _ in range(max(a)+1)] for i in range(n): if l[a[i]] == 0: l[a[i]] += 1 else: print('NO') break else: print('YES')
n = int(eval(input())) a = list(map(int, input().split())) if len(a) != len(set(a)): print('NO') else: print('YES')
p02779
eval(input()) l=input().split() for i in l: if l.count(i)!=1: print("NO") exit(0) print("YES")
N=int(eval(input())) a=list(map(int,input().split())) a.sort() for i in range(N-1): if a[i]==a[i+1]: print("NO") exit(0) print("YES")
p02779
n = eval(input()) a = input().split() n = int(n) a = [int(s) for s in a] s =0 for f in range(n): ai = a[f] for g in range(n): if g != f: if ai == a[g]: s = s+1 if s>0: print("NO") else: print('YES')
n = eval(input()) a = input().split() n = int(n) a = [int(s) for s in a] a.sort() #print(a) s=0 for i in range(len(a)-1): #print(a[i],a[i+1]) if a[i]==a[i+1]: print("NO") s=s+1 break if s == 0: print("YES")
p02779
n = eval(input()) N = int(n) a = input().split() A = list(map(int, a)) c = 0 for i in range(N): for j in range(i + 1, N): if A[i] == A[j]: print("NO") c += 1 break if c == 0: print("YES")
n = eval(input()) N = int(n) a = input().split() A = list(map(int, a)) b = set(A) B = list(map(int, b)) if len(A) == len(B): print("YES") else: print("NO")
p02779
N=int(eval(input())) a=list(map(int,input().split())) p=0 for i in range(N-1): for j in range(i+1,N): if a[i]==a[j]: p=1 if p==0: print('YES') else: print('NO')
N=int(eval(input())) a=list(map(int,input().split())) a=sorted(a) p=0 for i in range(N-1): if a[i]==a[i+1]: p=1 if p==0: print('YES') else: print('NO')
p02779
n=input().split() li=[] a=list(map(int,input().split())) flag=0 for i in a: if i in li: print("NO") flag=1 break else: li.append(i) if flag==0: print("YES")
n=input().split() li=[] a=list(map(int,input().split())) p=set(a) if len(a)==len(p): print("YES") else: print("NO")
p02779
N = int(eval(input())) A = list(map(int, input().split())) answer = 'YES' for i in range(N): c = A.count(A[i]) if c >= 2: answer = 'NO' break print(answer)
N = int(eval(input())) A = list(map(int, input().split())) answer = 'YES' AA = sorted(A) for i in range(N - 1): if AA[i] == AA[i + 1]: answer = 'NO' break print(answer)
p02779
import sys input = sys.stdin.readline def main(): N = int(eval(input())) A = list(map(int, input().split())) for i in range(N): for j in range(i+1, N): if A[i] == A[j]: print("NO") exit() print("YES") if __name__ == '__main__': ...
import sys input = sys.stdin.readline def main(): N = int(eval(input())) A = list(map(int, input().split())) A.sort() for i in range(1, N): if A[i-1] == A[i]: print("NO") exit() print("YES") if __name__ == '__main__': main()
p02779
n = int(eval(input())) a = list(map(int, input().split())) isDiff = True cache = [0] * n for i in range(n) : for j in range(n) : if i == j : continue if cache[j] == -1 : continue if a[i] == a[j] : isDiff = False break ...
n = int(eval(input())) a = list(map(int, input().split())) aa = set(a) if len(a) == len(aa) : print('YES') else : print('NO')
p02779
flag = True n = int(eval(input())) a = input().split() if n != len(a): print("error") start = 0 for i in a: start += 1 for j in a[start:]: if i == j: flag = False break if flag: print('YES') else: print('NO')
flag = True n = int(eval(input())) a = input().split() a.sort() start = 0 for i in a: for j in a[start-1:start+1:2]: if i == j: flag = False break start += 1 if flag: print('YES') else: print('NO')
p02779
n = int(eval(input())) a = [int(i) for i in input().split()] a.sort() for i in range(n-1): if a[i] == a[i+1]: print("NO") exit() print("YES")
n = int(eval(input())) a = [int(i) for i in input().split()] aset = set(a) print(("YES" if len(a) == len(aset) else "NO"))
p02779
n=int(eval(input())) a=list(map(int,input().split())) for i in range(n-1): for j in range(i+1,n): if a[i]==a[j]: print("NO") exit() print("YES")
n=int(eval(input())) a=list(map(int,input().split())) b=list(set(a)) if len(a)==len(b): print("YES") else: print("NO")
p02779
num = eval(input()) inp = input().split() res = [] final = "" tem = 0 for i in inp: tem = inp.count(i) res.append(tem) tem = 0 for i in res: if i >= 2: final = "NO" break else: final = "YES" print(final)
num = eval(input()) inp = input().split() len1 = len(inp) out = set(inp) len2 = len(out) if len1 == len2: print("YES") else: print("NO")
p02779
N = int(eval(input())) A = list(map(int, input().split())) L = [] for i in range(N): if A[i] in L: print('NO') break L.append(A[i]) else: print('YES')
N = int(eval(input())) A = list(map(int, input().split())) A.sort() for i in range(N-1): if A[i] == A[i+1]: print("NO") break else: print('YES')
p02779
n = int(eval(input())) num_list = list(map(int, input().split())) out = "YES" for j in range(len(num_list)): for k in num_list[j + 1:]: out = "NO" if num_list[j] == k else out print(out)
n = int(eval(input())) num_list = list(map(int, input().split())) out = "YES" if len(num_list) == len(set(num_list)) else "NO" print(out)
p02779
N = int(eval(input())) A = list(map(int, input().split())) i = 0 flag = 0 while(i<N-1): for j in range(1,len(A)): if(A[0]==A[j]): flag = 1 break if(flag == 1): break else: A.pop(0) i += 1 if(flag == 1): print("NO") else: print("YES")
N = int(eval(input())) A = list(map(int, input().split())) A.sort() flag = 0 for i in range(N-1): if(A[i]==A[i+1]): flag = 1 break if(flag == 1): print("NO") else: print("YES")
p02779
import math def main(): n = int(eval(input())) a = list(map(int, input().split())) cnt = {} for val in a: cnt[val] = cnt.get(val, 0) + 1 distinct = True for val in cnt: if cnt[val] > 1: distinct = False if distinct: print("YES") else: ...
n=int(eval(input())) a=list(input().split()) if len(list(a))==len(set(a)): print('YES') else: print('NO')
p02779
n = int(eval(input())) a = list(map(int,input().split())) flag = False for i in range(n-1): for j in range (i+1,n): if a[i] == a[j]: flag = True break print(('YES' if flag == False else 'NO'))
n=int(eval(input())) a=[int(v) for v in input().split()] a.sort() kt=1 for i in range(0,n-1): if a[i]==a[i+1]: kt=0 break if kt==0: print("NO") else: print("YES")
p02779
N = int(eval(input())) A_List = list(map(int,input().split())) for i in range(N): for j in range(i+1,N): if A_List[i]==A_List[j]: print("NO") exit() print("YES")
N = int(eval(input())) A_List = list(map(int,input().split())) print(("YES" if len(A_List)==len(set(A_List)) else "NO"))
p02779
n=int(eval(input())) a=list(map(int,input().split())) print(('YES' if len(list(set(a)))==n else 'NO'))
n=int(eval(input())) a=list(map(int,input().split())) print(('YES' if len(set(a))==n else 'NO'))
p02779
N = int(eval(input())) List = [int(i) for i in input().split(" ")] flag = 0 for j in range(N-1): for k in range(j+1,N): if List[j]==List[k]: flag = 1 break if flag==1: break if flag==1: print("NO") else: print("YES")
N = int(eval(input())) List = [i for i in input().split(" ")] Dict = {} flag=0 for i in range(N): try: Dict[List[i]] += 1 except KeyError: Dict[List[i]] = 1 list2 = list(Dict.values()) for j in range(len(list2)): if list2[j]>1: flag=1 if flag==1: print("NO...
p02779
n = int(eval(input())) a = list(map(int,input().split())) status = 0 for i in range(n): if a.count(a[i]) != 1: status = 1 break else: pass if status == 0: print("YES") else: print("NO")
n = int(eval(input())) a = list(map(int,input().split())) b = set(a) if len(a) == len(b): print("YES") else: print("NO")
p02779
n = int(eval(input())) List = list(map(int, input().split())) ans = 'YES' for i in range(n - 1): for j in range(n - i - 1): if List[i] == List[i + j + 1]: ans = 'NO' break if ans == 'NO': break print(ans)
n = int(eval(input())) List = list(map(int, input().split())) Sorted = sorted(List) ans = 'YES' for i in range(n - 1): if Sorted[i] == Sorted[i + 1]: ans = 'NO' break print(ans)
p02779
a=int(eval(input())) b=list(map(int, input().split())) for i in b: if b.count(i)==1: continue elif b.count(i)>1: print('NO') break else: print('YES')
a=int(eval(input())) b=list(map(int, input().split())) if len(b) != len(set(b)): print('NO') else: print('YES')
p02779
n = int(eval(input())) l = list(map(int, input().split())) check = True for i in range(n): if l.count(l[i]) > 1: check = False break if check: print("YES") else: print("NO")
n = int(eval(input())) l = list(map(int, input().split())) m = list(set(l)) if len(l) == len(m): print("YES") else: print("NO")
p02779
N = int(eval(input())) A = list(map(int,input().split())) flg = 'YES' for i,a in enumerate(A): if a in A[i+1:]: flg = 'NO' break print(flg)
N = int(eval(input())) A = list(map(int,input().split())) X = set(A) if len(A) == len(X): print('YES') else: print('NO')
p02779
def main(): N = int(eval(input())) A = list(map(int,input().split())) count = 0 flag = False ''' for i in A: if(A.count(i) > 1): flag = True break if(flag): print('NO') else: print('YES') ''' for i in A: ...
def main(): N = int(eval(input())) A = list(map(int,input().split())) count = 0 flag = False set_A = set(A) if(len(set_A) == len(A)): print('YES') else: print('NO') ''' for i in A: if(A.count(i) > 1): flag = True ...
p02779
print((['YES','NO'][int(eval(input()))>len(set(map(int,input().split())))]))
print(('YNEOS'[int(eval(input()))>len(set(input().split()))::2]))
p02779
n = int(eval(input())) a = list(map(int, input().split())) ans = 'YES' for i in range(n): for j in range(i+1,n): if a[i] == a[j]: ans = 'NO' print(ans)
n = int(eval(input())) a = list(map(int, input().split())) b = set(a) if len(a) == len(b): print('YES') else: print('NO')
p02779
N=int(eval(input())) A=list(map(int,input().split())) s=0 for i in range(N-1): for j in range(i+1,N): if A[i]!=A[j]: s=s else: s+=1 if s!=0: print("NO") else: print("YES")
N=int(eval(input())) A=list(map(int,input().split())) n=len(set(A)) if N!=n: print("NO") else: print("YES")
p02779
n = int(eval(input())) import sys an = list(map(int, sys.stdin.readline().split())) for i in range(n): for j in range(i+1, n): if an[i] == an[j]: print('NO') exit(0) print('YES')
n = int(eval(input())) import sys an = list(map(int, sys.stdin.readline().split())) if len(set(an))==n: print('YES') exit(0) print('NO')
p02779
N = int(eval(input())) A = list(map(int, input().split())) check = [] for a in A: if not a in check: check.append(a) else: print('NO') break else: print('YES')
N = int(eval(input())) A = list(map(int, input().split())) if len(set(A)) == len(A): print('YES') else: print('NO')
p02779
import sys input = sys.stdin.readline N = int(eval(input())) a = list(map(int, input().split())) s = set() for x in a: if x in s: print("NO") exit(0) s.add(x) print("YES")
import sys input = sys.stdin.readline N = int(eval(input())) a = set(map(int, input().split())) if N == len(a): print("YES") else: print("NO")
p02779
n =int(eval(input())) # print(n) List=list(map(int,input().split())) count = 0 # print(List) # print(List[1]) for i in range(n): # print(List[i]) count += List.count(List[i]) # print(count) if count == n: print('YES') else: print('NO')
def has_duplicates(seq): return len(seq) != len(set(seq)) n =int(eval(input())) List=list(map(int,input().split())) if has_duplicates(List) == False: print('YES') else: print("NO")
p02779
n = int(eval(input())) a = list(map(int, input().split())) frag = False for i in range(n): for j in range(n): if i != j and a[i] == a[j]: frag = True if frag: print("NO") else: print("YES")
n = int(eval(input())) a = list(map(int, input().split())) b = set(a) if len(a) == len(b): print("YES") else: print("NO")
p02779
import sys, re, os from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians # from fractions import gcd from itertools import permutations, combinations, product, accumulate from operator import itemgetter, mul from copy import deepcopy from string ...
import sys, re, os from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians # from fractions import gcd from itertools import permutations, combinations, product, accumulate from operator import itemgetter, mul from copy import deepcopy from string ...
p02779
# -*- coding: utf-8 -*- import sys N = int(eval(input())) A = [int(i) for i in input().split()] for i in range(len(A)): a = A[i] for aa in A[i+1:]: if aa == a: print('NO') sys.exit() print('YES')
# -*- coding: utf-8 -*- import sys N = int(eval(input())) A = [int(i) for i in input().split()] dp = {} for a in A: if a-2 in dp: print('NO') break dp[a-2] = 1 else: print('YES')
p02779
def main(): n = int(eval(input())) vals = list(map(int, input().split())) flg = 0 for i in vals: if vals.count(i) > 1: flg += 1 break if flg == 0: print('YES') else: print('NO') if __name__ == "__main__": main()
def main(): n = int(eval(input())) vals = list(map(int, input().split())) flg = 0 vals.sort() for i in range(n-1): if vals[i] == vals[i + 1]: flg += 1 break if flg == 0: print('YES') else: print('NO') if __name__ == "__main__...
p02779
dic={} n=int(eval(input())) lis=list(map(int,input().split())) for i in range(len(lis)): if dic.get(lis[i],0)==0: dic[lis[i]]=1 else: print("NO") exit() print("YES")
n=eval(input()) l=list(map(int,input().split())) if len(l)==len(set(l)): print("YES") else:print("NO")
p02779
N=int(eval(input())) A=list(input().split()) X=0 for i in range(N): X+=A.count(A[i]) if X==N: print("YES") else: print("NO")
N=int(eval(input())) A=list(map(int, input().split())) if len(set(A))==len(A): print("YES") else: print("NO")
p02779
num = input() list = list(map(int,input().split())) flg = False for i in list: if list.count(i) >= 2: flg = True break print("NO") if flg else print("YES")
num = input() list = list(map(int,input().split())) list2 = set(list) print("YES") if len(list) == len(list2) else print("NO")
p02779
# -*- coding:utf-8 -*- n = int(eval(input())) numbers = [] for i in map(int,input().split()): numbers.append(i) a = sorted(list(set(numbers))) b = sorted(numbers) if a == b: print("YES") else: print("NO")
n = int(eval(input())) a = list(map(int, input().split())) b = list(set(a)) if sorted(a) == sorted(b): print('YES') else: print('NO')
p02779
def merge(array): mid = len(array) if mid > 1: mid = mid // 2 left = merge(array[:mid]) right = merge(array[mid:]) array = [] while len(left) != 0 and len(right) != 0: if left[0] == right[0]: print("NO") exit() ...
N = int(eval(input())) A = list(map(int, input().split())) ans = {} flag = 0 for i in A: if (ans.get(i) != None): flag = 1 break else: ans[i] = 1 if (flag == 0): print("YES") else: print("NO")
p02779