message
stringlengths
2
67k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
463
109k
cluster
float64
19
19
__index_level_0__
int64
926
217k
Provide tags and a correct Python 3 solution for this coding contest problem. Petya and Vasya are tossing a coin. Their friend Valera is appointed as a judge. The game is very simple. First Vasya tosses a coin x times, then Petya tosses a coin y times. If the tossing player gets head, he scores one point. If he gets t...
instruction
0
32,795
19
65,590
Tags: brute force, implementation Correct Solution: ``` x,y,a,b = map(int,input().split(' ')) c = [] for p in range(a,x+1): for q in range(b,y+1): if(q<p): c.append((p,q)) print(len(c)) if c != []: for p in c : print(p[0],p[1]) ```
output
1
32,795
19
65,591
Provide tags and a correct Python 3 solution for this coding contest problem. Petya and Vasya are tossing a coin. Their friend Valera is appointed as a judge. The game is very simple. First Vasya tosses a coin x times, then Petya tosses a coin y times. If the tossing player gets head, he scores one point. If he gets t...
instruction
0
32,796
19
65,592
Tags: brute force, implementation Correct Solution: ``` alll = []; x, y, a, b = [int(x) for x in input().split()] for i in range(a, x+1): for j in range(b, y+1): if i > j: alll.append((i, j)) print(len(alll)) print("\n".join([" ".join([str(x) for x in v]) for v in alll])) ```
output
1
32,796
19
65,593
Provide tags and a correct Python 3 solution for this coding contest problem. Petya and Vasya are tossing a coin. Their friend Valera is appointed as a judge. The game is very simple. First Vasya tosses a coin x times, then Petya tosses a coin y times. If the tossing player gets head, he scores one point. If he gets t...
instruction
0
32,797
19
65,594
Tags: brute force, implementation Correct Solution: ``` import sys import math import collections import heapq import decimal input=sys.stdin.readline x,y,a,b=(int(i) for i in input().split()) ans=[] for i in range(b,y+1): for j in range(max(i+1,a),x+1): ans.append([j,i]) print(len(ans)) ans.sort() for i in...
output
1
32,797
19
65,595
Provide tags and a correct Python 3 solution for this coding contest problem. Petya and Vasya are tossing a coin. Their friend Valera is appointed as a judge. The game is very simple. First Vasya tosses a coin x times, then Petya tosses a coin y times. If the tossing player gets head, he scores one point. If he gets t...
instruction
0
32,798
19
65,596
Tags: brute force, implementation Correct Solution: ``` x,y,a,b=(map(int,input().split())) l=[] for i in range(a,x+1): for j in range(b,y+1): if i>j: l.append((i,j)) print(len(l)) for i in range(len(l)): print(*l[i]) ```
output
1
32,798
19
65,597
Provide tags and a correct Python 3 solution for this coding contest problem. Petya and Vasya are tossing a coin. Their friend Valera is appointed as a judge. The game is very simple. First Vasya tosses a coin x times, then Petya tosses a coin y times. If the tossing player gets head, he scores one point. If he gets t...
instruction
0
32,799
19
65,598
Tags: brute force, implementation Correct Solution: ``` a, b, c, d = map(int, input().split(' ')) ct = 0 ct2 = 0 badtoed= [] for i in range(1, a+1): for j in range(1, b+1): if i > j and i >= c and j >= d: badtoed.append(str(i) + ' ' + str(j)) ct += 1 print(ct) for i in badtoed: ...
output
1
32,799
19
65,599
Provide tags and a correct Python 3 solution for this coding contest problem. Petya and Vasya are tossing a coin. Their friend Valera is appointed as a judge. The game is very simple. First Vasya tosses a coin x times, then Petya tosses a coin y times. If the tossing player gets head, he scores one point. If he gets t...
instruction
0
32,800
19
65,600
Tags: brute force, implementation Correct Solution: ``` x, y, a, b = map(int, input().split()) n = 0 outcomes = [] for i in range(max(a, b + 1), x + 1): for j in range(b, min(i, y + 1)): n += 1 outcomes.append((i, j)) print (n) for a, b in outcomes: print (a, b) ```
output
1
32,800
19
65,601
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya and Vasya are tossing a coin. Their friend Valera is appointed as a judge. The game is very simple. First Vasya tosses a coin x times, then Petya tosses a coin y times. If the tossing play...
instruction
0
32,801
19
65,602
Yes
output
1
32,801
19
65,603
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya and Vasya are tossing a coin. Their friend Valera is appointed as a judge. The game is very simple. First Vasya tosses a coin x times, then Petya tosses a coin y times. If the tossing play...
instruction
0
32,802
19
65,604
Yes
output
1
32,802
19
65,605
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya and Vasya are tossing a coin. Their friend Valera is appointed as a judge. The game is very simple. First Vasya tosses a coin x times, then Petya tosses a coin y times. If the tossing play...
instruction
0
32,803
19
65,606
Yes
output
1
32,803
19
65,607
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya and Vasya are tossing a coin. Their friend Valera is appointed as a judge. The game is very simple. First Vasya tosses a coin x times, then Petya tosses a coin y times. If the tossing play...
instruction
0
32,804
19
65,608
Yes
output
1
32,804
19
65,609
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya and Vasya are tossing a coin. Their friend Valera is appointed as a judge. The game is very simple. First Vasya tosses a coin x times, then Petya tosses a coin y times. If the tossing play...
instruction
0
32,805
19
65,610
No
output
1
32,805
19
65,611
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya and Vasya are tossing a coin. Their friend Valera is appointed as a judge. The game is very simple. First Vasya tosses a coin x times, then Petya tosses a coin y times. If the tossing play...
instruction
0
32,806
19
65,612
No
output
1
32,806
19
65,613
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya and Vasya are tossing a coin. Their friend Valera is appointed as a judge. The game is very simple. First Vasya tosses a coin x times, then Petya tosses a coin y times. If the tossing play...
instruction
0
32,807
19
65,614
No
output
1
32,807
19
65,615
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petya and Vasya are tossing a coin. Their friend Valera is appointed as a judge. The game is very simple. First Vasya tosses a coin x times, then Petya tosses a coin y times. If the tossing play...
instruction
0
32,808
19
65,616
No
output
1
32,808
19
65,617
Provide tags and a correct Python 3 solution for this coding contest problem. Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it. Given a sequence a consisting of n integers. The player can make several steps. In ...
instruction
0
32,906
19
65,812
Tags: dp Correct Solution: ``` n = int(input()) l = list(map(int,input().split())) m = (10**5)+2 f = [0]*m for i in l : f[i] += 1 #print(f) dp = [0]*m #print(dp) dp[1] , dp[2] = f[1] , f[2]*2 for i in range(3,m): dp[i] +=max(dp[i - 2] , dp[i-3]) + (f[i]*i) #print(dp) print(max(dp)) ```
output
1
32,906
19
65,813
Provide tags and a correct Python 3 solution for this coding contest problem. Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it. Given a sequence a consisting of n integers. The player can make several steps. In ...
instruction
0
32,907
19
65,814
Tags: dp Correct Solution: ``` input() l = list(map(int,input().split())) # Get list of all numbers n = max(l)+1 # Determine length of cnt cnt = [0]*n # Initialize array cnt, used to store the count of every number in list l for i in l: cnt[i] += 1 # Calculate cnt # print(cnt) # # test = [] # # for i in range(n): # # ...
output
1
32,907
19
65,815
Provide tags and a correct Python 3 solution for this coding contest problem. Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it. Given a sequence a consisting of n integers. The player can make several steps. In ...
instruction
0
32,908
19
65,816
Tags: dp Correct Solution: ``` input() p = [0] * 100002 s = input().split() for k in s: p[int(k)] += 1 for i in range(1, 100002): p[i] = max(p[i-1], p[i-2] + i*p[i]) print(p[-1]) ```
output
1
32,908
19
65,817
Provide tags and a correct Python 3 solution for this coding contest problem. Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it. Given a sequence a consisting of n integers. The player can make several steps. In ...
instruction
0
32,909
19
65,818
Tags: dp Correct Solution: ``` #Dynamic Programming - Boredom # https://codeforces.com/problemset/problem/455/A?fbclid=IwAR2MNUknSk6z3fU7C29BR_QNN0R7mat-Ei2_lt24NAKypORavAWAMO_vMus import queue n = int(input()) def dp(n,countArr, arrDP): if arrDP[n] != -1: return arrDP[n] arrDP[n] = max(dp(n - 1,countA...
output
1
32,909
19
65,819
Provide tags and a correct Python 3 solution for this coding contest problem. Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it. Given a sequence a consisting of n integers. The player can make several steps. In ...
instruction
0
32,910
19
65,820
Tags: dp Correct Solution: ``` from collections import defaultdict n=int(input()) l=list(map(int,input().split())) d={} d=defaultdict(int) maxi=-99 for i in l: d[i]+=1 maxi=max(i,maxi) dp=[0]*(100001) dp[1]=d[1] for i in range(2,100000+1): dp[i]=max(dp[i-1],dp[i-2]+(d[i])*i) print(max(dp)) ```
output
1
32,910
19
65,821
Provide tags and a correct Python 3 solution for this coding contest problem. Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it. Given a sequence a consisting of n integers. The player can make several steps. In ...
instruction
0
32,911
19
65,822
Tags: dp Correct Solution: ``` import sys import math from collections import defaultdict,Counter # input=sys.stdin.readline # def print(x): # sys.stdout.write(str(x)+"\n") import os import sys from io import BytesIO, IOBase BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self....
output
1
32,911
19
65,823
Provide tags and a correct Python 3 solution for this coding contest problem. Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it. Given a sequence a consisting of n integers. The player can make several steps. In ...
instruction
0
32,912
19
65,824
Tags: dp Correct Solution: ``` n = int(input().strip()) l = [0]*100002 for x in input().split(): l[int(x)] += int(x) max = l[1] for i in range (2,len(l)): if l[i-2] + l[i] > max: max = l[i-2] + l[i] l[i] = max print (max) ```
output
1
32,912
19
65,825
Provide tags and a correct Python 3 solution for this coding contest problem. Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it. Given a sequence a consisting of n integers. The player can make several steps. In ...
instruction
0
32,913
19
65,826
Tags: dp Correct Solution: ``` n=int(input()) a=[int(x) for x in input().split()] l=[0]*(10**5+1) ma=0 for i in a: l[i]+=1 ma=max(ma,i) f=[0]*(ma+1) f[0]=0 f[1]=l[1] for i in range(2,ma+1): f[i]=max(f[i-1],f[i-2]+l[i]*i) print(f[ma]) ```
output
1
32,913
19
65,827
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it. Given a sequence a consisting of n i...
instruction
0
32,914
19
65,828
Yes
output
1
32,914
19
65,829
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it. Given a sequence a consisting of n i...
instruction
0
32,915
19
65,830
Yes
output
1
32,915
19
65,831
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it. Given a sequence a consisting of n i...
instruction
0
32,916
19
65,832
Yes
output
1
32,916
19
65,833
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it. Given a sequence a consisting of n i...
instruction
0
32,917
19
65,834
Yes
output
1
32,917
19
65,835
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it. Given a sequence a consisting of n i...
instruction
0
32,918
19
65,836
No
output
1
32,918
19
65,837
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it. Given a sequence a consisting of n i...
instruction
0
32,919
19
65,838
No
output
1
32,919
19
65,839
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it. Given a sequence a consisting of n i...
instruction
0
32,920
19
65,840
No
output
1
32,920
19
65,841
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it. Given a sequence a consisting of n i...
instruction
0
32,921
19
65,842
No
output
1
32,921
19
65,843
Provide tags and a correct Python 3 solution for this coding contest problem. It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh. In this game Mashmokh writes sequence of n distinct integers on the board. Then Bimokh makes several (possibly zero) moves. On the first move he removes ...
instruction
0
33,720
19
67,440
Tags: constructive algorithms, number theory Correct Solution: ``` """ Codeforces Round 240 Div 1 Problem C Author : chaotic_iak Language: Python 3.3.4 """ class InputHandlerObject(object): inputs = [] def getInput(self, n = 0): res = "" inputs = self.inputs if not inputs: inputs.ext...
output
1
33,720
19
67,441
Provide tags and a correct Python 3 solution for this coding contest problem. It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh. In this game Mashmokh writes sequence of n distinct integers on the board. Then Bimokh makes several (possibly zero) moves. On the first move he removes ...
instruction
0
33,721
19
67,442
Tags: constructive algorithms, number theory Correct Solution: ``` n,k = [int(i) for i in input().split()] if n==1 and k==0: print(1) elif n==1 and k>0: print(-1) elif k<n//2 : print(-1) elif n>=2: if n%2==0: m = n-2 summ = 0 st = 10**8 while(m>0): print(s...
output
1
33,721
19
67,443
Provide tags and a correct Python 3 solution for this coding contest problem. It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh. In this game Mashmokh writes sequence of n distinct integers on the board. Then Bimokh makes several (possibly zero) moves. On the first move he removes ...
instruction
0
33,722
19
67,444
Tags: constructive algorithms, number theory Correct Solution: ``` n, k = map(int, input().split()) ans = [(1000000000 - 2 * i, 1000000000 - 2 * i - 1) for i in range(n // 2 - 1)] + [(k - (n // 2 - 1), 2 * (k - (n // 2 - 1)))] if k < n // 2 or k > 0 and n == 1: print(-1) else: print(" ".join(["%d %d" % (ans[i][0], ...
output
1
33,722
19
67,445
Provide tags and a correct Python 3 solution for this coding contest problem. It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh. In this game Mashmokh writes sequence of n distinct integers on the board. Then Bimokh makes several (possibly zero) moves. On the first move he removes ...
instruction
0
33,723
19
67,446
Tags: constructive algorithms, number theory Correct Solution: ``` n,k=map(int,input().split()) if n//2>k or (k!=0 and n==1): print(-1) exit(0) ans=[0]*n ans[0]=k-n//2+1 if n>1: ans[1]=2*ans[0] for i in range(2,n): ans[i]=ans[i-1]+1 print(*ans) ```
output
1
33,723
19
67,447
Provide tags and a correct Python 3 solution for this coding contest problem. It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh. In this game Mashmokh writes sequence of n distinct integers on the board. Then Bimokh makes several (possibly zero) moves. On the first move he removes ...
instruction
0
33,724
19
67,448
Tags: constructive algorithms, number theory Correct Solution: ``` m,k = [int(x) for x in input().split()] n = m if m%2 == 1:n-=1 if m == 1: if k == 0:print(1) else : print(-1) elif k < n//2 : print(-1) else: x = k - (n//2 - 1) ans = [str(x),str(2*x)] i = 1 while len(ans) < m: ...
output
1
33,724
19
67,449
Provide tags and a correct Python 3 solution for this coding contest problem. It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh. In this game Mashmokh writes sequence of n distinct integers on the board. Then Bimokh makes several (possibly zero) moves. On the first move he removes ...
instruction
0
33,725
19
67,450
Tags: constructive algorithms, number theory Correct Solution: ``` n, k = map(int, input().split()) if k == 0 and n == 1: print(1) elif n // 2 > k or n == 1: print(-1) else: x = (k - n // 2 + 1) print(x, x * 2, *range(x * 2 + 1, x * 2 + 1 + n - 2)) # Made By Mostafa_Khaled ```
output
1
33,725
19
67,451
Provide tags and a correct Python 3 solution for this coding contest problem. It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh. In this game Mashmokh writes sequence of n distinct integers on the board. Then Bimokh makes several (possibly zero) moves. On the first move he removes ...
instruction
0
33,726
19
67,452
Tags: constructive algorithms, number theory Correct Solution: ``` n, k = tuple(map(int, input().split())) if n % 2: pairs = (n - 1) // 2 else: pairs = n // 2 if (pairs > k) or (not pairs and k > 0): print(-1) else: if pairs < k: answer = [k - pairs + 1] answer.append(answer[0] * 2) ...
output
1
33,726
19
67,453
Provide tags and a correct Python 3 solution for this coding contest problem. It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh. In this game Mashmokh writes sequence of n distinct integers on the board. Then Bimokh makes several (possibly zero) moves. On the first move he removes ...
instruction
0
33,727
19
67,454
Tags: constructive algorithms, number theory Correct Solution: ``` n, k = list(map(int, input().split())) if k == 0 and n == 1: print(777, end=' ') elif n//2 > k or n == 1: print(-1) exit() else: real = k - (n-2)//2 k -= real print(real*2, real, end=' ') # print(k) r = real*2+10 whi...
output
1
33,727
19
67,455
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh. In this game Mashmokh writes sequence of n distinct integers on the board. Then Bimokh makes several (poss...
instruction
0
33,728
19
67,456
Yes
output
1
33,728
19
67,457
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh. In this game Mashmokh writes sequence of n distinct integers on the board. Then Bimokh makes several (poss...
instruction
0
33,729
19
67,458
Yes
output
1
33,729
19
67,459
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh. In this game Mashmokh writes sequence of n distinct integers on the board. Then Bimokh makes several (poss...
instruction
0
33,730
19
67,460
Yes
output
1
33,730
19
67,461
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh. In this game Mashmokh writes sequence of n distinct integers on the board. Then Bimokh makes several (poss...
instruction
0
33,731
19
67,462
Yes
output
1
33,731
19
67,463
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh. In this game Mashmokh writes sequence of n distinct integers on the board. Then Bimokh makes several (poss...
instruction
0
33,732
19
67,464
No
output
1
33,732
19
67,465
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh. In this game Mashmokh writes sequence of n distinct integers on the board. Then Bimokh makes several (poss...
instruction
0
33,733
19
67,466
No
output
1
33,733
19
67,467
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh. In this game Mashmokh writes sequence of n distinct integers on the board. Then Bimokh makes several (poss...
instruction
0
33,734
19
67,468
No
output
1
33,734
19
67,469
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh. In this game Mashmokh writes sequence of n distinct integers on the board. Then Bimokh makes several (poss...
instruction
0
33,735
19
67,470
No
output
1
33,735
19
67,471
Provide tags and a correct Python 3 solution for this coding contest problem. Have you ever played Hanabi? If not, then you've got to try it out! This problem deals with a simplified version of the game. Overall, the game has 25 types of cards (5 distinct colors and 5 distinct values). Borya is holding n cards. The g...
instruction
0
33,736
19
67,472
Tags: bitmasks, brute force, implementation Correct Solution: ``` from itertools import combinations from copy import copy def variants(a): for i in range(6): for j in combinations(a, i): yield j def main(): input() cards = set((i[0], int(i[1])) for i in input().split()) ...
output
1
33,736
19
67,473
Provide tags and a correct Python 3 solution for this coding contest problem. Have you ever played Hanabi? If not, then you've got to try it out! This problem deals with a simplified version of the game. Overall, the game has 25 types of cards (5 distinct colors and 5 distinct values). Borya is holding n cards. The g...
instruction
0
33,737
19
67,474
Tags: bitmasks, brute force, implementation Correct Solution: ``` """ Codeforces Round 253 Div 1 Problem A Author : chaotic_iak Language: Python 3.3.4 """ def read(mode=2): # 0: String # 1: List of strings # 2: List of integers inputs = input().strip() if mode == 0: return inputs if m...
output
1
33,737
19
67,475
Provide tags and a correct Python 3 solution for this coding contest problem. Have you ever played Hanabi? If not, then you've got to try it out! This problem deals with a simplified version of the game. Overall, the game has 25 types of cards (5 distinct colors and 5 distinct values). Borya is holding n cards. The g...
instruction
0
33,738
19
67,476
Tags: bitmasks, brute force, implementation Correct Solution: ``` #!/usr/bin/python3 import sys n = int(sys.stdin.readline()) cards = list(set(sys.stdin.readline().split())) m = 10 # Minimal number of hints def count_ones(n): cnt = 0 while n > 0: if n & 1: cnt += 1 n //= 2 r...
output
1
33,738
19
67,477
Provide tags and a correct Python 3 solution for this coding contest problem. Have you ever played Hanabi? If not, then you've got to try it out! This problem deals with a simplified version of the game. Overall, the game has 25 types of cards (5 distinct colors and 5 distinct values). Borya is holding n cards. The g...
instruction
0
33,739
19
67,478
Tags: bitmasks, brute force, implementation Correct Solution: ``` n = int(input()) data = set(input().split()) temp = 'RGBYW' c = [] res = 10 for i in data: p1 = temp.find(i[0]) p2 = int(i[1]) - 1 c.append(2 ** p1 + 2 ** (p2 + 5)) for i in range(1024): ok = True for j in range(len(c) - 1): f...
output
1
33,739
19
67,479