Search is not available for this dataset
name
stringlengths
2
112
description
stringlengths
29
13k
source
int64
1
7
difficulty
int64
0
25
solution
stringlengths
7
983k
language
stringclasses
4 values
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include<bits/stdc++.h> #define rep(i,n) for(int i = 0; i< (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main(){ vector<int> a(9); rep(i,9) cin >> a[i]; int n; cin >> n; rep(i,n){ int b; cin >> b; rep(j,9){ if(a[j]==b) a[j] = ...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import sys def main(): bingo = [] for i in range(3): line = sys.stdin.readline().rstrip('\n').split() bingo.append(line[0]) bingo.append(line[1]) bingo.append(line[2]) line = sys.stdin.readline().rstrip('\n') N = int(line) inputs = [] for i in range(N): ...
PYTHON
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
S="012 345 678 036 147 258 048 246 " A=[input().split()for i in range(3)] for b in [input()for i in range(int(input()))]: for l in range(9): S=S.replace(str([9,l][b==(A[0]+A[1]+A[2])[l]]),"") print(["No","Yes"][S.find(" ")>-1])
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.*; public class Main{ public static void main(String[] args){ Scanner scan = new Scanner(System.in); int bingo[] = new int [9]; boolean flag = false; //ビンゴカード作成 for(int i = 0; i < 9; i++){ bingo[i] = scan.nextInt(); } //ビンゴカード穴開け int N = scan.nextInt(); for(int k=0; k < N; k++)...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
A=[] for _ in range(3): A+=map(int,input().split()) N=int(input()) for _ in range(N): b=int(input()) if b in A: A[A.index(b)]=0 p=[ (0,1,2),(3,4,5),(6,7,8), (0,3,6),(1,4,7),(2,5,8), (0,4,8),(2,4,6), ] for i,j,k in p: if A[i]==A[j]==A[k]==0: print('Yes') break else: p...
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.*; import javax.lang.model.util.ElementScanner6; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); // 入力 int[] a = new int[9]; for(int i = 0; i < 9; i++){ a[i] = sc.nextInt(); } int[] ...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.Scanner; import java.util.ArrayList; class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); ArrayList <Integer> li = new ArrayList <Integer>(); ArrayList <Integer> lili = new ArrayList <Integer>(); for(int i=0;i<9;i++){ int a = sc.nextInt(); ...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
A=[] B=[] for i in range(3): A.extend(list(map(int,input().split()))) n=int(input()) for i in range(n): b=int(input()) try: A[A.index(b)]=0 except: continue if A[0]==A[1]==A[2] or A[3]==A[4]==A[5] or A[6]==A[7]==A[8] or A[0]==A[3]==A[6] or A[1]==A[4]==A[7] or A[2]==A[5]==A[8] or A[0]==A[4]==A[8] or A[...
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
a=[list(map(int,input().split())) for _ in range(3)] n=int(input()) b=[int(input())for _ in range(n)] for i in b: for j in range(3): for k in range(3): if i==a[j][k]:a[j][k]=0 ans="No" for i in range(3): if a[i][0]==a[i][1]==a[i][2]:ans="Yes" if a[0][i]==a[1][i]==a[2][i]:ans="Yes" if a[0][0]==a[1][1]==a...
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include<iostream> using namespace std; int main(){ int A[3][3],N,b[N]; for(int i=0; i<3; i++) for(int j=0; j<3; j++) cin>>A[i][j]; cin>>N; for(int r=0; r<N; r++){ int b; cin>>b; for(int i=0; i<3; i++){ for(int j=0; j<3; j++){ if(A[i][j]==b) A[i][j]=-1; } } } for(int...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include <bits/stdc++.h> using namespace std; int main() { vector<int> A(9); vector<bool> a(9); for(int i=0;i<9;i++)cin>>A[i]; for(int i=0;i<9;i++){ int b;cin>>b; for(int j=0;j<9;j++){ if(A[j]==b)a[j]=true; } } string ans="No"; if(a[0]&&a[1]&&a[2])ans="Yes"; if(a[3]&&a[4]&&a[5])ans="...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include <bits/stdc++.h> using namespace std; int main(){ vector<int>P={2,3,5,7,11,13,17,19,23}; int crtr=1; vector<int>A(9); for(int i=0;i<9;i++) {cin>>A[i];} int N; cin>>N; vector<int>B(N); for(int i=0;i<N;i++) {cin>>B[i];} for(int i=0;i<9;i++) {for(int j=0;j<N;j+...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
L=[list(map(int,input().split())) for _ in range(3)] N=int(input()) B=[int(input()) for _ in range(N)] for i in B: for j in range(3): for k in range(3): if i==L[j][k]: L[j][k]=0 T=False for i in range(3): if L[i][0]==L[i][1]==L[i][2]: T=True elif L[0][i]==L[1][i]==L[2][i]: T=True if L[0]...
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
A1=list(map(int, input().split())) A2=list(map(int, input().split())) A3=list(map(int, input().split())) A=A1+A2+A3 N=int(input()) s=set() for _ in range(N): b=int(input()) if b in A: s|={A.index(b)} bingo=[{0,1,2},{0,3,6},{0,4,8},{1,4,7},{2,5,8},{2,4,6},{3,4,5},{6,7,8}] print(['No','Yes'][any(s>=b for b in bin...
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.*; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[][] a = new int[3][3]; for (int i = 0;i<3 ;i++ ) { for (int j = 0;j<3 ;j++ ) { a[i][j] = sc.nextInt(); } } int n = sc.nextInt(); int[] data = new int[n]; for (int i =...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include <iostream> int main() { using namespace std; int a[9]; for (int i=0; i<9; i++){ cin >> a[i]; } int n, b; cin >> n; for (int j=0; j<n; j++) { cin >> b; for (int i=0; i<9; i++){ if (a[i] == b) { a[i] = -1; } } ...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int[][] a = new int [3][3]; for(int i = 0; i < 3; i++){ for(int j = 0; j < 3; j++){ a[i][j] = sc.nextInt(); } } int N = sc.nextInt(); ...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[][] A = new int[3][3]; for(int i =0; i<3 ; i ++) { for(int j =0; j<3 ; j ++) { A[i][j] = sc.nextInt(); } } int N = sc.nextInt(); int[] b = new int[N]; int[][] checkA = new i...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
a = list() a[0:2] = map(int, input().split()) a[3:5] = map(int, input().split()) a[6:8] = map(int, input().split()) n = int(input()) for i in range(n): b = int(input()) if b in a: a[a.index(b)] = 0 for i, j, k in ((0, 1, 2), (3, 4, 5), (6, 7, 8), (0, 3, 6), (1, 4, 7), (2, 5, 8), (0, 4, 8), (2, 4, 6)): ...
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include<bits/stdc++.h> using namespace std; int n; int a[5][5]; int row[5]; int col[5]; int dig[4]; int main(){ for(int i=1;i<=3;i++){ for(int j=1;j<=3;j++){ cin >> a[i][j]; } } cin >> n; bool dpt = 0; while(n--){ int x; cin >> x; for(int i=1;i<=3;i++){ for(int j=1;j<=3;j++){ if(a[i][j] ==...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int a[][] = new int[3][3]; for(int i = 0; i < 3; i++){ for(int j = 0; j < 3; j++){ a[i][j] = sc.nextInt(); } } int n = sc.nextInt(); ...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
row1 = map(int, raw_input().split()) row2 = map(int, raw_input().split()) row3 = map(int, raw_input().split()) n = input() state1 = [0,0,0] state2 = [0,0,0] state3 = [0,0,0] for i in range(n): x = input() if x in row1: xId = row1.index(x) state1[xId] = 1 if x in row2: xId = row2.i...
PYTHON
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[][] a = new int[3][3]; for(int i=0;i<3;i++) { for(int j=0;j<3;j++) { a[i][j] = sc.nextInt(); } } int n = sc.nextInt(); int b=0; for(int k=0;k<n;k++) { b = sc.n...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
a,b,c = map(int,input().split()) d,e,f = map(int,input().split()) g,h,i = map(int,input().split()) N = int(input()) X = [0] * 101 for k in range(N): t = int(input()) X[t] = 1 if X[a]*X[e]*X[i] == 1 or X[a]*X[b]*X[c] == 1 or X[d]*X[e]*X[f] == 1 or X[g]*X[h]*X[i] == 1 or X[a]*X[d]*X[g] == 1 or X[b]*X[e]*X[h] =...
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
A=[[int(x) for x in input().split()] for _ in range(3)] s=[[0 for i in range(3)] for j in range(3)] for i in range(int(input())): n=int(input()) for y in range(3): for x in range(3): if A[y][x]==n: s[y][x]=1 a=[] for i in range(3): a.append(s[0][i]*s[1][i]*s[2][i]) a.append(s[i][0]*s[i][1]*...
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
A = [] for i in range(3): A += list(map(int,input().split())) N = int(input()) B = [] for i in range(N): B.append(int(input())) B = set(B) c = [[0,0,0],[0,0,0],[0,0,0]] P = [{0,3,6},{1,4,7},{2,5,8},{0,1,2},{3,4,5},{6,7,8},{0,4,8},{2,4,6}] r = [] for i,a in enumerate(A): if a in B: r.append(i) r = ...
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include <bits/stdc++.h> using namespace std; int mp[3][3]; bool flag[3][3],check=false; int main(){ for(int i=0;i<3;i++) for(int j=0;j<3;j++){ cin>>mp[i][j]; } int n,a; cin>>n; for(int i=0;i<n;i++){ cin>>a; for(int i=0;i<3;i++) for(int j=0;j<3;j++){ if(a==mp[i][j]) flag[i][j]=true; } } for(int...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
a = [list(map(int, input().split())) for i in range(3)] n = int(input()) b = set(int(input()) for i in range(n)) def check(): for i in range(3): if all(a[i][j] in b for j in range(3)): return True if all(a[j][i] in b for j in range(3)): return True return all(a[i][i] in...
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
A = [] for _ in range(3): A += list(map(int, input().split())) N = int(input()) res = "No" for _ in range(N): b = int(input()) if b in A: ind = A.index(b) A[ind] = -1 if any(all(a==-1 for a in A[3*i:3*i+3])for i in range(3)): res = "Yes" if any(all(a==-1 for a in A[i::3])for i in range(3)): res = "Yes" i...
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include<iostream> #include<cstring> using namespace std; int main(){ int a[3][3]; for(int i=0;i<3;i++){ for(int j=0;j<3;j++){ cin>>a[i][j]; } } int b,d[5][5];cin>>b; memset(d,0,sizeof(d)); while(b--){ int c;cin>>c; for(int i=0;i<3;i++){ for(int j=0;j<3;j++){ if(c==a[i][j]) d[i][...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
S="012 345 678 036 147 258 048 246 " A=sum([input().split()for i in range(4)],[]) for b in [input()for i in range(int(A[9]))]: if b in A: S=S.replace(str(A.index(b)),"") print("NYoe s"[" "in S::2])
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include "bits/stdc++.h" #define rep(i,n) for(int i=0;i<n;i++) using namespace std; typedef long long ll; int main() { int A[3][3], N, b; rep(i, 3) rep(j, 3) cin >> A[i][j]; cin >> N; vector<vector<bool>> c(3, vector<bool>(3, false)); rep(i, N) { cin >> b; rep(j, 3) rep(k, 3) if (A[...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int[][] bingoPosList = { {0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {0, 3, 6}, {1, 4, 7}, ...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int A[9], N; bool X[9] = {false}; for(int i = 0; i < 9; ++i) cin >> A[i]; cin >> N; int b[N]; for(int i = 0; i < N; ++i) cin >> b[i]; // for(int i = 0; i < 9; ++i){ for(int j = 0; j < N; ++j){...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include <bits/stdc++.h> using namespace std; int a[9], n, k; int main() { for(int j=0; j<9; j++){ cin>>a[j]; } cin>>n; for(int i=0; i<n; i++){ cin>>k; for(int q=0; q<9; q++){ if(a[q]==k){ a[q]= 0; } } } if((a[0]==0&&a[3]==0&&a[6]==0)||(a[1]==0&&a[4]==0&&a[7]==0)||(a[2]...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
bingo = [[0,1,2],[3,4,5],[6,7,8],[0,3,6],[1,4,7],[2,5,8],[0,4,8],[2,4,6]] A = [] for _ in range(3): A.extend(list(map(int, input().split()))) N = int(input()) B = [int(input()) for i in range(N)] C = [0 for _ in range(9)] for bb in B: for i, aa in enumerate(A): if aa == bb: C[i] = 1 for bi in bingo: if C[bi[...
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
def is_b(l): return all([a[i][j] in b for i, j in l]) a = [list(map(int, input().split())) for i in range(3)] n = int(input()) b = [int(input()) for i in range(n)] t = [[(i, j) for j in range(3)] for i in range(3)] t += [[(j, i) for j in range(3)] for i in range(3)] t += [[(i, i) for i in range(3)]] + [[(2 - i, i)...
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.Scanner; // https://atcoder.jp/contests/abc157/tasks/abc157_b public class Main { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner sc = new Scanner(System.in); int[][] array = new int[3][3]; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { array[i][...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[][] card = new int[3][3]; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { card[i][j] = sc.nextInt(); } } int n = sc.nextInt(); for ...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[][] A = new int [3][3]; for(int i = 0; i < 3; i++) { for(int j = 0; j < 3; j++) { A[i][j] = sc.nextInt(); } } int N = sc.nextInt();...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for(int i=0;i<n;++i) #define rep1(i,n) for(int i=1;i<=n;++i) #define co(x) cout << (x) << "\n" #define cosp(x) cout<< (x) << " " int main(){ int a[3][3];rep(i,3)rep(j,3)cin>>a[i][j]; int n;cin>>n; rep(i,n){ int tmp...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner fsc = new Scanner(System.in); int[][] a = new int[3][3]; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { a[i][j] = fsc.nextInt(); } } ...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.*; import java.io.PrintWriter; public class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); int[][] a=new int[3][3]; for(int i=0; i<3; i++){ for(int j=0; j<3; j++){ a[i][j]=sc.nextInt(); } } int n=sc.nextInt(); boolean[][] ch=new boolean[3][3]; ...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
*a,=map(int,open(0).read().split());print('NYoe s'[any(t<=set(a.index(b)for b in a[10:])for t in({0,1,2},{0,3,6},{0,4,8},{1,4,7},{2,4,6},{2,5,8},{3,4,5},{6,7,8}))::2])
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include<bits/stdc++.h> using namespace std; int a[3][3],n,x; int main(){ for(int i=0;i<3;i++)for(int j=0;j<3;j++)scanf("%d",a[i]+j); scanf("%d",&n); for(int i=0;i<n;i++){ scanf("%d",&x); for(int i=0;i<3;i++)for(int j=0;j<3;j++)if(a[i][j]==x)a[i][j]=0; } for(int i=0;i<3;i++){ bool fl=1; for(int j=0;j<3;j++...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
A = [list(map(int, input().split())) for _ in range(3)] N = int(input()) b = [int(input()) for _ in range(N)] field = 0 for v in b: for i in range(9): if A[i // 3][i % 3] == v: field = field | (1 << i) ans = False for v in sum([[273,84],sum([[73<<i,7<<i*3]for i in range(3)],[])],[]): ans = ans or field&v==v; p...
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include <bits/stdc++.h> using namespace std; int main() { int dp[9]; int n,a,F =0; for(int i=0; i<9; i++) cin>>dp[i]; cin>>n; for(int i=0; i<n; i++) { cin>>a; for(int j=0; j<9; j++) if(dp[j]==a) dp[j]=0; } if(dp[0]==0&&dp[4]==0&&dp[8]==0) F=1; else if(dp[...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[][] bingo = new int[3][3]; for(int i = 0;i < 3;i++) { for(int j = 0;j < 3;j++) { bingo[i][j] = sc.nextInt(); } } int n = sc.nextInt(); for(int i = 0; i < n;i++) { ...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#!/usr/bin/env python from sys import stdin, stderr def check(A, B): S = set(B) # check each row for r in xrange(3): cnt = 0 for c in xrange(3): if A[r][c] in S: cnt += 1 if cnt == 3: return True # check each colum for c in xrange(3): cnt = 0 ...
PYTHON
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include<bits/stdc++.h> using namespace std; int b[3][3]; int main(){ int a[3][3]; for(int i=0;i<3;i++) for(int j=0;j<3;j++) cin>>a[i][j]; int n; cin>>n; for(int i=0;i<n;i++) { int h; cin>>h; for(int j=0;j<3;j++) { for(int k=0;k<3;k++) { if(a[j][k]==h) b[j][k]=1; } } } if(b[0][0]&&b...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include<bits/stdc++.h> int a[4][4],b,vis[4][4],n; int main() { for(int i=1;i<=3;++i) for(int j=1;j<=3;++j) scanf("%d",&a[i][j]); scanf("%d",&n); for(int _=1;_<=n;++_) { scanf("%d",&b); for(int i=1;i<=3;++i) for(int j=1;j<=3;++j) if(a[i][j]==b) vis[i][j]=1; } int f,g; for(int i=1;i<=3;++i) { f...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int[][] a = new int[3][3]; for(int i = 0;i<3;i++) { for(int j= 0;j<3;j++) { a[i][j] = scan.nextInt(); } } int n = scan.nextInt(); int[] b = new int[n]; int[][] che...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import sys A1=map(int, sys.stdin.readline().split()) A2=map(int, sys.stdin.readline().split()) A3=map(int, sys.stdin.readline().split()) A=A1+A2+A3 N=input() def isbingo(): if A[0]==A[1]==A[2]==0: return True elif A[3]==A[4]==A[5]==0: return True elif A[6]==A[7]==A[8]==0: return True elif A[0]==A[3]==A...
PYTHON
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ int[][] a = new int[3][3]; boolean[][] flag = new boolean[3][3]; Scanner sc = new Scanner(System.in); for(int i = 0 ; i < a.length; i++) { for(int j = 0; j < a[i].length;j++) { a[i][j] =...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include<bits/stdc++.h> using namespace std; int a[4][4],n,b; bool f[4][4]; int main(){ for(int i=1;i<=3;i++) for(int j=1;j<=3;j++) cin>>a[i][j]; cin>>n; for(int i=1;i<=n;i++){ cin>>b; for(int j=1;j<=3;j++) for(int k=1;k<=3;k++){ if(b==a[j][k]) f[j][k]=true; } } if((f[1][1]&&f[1][2]&&f[1][3...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include<bits/stdc++.h> using namespace std; bool k[10]; int b[11]; int main() { int a[10]; for(int i=1;i<=9;i++) cin>>a[i]; int n; cin>>n; for(int i=1;i<=n;i++) { cin>>b[i]; for(int j=1;j<=9;j++) { if(b[i]==a[j]) k[j]=true; } } if((k[1]==true&&k[2]==true&&k[3]==true)||(k[4]==true&&k[5]==true&&...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); List<Integer> a = new ArrayList<>(); for (int i = 0; i < 9; i++) { a.add(sc.nextInt()); } int N = sc.nextInt(); int res = 0; for ...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include<iostream> using namespace std; int main(){ int A[3][3],N,b[10],i,j,k,x=0; for(j=1;j<=3;j++){cin >> A[1][j];} for(j=1;j<=3;j++){cin >> A[2][j];} for(j=1;j<=3;j++){cin >> A[3][j];} cin >> N; for(k=1;k<=N;k++){cin >> b[k];} for(k=1;k<=N;k++){for(i=1;i<=3;i++){for(j=1;j<=3;j++){if(b[k]==A[i][j]){A[i][j]=0;}}}} fo...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include<iostream> using namespace std; int main() { int a[5][5],n,i,j,k; string ans; for(i=0;i<=2;i++){ cin >> a[i][0] >> a[i][1] >> a[i][2]; } cin >> n; int b,at[5][5] = {0}; for(i=0;i<n;i++){ cin >> b; for(j=0;j<3;j++){ for(k=0;k<3;k++){ if (a[j][k]==b) at[j][k]=1; } } } ans="No"; for(i...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner scanner = new Scanner(System.in); int card[][] = new int[3][3]; for(int i = 0;i < 3;i++){ for(int j = 0;j < 3;j++){ card[i][j] = scanner.nextInt(); } } boolean appears[][] = ne...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
A = [list(map(int, input().split())) for i in range(3)] N = int(input()) B = [int(input()) for i in range(N)] ans='No' for i in range(3): for j in range(3): if A[i][j] in B: A[i][j]=-1 for i in range(3): if sum(A[i])==-3: ans='Yes' if A[0][i]+A[1][i]+A[2][i]==-3: ans='Yes...
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String ans = "No"; int[][] A = new int[3][3]; for(int i = 0;i < 3;i++){ for(int j = 0;j < 3;j++){ A[i][j] = sc.nextInt(); } } int N = sc.nextInt(); for(...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
a = [list(map(int, input().split())) for row in range(3)] n = int(input()) b = [int(input()) for hoge in range(n)] a1 = a[0] + a[1] + a[2] c = [] for poge in a1: if poge in b: c.append(0) else: c.append(1) if min((c[0]+c[1]+c[2]),(c[3]+c[4]+c[5]),(c[6]+c[7]+c[8]),(c[0]+c[3]+c[6]), (c[1]+c[4]+c[7]),(c[...
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[][] A = new int[3][3]; for(int i=0;i<3;i++){ for(int j=0;j<3;j++){ A[i][j]=sc.nextInt(); } } int N = sc.nextInt(); for(int n=0;n<N;n++){ int...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import sys a1=[int(i) for i in input().split()] a2=[int(i) for i in input().split()] a3=[int(i) for i in input().split()] for l in sys.stdin: if int(l) in a1: a1[a1.index(int(l))]=0 elif int(l) in a2: a2[a2.index(int(l))]=0 elif int(l) in a3: a3[a3.index(int(l))]=0 m=sum(a1)*sum(a2)*sum(a3) for i in r...
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include<bits/stdc++.h> using namespace std; int main(){ int A[3][3]; bool B[3][3]={}; for(int i=0;i<3;i++)for(int j=0;j<3;j++)cin>>A[i][j]; int N;cin>>N; for(int i=0;i<N;i++){ int b;cin>>b; for(int i=0;i<3;i++)for(int j=0;j<3;j++)B[i][j]|=(b==A[i][j]); } long ans=0; for(int i=0;i<3;i++)ans|=(B[...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
A = [list(map(int, input().split(' '))) for i in range(3)] N = int(input()) B = set([int(input()) for i in range(N)]) X = [] X += [set(A[i]) for i in range(3)] X += [set([A[j][i] for j in range(3)]) for i in range(3)] X += [set([A[0][2], A[1][1], A[2][0]]), set([A[2][2], A[1][1], A[0][0]])] for x in X: if x <= B:...
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for(int i=0; i<n; i++) #define check(e,f,g) if(sheet.at(e-1)==0 && sheet.at(f-1)==0 && sheet.at(g-1) ==0) bingo = "Yes" int main(){ int N, b; vector<int> sheet(9); string bingo = "No"; rep(i,9){ cin >> sheet.at(i); } cin >> N; rep(i, N){...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int[][] a = new int[3][3]; String ans = "No"; for(int i=0 ; i<3 ; i++) { for(int j=0 ; j<3 ; j++) { a[i][j] = scanner.nextInt(); } } int n = scanner.nextInt(); ...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.Arrays; import java.util.Collections; import java.util.Scanner; public class Main { private static Scanner sc = new Scanner(System.in); static void p(String ans) {System.out.println(ans);}; static void p(int ans) {System.out.println(ans);}; static void p(long ans) {System.out.println(ans);}; publ...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int[][] a=new int[3][3]; for(int i=0;i<3;i++){ for(int j=0;j<3;j++){ a[i][j]=sc.nextInt(); } } int n=sc.nextInt(); int[] g=new int[n]; for(int i=0;i<n...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[][] A = new int[4][4]; int count =0; for (int i =1; i<=3; i++) { for (int j =1; j<=3; j++) { A[i][j] = sc.nextInt(); } } int N = sc.nextInt(); int[]...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include<iostream> using namespace std; int a[20]; bool n[101]; int main(){ for(int i=1;i<10;i++)cin>>a[i]; int N;cin>>N; int i; while(N--){ cin>>i; n[i]=1; } bool f=0; if(n[a[1]]){ if(n[a[2]]&&n[a[3]])f=1; if(n[a[4]]&&n[a[7]])f=1; if(n[a[5]]&&n[a[9]])f=1; } if(n[a[5]]){ if(n[a[4]]&&n[a[6]])f=1; ...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import sys a=[] for i in range(3): a+=list(map(int,input().split())) n=int(input()) b=[] for i in range(n): b.append(int(input())) x=[[1,2,3],[4,5,6],[7,8,9],[1,4,7],[2,5,8],[3,6,9],[1,5,9],[3,5,7]] for i in range(8): if a[x[i][0]-1] in b and a[x[i][1]-1] in b and a[x[i][2]-1] in b: print("Yes") ...
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.*; import java.lang.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int[][] A = new int[4][4]; for( int i=1; i<=3; i++ ){ for( int k=1; k<=3; k++ ){ A[i][k] = sc.nextInt(); } } int N = sc.nextInt(); int[] B = new int[N]; for( ...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include <bits/stdc++.h> using namespace std; int main(){ int a[9],n,b[10]; for(int i=0; i<9; i++){ cin >> a[i]; } cin >> n; for(int i=0; i<n; i++){ cin >> b[i]; } bool f[9]; for(int i=0; i<9; i++){ f[i] = false; for(int j=0; j<n; j++){ if (a[i] == b[j]){ f[i] = true; ...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner scanner = new Scanner(System.in); int[][][] card = new int[3][3][2]; for(int i = 0; i < 3; i++){ String line = scanner.nextLine(); String[] ss = line.split(" "); for(int j = 0; j ...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int A[][] = new int[3][3]; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { A[i][j] = sc.nextInt(); } } int N = sc.nextInt(); int b[] = new int[N]; for (int k ...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); int [][] a = new int[3][3]; for(int i = 0; i < 3; i++) { for(int j = 0; j < 3; j++) { a[i][j] = stdIn.nextInt(); } } boolean [][] flag = new boolean[3][3]; i...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
B1 = list(map(int, input().split())) B2 = list(map(int, input().split())) B3 = list(map(int, input().split())) B= B1+B2+B3 N = int(input()) for n in range(N): num = int(input()) B = [0 if i == num else i for i in B] if (B[0]+B[1]+B[2])*(B[3]+B[4]+B[5])*(B[6]+B[7]+B[8])*(B[0]+B[3]+B[6])*(B[1]+B[4]+B[7])*(B[2]+B[5]...
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include<bits/stdc++.h> using namespace std; int X[3][3]; bool XX[3][3]; int main() { for(int i=0;i<3;i++) for(int j=0;j<3;j++) cin>>X[i][j]; int N; cin>>N; while(N--) { int x; cin>>x; for(int i=0;i<3;i++) for(int j=0;j<3;j++) if(X[i][j]==x) XX[i][j]=true; } f...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); int[][] a=new int[3][3]; for(int i=0;i<3;i++){ for(int j=0;j<3;j++){ a[i][j]=sc.nextInt(); } } int n=sc.nextInt(); int[] c=new int[n]; for(int i=0;i<n;i++)...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.*; import java.lang.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int[] A = new int[9]; for( int i=0; i<9; i++ ){ A[i] = sc.nextInt(); } int N = sc.nextInt(); int[] B = new int[N]; for( int i=0; i<N; i++ ){ B[i] = sc.nextInt(); ...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
A = [list(map(int, input().split())) for _ in range(3)] N = int(input()) b = [int(input()) for _ in range(N)] f=0 for v in b: for i in range(9): if A[i // 3][i % 3] == v: f|=1<<i ans = 0 for v in [7,56,73,84,146,273,292,448]: ans |= f&v==v; print('Yes' if ans else 'No')
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define all(obj) (obj).begin(),(obj).end() int main(){ cin.tie(0); ios::sync_with_stdio(false); int a[3][3]; rep(i,3)rep(j,3)cin>>a[i][j]; int n;cin>>n; rep(i,n){ int tmp; cin>>tmp; rep(k,3)rep(j,3)if(a[k]...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.*; public class Main { Scanner sc = new Scanner(System.in); final int MOD = 1000000007; final int MAX = Integer.MAX_VALUE; final long LMAX = Long.MAX_VALUE; int LEN = (int)1e6 + 1; void doIt() { int[] A = new int[9]; for(int i = 0; i < 9; i++) { A[i] = sc.nextInt(); } int N = sc.nex...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.*; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[][] array = new int[3][3]; for(int i = 0; i<3; i++){ for(int j = 0; j<3; j++){ array[i][j] = sc.nextInt(); } } int n = sc.nextInt(); int[] rows = new int[3]; int[] cols = ne...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include <iostream> using namespace std; int main() { int a[3][3]; for (auto &i : a) for (int &j : i) cin >> j; int n; cin >> n; for (int i = 0; i < n; ++i) { int b; cin >> b; for (auto &j : a) for (int &k : j) if (k == b) k = 0; } for (int i = 0; i < 3; ++i) { if (!(a[i][0] || a[i][1] |...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include <bits/stdc++.h> int a[4][4], b[4][4]; int n; bool stat = false; int main(){ for(int i=1;i<=3;i++){ for(int j=1;j<=3;j++) scanf("%d",&a[i][j]), b[i][j] = 0; } scanf("%d",&n); for(int i=1;i<=n;i++){ int t; scanf("%d",&t); for(int i=1;i<=3;i++) for(int j=1;j<=3;j++) if(a[i][j] == t) b[i][j] = 1; } ...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include <bits/stdc++.h> using namespace std; int vis[4][4]; int main() { int a[4][4]; for(int i=1;i<=3;i++) for(int j=1;j<=3;j++) cin>>a[i][j]; int n; cin>>n; int flag=0; while(n--){ int x; cin>>x; for(int i=1;i<=3;i++) for(int j=1;j<=3;j++) if(a[i][j]==x) vis[i][j]=1; } for(int i=1;i<=3;i++){ int ...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include <bits/stdc++.h> using namespace std; int main() { vector<int> A(9); for(int i=0;i<9;i++){ cin >> A[i]; } int N ; cin >> N; vector<int> B(N); for(int i=0;i<N;i++){ cin >> B[i]; } vector<int> q(9,-1) ; for(int i=0;i<N;i++){ for(int j=0;j<9;j++){ if(B[i] == A[j]) q[j+1] = j+1; ...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
al=list(map(int,input().split()))+list(map(int,input().split()))+list(map(int,input().split())) n=int(input()) bl=[int(input()) for _ in [0]*n] for i in bl: for j in range(9): if al[j] == i: al[j] = 0 nobingo = (al[0]+al[1]+al[2])*(al[3]+al[4]+al[5])*(al[6]+al[7]+al[8])*(al[0]+al[3]+al[6])*(al[1]+al[4]+al[7...
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for(int i = 0; i < (int)(n); i++) typedef long long ll; int main() { vector<int> A(101); rep(i, 9) { int a; cin >> a; A[a] = i + 1; } int n; cin >> n; vector<int> cnt(10); rep(i, n) { int b; cin >> b; cnt[A[b]]++; ...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); // boolean flag = false; int[] a = new int[3 * 3]; // String s = sc.next(); // int cnt = 1; for (int i = 0; i < 9; i++) { a[i] = ...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; public class Main { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int[][] a = new int[3][3]; for(int i=0; i<3; i++) { ...
JAVA
p02895 AtCoder Grand Contest 039 - Pairing Points
There are 2N points generally positioned on the circumference of a circle, numbered 1,\dots,2N in counterclockwise order. Here, a set of points is said to be generally positioned if, for any six distinct points U, V, W, X, Y, and Z among them, the segments UV, WX, and YZ do not intersect at the same point. Additionally...
6
0
/* `-:://:::- `//:-------:/:` ...
CPP
p02895 AtCoder Grand Contest 039 - Pairing Points
There are 2N points generally positioned on the circumference of a circle, numbered 1,\dots,2N in counterclockwise order. Here, a set of points is said to be generally positioned if, for any six distinct points U, V, W, X, Y, and Z among them, the segments UV, WX, and YZ do not intersect at the same point. Additionally...
6
0
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll mem[45][45][45]; int G[45][45]; ll dp(int s, int t, int u){ if (s == u) return 1; else if (s == t || t == u) return 0; if (mem[s][t][u] != -1) return mem[s][t][u]; //printf("%d %d %d\n",s,t,u); ll ans = 0; for (int p1 = s; p1...
CPP
p02895 AtCoder Grand Contest 039 - Pairing Points
There are 2N points generally positioned on the circumference of a circle, numbered 1,\dots,2N in counterclockwise order. Here, a set of points is said to be generally positioned if, for any six distinct points U, V, W, X, Y, and Z among them, the segments UV, WX, and YZ do not intersect at the same point. Additionally...
6
0
#include<bits/stdc++.h> #define ld double #define ull unsigned long long #define ll long long #define pii pair<int,int > #define iiii pair<int,pii > #define mp make_pair #define INF 1000000000 #define MOD 1000000007 #define rep(i,x) for(int (i)=0;(i)<(x);(i)++) inline int getint(){ int x=0,p=1;char c=getchar(); while...
CPP
p02895 AtCoder Grand Contest 039 - Pairing Points
There are 2N points generally positioned on the circumference of a circle, numbered 1,\dots,2N in counterclockwise order. Here, a set of points is said to be generally positioned if, for any six distinct points U, V, W, X, Y, and Z among them, the segments UV, WX, and YZ do not intersect at the same point. Additionally...
6
0
#include<cstdio> #include<cstring> #define int long long int f[50][50][50],n,N,ans; char s[50][50]; int dp(int l,int r,int mid){ if(f[l][r][mid]!=-1)return f[l][r][mid]; if(l==r)return f[l][r][mid]=1; if(l==mid||mid==r)return f[l][r][mid]=0; int ans=0; for(int j=l;j<=mid-1;j++) for(int k=mid+1;k<=r;k++) if(s[...
CPP
p02895 AtCoder Grand Contest 039 - Pairing Points
There are 2N points generally positioned on the circumference of a circle, numbered 1,\dots,2N in counterclockwise order. Here, a set of points is said to be generally positioned if, for any six distinct points U, V, W, X, Y, and Z among them, the segments UV, WX, and YZ do not intersect at the same point. Additionally...
6
0
#include <cstdio> #include <cstdlib> #include <iostream> #include <cmath> #include <string> #include <cstring> #include <ctime> #include <algorithm> #define N 45 typedef long long ll; template <typename T> inline void read(T &x) { x = 0; char c = getchar(); bool flag = false; while (!isdigit(c)) { if (c == '-') flag ...
CPP