message
stringlengths
2
65.1k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
0
108k
cluster
float64
14
14
__index_level_0__
int64
0
217k
Provide tags and a correct Python 3 solution for this coding contest problem. An army of n droids is lined up in one row. Each droid is described by m integers a1, a2, ..., am, where ai is the number of details of the i-th type in this droid's mechanism. R2-D2 wants to destroy the sequence of consecutive droids of max...
instruction
0
76,254
14
152,508
Tags: binary search, data structures, two pointers Correct Solution: ``` #!/usr/bin/env python # coding=utf-8 n, m, k = map(int, input().split()) mCnt = 0; ans = [0] * m; start = 0 end = 0 Q = [[] for i in range(m)] for i in range(n): A = list(map(int, input().split())) z = 0 for j in range(m): whi...
output
1
76,254
14
152,509
Provide tags and a correct Python 3 solution for this coding contest problem. An army of n droids is lined up in one row. Each droid is described by m integers a1, a2, ..., am, where ai is the number of details of the i-th type in this droid's mechanism. R2-D2 wants to destroy the sequence of consecutive droids of max...
instruction
0
76,255
14
152,510
Tags: binary search, data structures, two pointers Correct Solution: ``` n,m,k=map(int,input().split()) q=0 rez=[0]*int(m) st=0 end=0 p=[[] for i in range(int(m))] for i in range(int(n)): a=list(map(int,input().split())) c=0 for ii in range(m): while p[ii] and p[ii][-1][0]<a[ii]: ...
output
1
76,255
14
152,511
Provide tags and a correct Python 3 solution for this coding contest problem. An army of n droids is lined up in one row. Each droid is described by m integers a1, a2, ..., am, where ai is the number of details of the i-th type in this droid's mechanism. R2-D2 wants to destroy the sequence of consecutive droids of max...
instruction
0
76,256
14
152,512
Tags: binary search, data structures, two pointers Correct Solution: ``` # ---------------------------iye ha aam zindegi--------------------------------------------- import math import random import heapq,bisect import sys from collections import deque, defaultdict from fractions import Fraction import sys import threa...
output
1
76,256
14
152,513
Provide tags and a correct Python 3 solution for this coding contest problem. An army of n droids is lined up in one row. Each droid is described by m integers a1, a2, ..., am, where ai is the number of details of the i-th type in this droid's mechanism. R2-D2 wants to destroy the sequence of consecutive droids of max...
instruction
0
76,257
14
152,514
Tags: binary search, data structures, two pointers Correct Solution: ``` from itertools import tee from sys import setrecursionlimit from sys import stdin setrecursionlimit(1000000007) _data = iter(stdin.read().split('\n')) def input(): return next(_data) class SegTree: def __init__(self, n, zero, f): ...
output
1
76,257
14
152,515
Provide tags and a correct Python 3 solution for this coding contest problem. An army of n droids is lined up in one row. Each droid is described by m integers a1, a2, ..., am, where ai is the number of details of the i-th type in this droid's mechanism. R2-D2 wants to destroy the sequence of consecutive droids of max...
instruction
0
76,258
14
152,516
Tags: binary search, data structures, two pointers Correct Solution: ``` n,m,k = map(int, input().split()) mCnt = 0 ans = [0]*m start = 0 end = 0 Q = [[] for i in range(m)] for i in range(n): A = list(map(int, input().split())) z = 0 for j in range(m) : while Q[j] and Q[j][-1][0] < A[j] : ...
output
1
76,258
14
152,517
Provide tags and a correct Python 3 solution for this coding contest problem. Little Lesha loves listening to music via his smartphone. But the smartphone doesn't have much memory, so Lesha listens to his favorite songs in a well-known social network InTalk. Unfortunately, internet is not that fast in the city of Eka...
instruction
0
76,274
14
152,548
Tags: implementation, math Correct Solution: ``` t, s, q = map(int, input().split()) cnt = 0 while s < t: s = s * q cnt += 1 print(cnt) ```
output
1
76,274
14
152,549
Provide tags and a correct Python 3 solution for this coding contest problem. Little Lesha loves listening to music via his smartphone. But the smartphone doesn't have much memory, so Lesha listens to his favorite songs in a well-known social network InTalk. Unfortunately, internet is not that fast in the city of Eka...
instruction
0
76,275
14
152,550
Tags: implementation, math Correct Solution: ``` __author__ = 'Алексей' T, S, q = map(int, input().split()) cnt, total = 1, q*S while total < T: cnt += 1 total *= q print(cnt) ```
output
1
76,275
14
152,551
Provide tags and a correct Python 3 solution for this coding contest problem. Little Lesha loves listening to music via his smartphone. But the smartphone doesn't have much memory, so Lesha listens to his favorite songs in a well-known social network InTalk. Unfortunately, internet is not that fast in the city of Eka...
instruction
0
76,277
14
152,554
Tags: implementation, math Correct Solution: ``` t,s,q=[int(j) for j in input().split()] k=s ans=0 q=q-1 while k<t: k=k+(k*q) ans=ans+1 print(ans) ```
output
1
76,277
14
152,555
Provide tags and a correct Python 3 solution for this coding contest problem. Little Lesha loves listening to music via his smartphone. But the smartphone doesn't have much memory, so Lesha listens to his favorite songs in a well-known social network InTalk. Unfortunately, internet is not that fast in the city of Eka...
instruction
0
76,278
14
152,556
Tags: implementation, math Correct Solution: ``` n,m,r=map(int,input().split());o=0 while(m<n): m*=r;o+=1 print(o) ```
output
1
76,278
14
152,557
Provide tags and a correct Python 3 solution for this coding contest problem. Little Lesha loves listening to music via his smartphone. But the smartphone doesn't have much memory, so Lesha listens to his favorite songs in a well-known social network InTalk. Unfortunately, internet is not that fast in the city of Eka...
instruction
0
76,281
14
152,562
Tags: implementation, math Correct Solution: ``` def mp(): return map(int,input().split()) def lt(): return list(map(int,input().split())) def pt(x): print(x) def ip(): return input() def it(): return int(input()) def sl(x): return [t for t in x] def spl(x): return x.split() def aj(liste, item): liste.append(item...
output
1
76,281
14
152,563
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Lesha loves listening to music via his smartphone. But the smartphone doesn't have much memory, so Lesha listens to his favorite songs in a well-known social network InTalk. Unfortunatel...
instruction
0
76,286
14
152,572
No
output
1
76,286
14
152,573
Provide tags and a correct Python 3 solution for this coding contest problem. Each month Blake gets the report containing main economic indicators of the company "Blake Technologies". There are n commodities produced by the company. For each of them there is exactly one integer in the final report, that denotes corres...
instruction
0
76,302
14
152,604
Tags: data structures, sortings Correct Solution: ``` '''class data: def __init__(self,a): self.data=a def qsort(self,l,r,reverse): if l>=r : return None ind=l i=l j=r key=self.data[l] while i<j : if reverse==1: whil...
output
1
76,302
14
152,605
Provide tags and a correct Python 3 solution for this coding contest problem. Each month Blake gets the report containing main economic indicators of the company "Blake Technologies". There are n commodities produced by the company. For each of them there is exactly one integer in the final report, that denotes corres...
instruction
0
76,303
14
152,606
Tags: data structures, sortings Correct Solution: ``` n,m = [int(i) for i in input().split()] a = list(map(int,input().split())) b = [] for i in range(m): t,r = [int(x) for x in input().split()] while len(b) > 0 and r >= b[-1][1]: b.pop() b.append([t,r]) t,r = 0, b[0][1] b.append([0,0]) f = sorted(a...
output
1
76,303
14
152,607
Provide tags and a correct Python 3 solution for this coding contest problem. Each month Blake gets the report containing main economic indicators of the company "Blake Technologies". There are n commodities produced by the company. For each of them there is exactly one integer in the final report, that denotes corres...
instruction
0
76,304
14
152,608
Tags: data structures, sortings Correct Solution: ``` def main(): from collections import deque n, m = map(int, input().split()) aa = list(map(int, input().split())) l = list(tuple(map(int, input().split())) for _ in range(m)) tmp, r0, t0 = [(0, 0)], 0, 0 for t, r in reversed(l): if r0 <...
output
1
76,304
14
152,609
Provide tags and a correct Python 3 solution for this coding contest problem. Each month Blake gets the report containing main economic indicators of the company "Blake Technologies". There are n commodities produced by the company. For each of them there is exactly one integer in the final report, that denotes corres...
instruction
0
76,305
14
152,610
Tags: data structures, sortings Correct Solution: ``` n, m = map(int, input().split()) a = list(map(int, input().split())) b = [] t = [] for i in range(m): x, y = map(int, input().split()) while len(t) > 0 and y >= t[-1][1]: t.pop() t.append([x, y]) x, y = 0, t[0][1] - 1 t.append([0, 0]) b = sorted(...
output
1
76,305
14
152,611
Provide tags and a correct Python 3 solution for this coding contest problem. Each month Blake gets the report containing main economic indicators of the company "Blake Technologies". There are n commodities produced by the company. For each of them there is exactly one integer in the final report, that denotes corres...
instruction
0
76,306
14
152,612
Tags: data structures, sortings Correct Solution: ``` from collections import * from sys import stdin def arr_inp(n): if n == 1: return [int(x) for x in stdin.readline().split()] elif n == 2: return [float(x) for x in stdin.readline().split()] else: return list(stdin.readline()[:-1...
output
1
76,306
14
152,613
Provide tags and a correct Python 3 solution for this coding contest problem. Each month Blake gets the report containing main economic indicators of the company "Blake Technologies". There are n commodities produced by the company. For each of them there is exactly one integer in the final report, that denotes corres...
instruction
0
76,307
14
152,614
Tags: data structures, sortings Correct Solution: ``` #------------------------template--------------------------# import os import sys from math import * from collections import * from fractions import * from bisect import * from heapq import* from io import BytesIO, IOBase def vsInput(): sys.stdin = open('input.t...
output
1
76,307
14
152,615
Provide tags and a correct Python 3 solution for this coding contest problem. Each month Blake gets the report containing main economic indicators of the company "Blake Technologies". There are n commodities produced by the company. For each of them there is exactly one integer in the final report, that denotes corres...
instruction
0
76,308
14
152,616
Tags: data structures, sortings Correct Solution: ``` def compress(ops): cops = [] for r, dir in ops: while cops and cops[-1][0] <= r: cops.pop() if not cops or cops[-1][1] != dir: cops.append((r, dir)) return cops def transform(lst, ops): mr, mdir = ops[0] ...
output
1
76,308
14
152,617
Provide tags and a correct Python 3 solution for this coding contest problem. Each month Blake gets the report containing main economic indicators of the company "Blake Technologies". There are n commodities produced by the company. For each of them there is exactly one integer in the final report, that denotes corres...
instruction
0
76,309
14
152,618
Tags: data structures, sortings Correct Solution: ``` import sys input = sys.stdin.buffer.readline n,m = map(int,input().split()) a = list(map(int,input().split())) s = [] for i in range(m): t,r = map(int,input().split()) t -= 1 r -= 1 while s and s[-1][1] <= r: # operation will get overwritten so r...
output
1
76,309
14
152,619
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Each month Blake gets the report containing main economic indicators of the company "Blake Technologies". There are n commodities produced by the company. For each of them there is exactly one i...
instruction
0
76,310
14
152,620
Yes
output
1
76,310
14
152,621
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Each month Blake gets the report containing main economic indicators of the company "Blake Technologies". There are n commodities produced by the company. For each of them there is exactly one i...
instruction
0
76,311
14
152,622
Yes
output
1
76,311
14
152,623
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Each month Blake gets the report containing main economic indicators of the company "Blake Technologies". There are n commodities produced by the company. For each of them there is exactly one i...
instruction
0
76,312
14
152,624
Yes
output
1
76,312
14
152,625
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Each month Blake gets the report containing main economic indicators of the company "Blake Technologies". There are n commodities produced by the company. For each of them there is exactly one i...
instruction
0
76,313
14
152,626
Yes
output
1
76,313
14
152,627
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Each month Blake gets the report containing main economic indicators of the company "Blake Technologies". There are n commodities produced by the company. For each of them there is exactly one i...
instruction
0
76,314
14
152,628
No
output
1
76,314
14
152,629
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Each month Blake gets the report containing main economic indicators of the company "Blake Technologies". There are n commodities produced by the company. For each of them there is exactly one i...
instruction
0
76,315
14
152,630
No
output
1
76,315
14
152,631
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Each month Blake gets the report containing main economic indicators of the company "Blake Technologies". There are n commodities produced by the company. For each of them there is exactly one i...
instruction
0
76,316
14
152,632
No
output
1
76,316
14
152,633
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Each month Blake gets the report containing main economic indicators of the company "Blake Technologies". There are n commodities produced by the company. For each of them there is exactly one i...
instruction
0
76,317
14
152,634
No
output
1
76,317
14
152,635
Provide tags and a correct Python 3 solution for this coding contest problem. n children are standing in a circle and playing a game. Children's numbers in clockwise order form a permutation a1, a2, ..., an of length n. It is an integer sequence such that each integer from 1 to n appears exactly once in it. The game ...
instruction
0
76,383
14
152,766
Tags: implementation Correct Solution: ``` R=lambda:map(int,input().split()) n,m=R() l=list(R()) a=[None]*n c =set(range(1, n + 1)) for i in range(m-1): j=l[i]-1 d=l[i+1]-l[i] if d<=0: d+=n if a[j]!=d: if a[j] or d not in c: print(-1) exit() a[j]=d ...
output
1
76,383
14
152,767
Provide tags and a correct Python 3 solution for this coding contest problem. n children are standing in a circle and playing a game. Children's numbers in clockwise order form a permutation a1, a2, ..., an of length n. It is an integer sequence such that each integer from 1 to n appears exactly once in it. The game ...
instruction
0
76,384
14
152,768
Tags: implementation Correct Solution: ``` n,m=map(int,input().split()) ans=[None]*n l=list(map(int,input().split())) for i in range(1,m): d=(l[i]-l[i-1])%n if d==0: d+=n if ans[l[i-1]-1]==None or ans[l[i-1]-1]==d: ans[l[i-1]-1]=d else: print(-1) quit() l=[i+1 for i in range(n)] for i in ans: if i in l: ...
output
1
76,384
14
152,769
Provide tags and a correct Python 3 solution for this coding contest problem. n children are standing in a circle and playing a game. Children's numbers in clockwise order form a permutation a1, a2, ..., an of length n. It is an integer sequence such that each integer from 1 to n appears exactly once in it. The game ...
instruction
0
76,385
14
152,770
Tags: implementation Correct Solution: ``` n, m = [int(i) for i in input().split()] l = [int(i) - 1 for i in input().split()] ans = [-1] * n for i in range(m - 1): t = (l[i + 1] - l[i]) % n if t == 0: t = n if ans[l[i]] != -1 and ans[l[i]] != t: print(-1) break ans[l[i]] = t else...
output
1
76,385
14
152,771
Provide tags and a correct Python 3 solution for this coding contest problem. n children are standing in a circle and playing a game. Children's numbers in clockwise order form a permutation a1, a2, ..., an of length n. It is an integer sequence such that each integer from 1 to n appears exactly once in it. The game ...
instruction
0
76,386
14
152,772
Tags: implementation Correct Solution: ``` n,m = map(int, input().split()) l = list(map(int, input().split())) a = [-1]*(n + 1) s = [True] + [False]*n for i in range(m - 1): curr = l[i + 1] - l[i] if curr <= 0: curr += n if a[l[i]] == curr: continue if s[curr] or a[l[i]] != -1: p...
output
1
76,386
14
152,773
Provide tags and a correct Python 3 solution for this coding contest problem. n children are standing in a circle and playing a game. Children's numbers in clockwise order form a permutation a1, a2, ..., an of length n. It is an integer sequence such that each integer from 1 to n appears exactly once in it. The game ...
instruction
0
76,387
14
152,774
Tags: implementation Correct Solution: ``` n, m = map(int, input().split()) a = list(map(int, input().split())) ans = [0] * (n + 1) for i in range(m - 1): pot = (a[i + 1] - a[i] + n) % n if pot == 0: pot = n if ans[a[i]] == 0 or ans[a[i]] == pot: ans[a[i]] = pot else: print(-1) exit(0) used = [False] * (n + 1) ...
output
1
76,387
14
152,775
Provide tags and a correct Python 3 solution for this coding contest problem. n children are standing in a circle and playing a game. Children's numbers in clockwise order form a permutation a1, a2, ..., an of length n. It is an integer sequence such that each integer from 1 to n appears exactly once in it. The game ...
instruction
0
76,388
14
152,776
Tags: implementation Correct Solution: ``` from sys import stdin, stdout n, m = map(int, stdin.readline().split()) position = list(map(int, stdin.readline().split())) ans = [0 for i in range(n + 1)] used = set() label = 1 for i in range(m - 1): if not ans[position[i]]: if not (position[i + 1] - position[i...
output
1
76,388
14
152,777
Provide tags and a correct Python 3 solution for this coding contest problem. n children are standing in a circle and playing a game. Children's numbers in clockwise order form a permutation a1, a2, ..., an of length n. It is an integer sequence such that each integer from 1 to n appears exactly once in it. The game ...
instruction
0
76,389
14
152,778
Tags: implementation Correct Solution: ``` n,m=map(int, input().split()) p=[0]*(n+1) seen=p.copy() l=list(map(int,input().split())) cnt=0 for i in range(m-1): d=(l[i+1]-l[i]+n)%n d= d if d!=0 else n if seen[d]==1 and p[l[i]]!=d: print(-1) quit() cnt+=1 if seen[d]==0 else 0 p[l[i]]=d ...
output
1
76,389
14
152,779
Provide tags and a correct Python 3 solution for this coding contest problem. n children are standing in a circle and playing a game. Children's numbers in clockwise order form a permutation a1, a2, ..., an of length n. It is an integer sequence such that each integer from 1 to n appears exactly once in it. The game ...
instruction
0
76,390
14
152,780
Tags: implementation Correct Solution: ``` from collections import defaultdict N, M = map(int, input().split()) L = list(map(int, input().split())) A = [-1 for _ in range(N)] U = defaultdict(bool) def solve(): for i in range(M - 1): cur = L[i] - 1 nxt = L[i + 1] - 1 delta = (nxt - cur) % N...
output
1
76,390
14
152,781
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. n children are standing in a circle and playing a game. Children's numbers in clockwise order form a permutation a1, a2, ..., an of length n. It is an integer sequence such that each integer fro...
instruction
0
76,391
14
152,782
Yes
output
1
76,391
14
152,783
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. n children are standing in a circle and playing a game. Children's numbers in clockwise order form a permutation a1, a2, ..., an of length n. It is an integer sequence such that each integer fro...
instruction
0
76,392
14
152,784
Yes
output
1
76,392
14
152,785
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. n children are standing in a circle and playing a game. Children's numbers in clockwise order form a permutation a1, a2, ..., an of length n. It is an integer sequence such that each integer fro...
instruction
0
76,393
14
152,786
Yes
output
1
76,393
14
152,787
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. n children are standing in a circle and playing a game. Children's numbers in clockwise order form a permutation a1, a2, ..., an of length n. It is an integer sequence such that each integer fro...
instruction
0
76,394
14
152,788
Yes
output
1
76,394
14
152,789
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. n children are standing in a circle and playing a game. Children's numbers in clockwise order form a permutation a1, a2, ..., an of length n. It is an integer sequence such that each integer fro...
instruction
0
76,395
14
152,790
No
output
1
76,395
14
152,791
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. n children are standing in a circle and playing a game. Children's numbers in clockwise order form a permutation a1, a2, ..., an of length n. It is an integer sequence such that each integer fro...
instruction
0
76,396
14
152,792
No
output
1
76,396
14
152,793
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. n children are standing in a circle and playing a game. Children's numbers in clockwise order form a permutation a1, a2, ..., an of length n. It is an integer sequence such that each integer fro...
instruction
0
76,397
14
152,794
No
output
1
76,397
14
152,795
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. n children are standing in a circle and playing a game. Children's numbers in clockwise order form a permutation a1, a2, ..., an of length n. It is an integer sequence such that each integer fro...
instruction
0
76,398
14
152,796
No
output
1
76,398
14
152,797
Provide tags and a correct Python 3 solution for this coding contest problem. A dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people model a dragon with bamboo strips and clothes, raise them with rods, and hold the rods high and low to resemble a flying dragon. A performer holding the rod low i...
instruction
0
76,423
14
152,846
Tags: dp Correct Solution: ``` import sys def solv(v): r = [] nr1 = 0 l = 0 for i in v: mx = l if i == 1: nr1 += 1 else: mx = l + 1 if nr1 > mx: mx = nr1 r.append(mx) l = mx return r f = sys.stdin n = int(f.readline(...
output
1
76,423
14
152,847
Provide tags and a correct Python 3 solution for this coding contest problem. A dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people model a dragon with bamboo strips and clothes, raise them with rods, and hold the rods high and low to resemble a flying dragon. A performer holding the rod low i...
instruction
0
76,424
14
152,848
Tags: dp Correct Solution: ``` #t=int(input()) t=1 for _ in range(t): n=int(input()) l=list(map(int,input().split())) dp=[[0 for j in range(4)] for i in range(n)] p1=[0]*(n+1) p2=[0]*(n+1) for i in range(n): p1[i+1]+=p1[i] p2[i+1]+=p2[i] if l[i]==1: p1[i+1]+=1...
output
1
76,424
14
152,849
Provide tags and a correct Python 3 solution for this coding contest problem. A dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people model a dragon with bamboo strips and clothes, raise them with rods, and hold the rods high and low to resemble a flying dragon. A performer holding the rod low i...
instruction
0
76,425
14
152,850
Tags: dp Correct Solution: ``` n = int(input()) A = list(map(int, input().split())) one = [0] two = [0] for i in A: one.append(one[-1]) two.append(two[-1]) if i == 1: one[-1] += 1 else: two[-1] += 1 rdp1 = [[1] * n for _ in range(n)] rdp2 = [[1] * n for _ in range(n)] for l in range(n): ...
output
1
76,425
14
152,851
Provide tags and a correct Python 3 solution for this coding contest problem. A dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people model a dragon with bamboo strips and clothes, raise them with rods, and hold the rods high and low to resemble a flying dragon. A performer holding the rod low i...
instruction
0
76,426
14
152,852
Tags: dp Correct Solution: ``` import sys def input(): return sys.stdin.buffer.readline().rstrip() n = int(input()) a = list(map(int, input().split())) ans = max(a.count(1), a.count(2)) #mixed case prefix = [0]*(n + 10) suffix = [0]*(n + 10) for i in range(n): if a[i] == 1: prefix[i + 1] = 1 a.reve...
output
1
76,426
14
152,853
Provide tags and a correct Python 3 solution for this coding contest problem. A dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people model a dragon with bamboo strips and clothes, raise them with rods, and hold the rods high and low to resemble a flying dragon. A performer holding the rod low i...
instruction
0
76,427
14
152,854
Tags: dp Correct Solution: ``` #Code by Sounak, IIESTS #------------------------------warmup---------------------------- import os import sys import math from io import BytesIO, IOBase from fractions import Fraction import collections from itertools import permutations from collections import defaultdict BUFSIZE = 8...
output
1
76,427
14
152,855
Provide tags and a correct Python 3 solution for this coding contest problem. A dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people model a dragon with bamboo strips and clothes, raise them with rods, and hold the rods high and low to resemble a flying dragon. A performer holding the rod low i...
instruction
0
76,428
14
152,856
Tags: dp Correct Solution: ``` #fek mikoni aslan lozoomi dare kasi tu in donya dustet dashtet bashe ?! #age are chera tanhayi ?!! #age na chera namordi ?!!! DP = [0] * 4 input() for x in map(int, input().split()): if x == 1 : DP[0] += 1 DP[2] += 1 else : DP[1] += 1 DP[3] += 1 ...
output
1
76,428
14
152,857
Provide tags and a correct Python 3 solution for this coding contest problem. A dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people model a dragon with bamboo strips and clothes, raise them with rods, and hold the rods high and low to resemble a flying dragon. A performer holding the rod low i...
instruction
0
76,429
14
152,858
Tags: dp Correct Solution: ``` # import sys # sys.stdin = open('in.txt', 'r') n = int(input()) a = list(map(int, input().split())) d = [0, 0, 0, 0] for i in range(n): if a[i] == 1: d[0] += 1 d[2] = max(d[2], d[1]) d[2] += 1 else: d[1] = max(d[1], d[0]) d[1] += 1 ...
output
1
76,429
14
152,859