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> using namespace std; typedef long long ll; #define rep(k,i,n) for(ll i=k;i<n;++i) int main(void){ ll a[10]; rep(0,i,9)cin>>a[i+1]; ll n; cin>>n; bool T[10]; rep(0,i,9)T[i+1]=false; rep(0,i,n){ ll b; cin>>b; rep(0,j,9)if(a[j+1]==b)T[j+1]=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
#include <bits/stdc++.h> using namespace std; int a[9]; bool bingo[9]; int direction[8][3] = { {0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {0, 3, 6}, {1, 4, 7}, {2, 5, 8}, {0, 4, 8}, {2, 4, 6}, }; int main(){ for(int i = 0; i < 9; i++) scanf("%d", &a[i]); int n; scanf("%d", &n); for(int i = 0; i < n; 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
import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] As = new int[9]; for(int i=0; i<9;i++) { As[i]= sc.nextInt(); } int b = sc.nextInt(); ArrayList<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.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int a[][]=new int[3][3]; boolean v[][]=new boolean[3][3]; for(int i=0;i<3;i++) { for(int j=0;j<3;j++) { a[i][j]=sc.nextInt(); } } int t =sc.nextInt(); while(t-->0) { int n =sc.nextInt(); for(int i=0;i<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
a1,a2,a3= map(int,input().split()) a4,a5,a6= map(int,input().split()) a7,a8,a9= map(int,input().split()) n=int(input()) b=[int(input()) for _ in range(n)] bing = [(a1,a2,a3),(a4,a5,a6),(a7,a8,a9), (a1,a4,a7),(a2,a5,a8),(a3,a6,a9), (a1,a5,a9),(a3,a5,a7)] for cs in bing: for c in cs: if not 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
a = [] for _ in range(3): a = a + [int(i) for i in input().split()] n = int(input()) a_bingo = [0] * 3 * 3 pos = [[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 _ in range(n): b = int(input()) if b in a: a_bingo[a.index(b)] = 1 for po in pos: if a_bingo[po[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
#include <bits/stdc++.h> using namespace std; int main(){ int N, i, j, k, A[3][3], C[3][3]={}, b; for(i=0; i<3; i++){ for(j=0; j<3; j++){ cin >> A[i][j]; } } cin >> N; for(k=0; k<N; k++){ cin >> b; for(i=0; i<3; i++){ for(j=0; j<3; j++){ if(A[i][j]==b){ C[i][j]=1; } } } } string ans="No"; if(C[0][0]*...
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 i,j,k,n,s=0,p=1, ans=0,a[3][3], b[3][3]; int main() { for(i = 0; i < 3;i++) for (j = 0; j < 3; j++) {scanf("%d",&a[i][j]);b[i][j] = 0;} scanf("%d",&n);int num[n]; for (i = 0; i < n; i++){scanf("%d",&num[i]); for (j = 0; j < 3; j++){ for(k = 0; k < 3; 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
A=[] B=[False]*9 for i in range(3): A+=[int(i) for i in input().split()] n=int(input()) for _ in range(n): b=int(input()) for i in range(9): if b==A[i]: B[i]=True C=[[1,2,3],[4,5,6],[7,8,9],[1,4,7],[2,5,8],[3,6,9],[1,5,9],[3,5,7]] ans=False for a,b,c in C: if B[a-1] and B[b-1] and 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
A = [list(map(int, input().split(' '))) for _ in range(3)] N = int(input()) B = set([int(input()) for _ 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 <= ...
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[9]; for(int i=0;i<9;i++){ int l; cin>>l; a[i]=l; } int n; cin>>n; int b[n]; for(int i=0;i<n;i++){ int l; cin>>l; b[i]=l; } for(int i=0;i<n;i++){ for(int j=0;j<9;j++){ if(b[i]==a[j])a[j]=0; } ...
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 = [] for _ in range(3): a1, a2, a3 = map(int, input().split()) A += [(a1, a2, a3)] n = int(input()) B = [] for _ in range(n): B += [int(input())] for i in range(3): A += [(A[0][i], A[1][i], A[2][i])] A += [(A[0][0], A[1][1], A[2][2])] A += [(A[0][2], A[1][1], A[2][0])] ans = 'No' for x in A: _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> #include<vector> using namespace std; int main() { int N; int A[3][3]; int i,j; for(i=0;i<3;i++)for(j=0;j<3;j++)cin >> A[i][j]; cin >> N; vector<bool> f(110,false); for(i=0;i<N;i++) { cin >> j; f[j] = true; } bool F = false,v,h; for(i=0;i<3;i++) { h = v = true; for...
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 = [] flag = 0 for i in range(3): for j in input().split(): l.append(j) n = int(input()) for i in range(n): a = input() if a in l: l[l.index(a)] = 0 if not any(l[0:3]) or not any(l[3:6]) or not any(l[6:9]): flag = 1 if not any(l[0::3]) or not any(l[1::3]) or not any(l[2::3]): flag = 1 if not any(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
a=[list(map(int,input().split())) for _ in range(3)] for i in range(int(input())): b=int(input()) for j in range(3): for k in range(3): if a[j][k]==b:a[j][k]=0 ans="No" for i in range(3): if a[0][i]==a[1][i]==a[2][i]==0:ans="Yes" if a[i][0]==a[i][1]==a[i][2]==0:ans="Yes" if a[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
#include <bits/stdc++.h> 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 n; cin>>n; int b[n]; for(int i=0;i<n;i++){ cin>>b[i]; for(int j=0;j<3;j++){ for(int k=0;k<3;k++){ if(b[i]==a[j][k]) a[j][k]=0; } ...
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() { int V[9], N, B; for (auto &v : V) cin >> v; cin >> N; while (cin >> B) for (int i = 0; i < 9; i++) if (V[i] == B) V[i] = 0; bool b = 0; if (!(V[0] + V[3] + V[6]) || !(V[1] + V[4] + V[7]) || !(V[2] + V[5] + V[8]) || !(V[0] + V[1] + V[2]) || !(V[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
import java.util.Scanner; //AtCoder Beginner Contest 157 //B Bingo 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] = Integer.parseInt(sc.next()); } int N = Integer.parseInt(sc.next()); boolean[] ...
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 scan = new Scanner(System.in); int[] a = new int[9]; boolean[] b = new boolean[9]; for (int i=0; i<9; i++){ a[i] = scan.nextInt(); b[i] = false; } int n = scan.nextInt(); for (int j=0; j<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
#include<bits/stdc++.h> using namespace std; int A[3][3],N,b; int main(){ for(int i=0;i<3;i++){ for(int j=0;j<3;j++){ cin>>A[i][j]; } } cin>>N; for(int i=0;i<N;i++){ cin>>b; for(int j=0;j<3;j++){ for(int k=0;k<3;k++){ if(A[j][k]==b)A[j][k]=0; } } } bool f=false; for(int i=0;i<3;i++){ 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
a = [input().split() for _ in range(3)] n = int(input()) b = [input() for _ in range(n)] p = [] p += a p += [list(a_) for a_ in zip(*a)] p += [[a[x][x] for x in range(3)]] p += [[a[x][2-x] for x in range(3)]] for p_ in p: for x in p_: if x in b: continue else: break els...
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[9]; for(int i=0;i<9;i++)cin>>a[i]; int n; cin>>n; int b[n]; for(int i=0;i<n;i++){ cin>>b[i]; for(int j=0;j<9;j++){ if(b[i]==a[j])a[j]=0; } } if(a[0]==a[1]&&a[1]==a[2] || a[3]==a[4]&&a[4...
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
f=lambda a:any(all(b)for b in a)|all(a[i][i]for i in(0,1,2)) *t,=map(int,open(0).read().split()) a=t[:9] s=eval('[0]*3,'*3) for b in t[10:]: if b in a: i=a.index(b) s[i//3][i%3]=1 print('NYoe s'[f(s)|f([t[::-1]for t in zip(*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
c = [] for _ in range(3): l = list(map(int, input().split())) c += l n = int(input()) for _ in range(n): m = int(input()) if m in c: c[c.index(m)]=0 if c[0]==c[1]==c[2]==0 or c[3]==c[4]==c[5]==0 or c[6]==c[7]==c[8]==0 or c[0]==c[3]==c[6]==0 or c[1]==c[4]==c[7]==0 or c[5]==c[8]==c[2]==0 or c[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
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int[][] array = new int[3][3]; String ans = "No"; for(int i = 0; i < 3; i++){ array[i][0] = Integer.parseInt(sc.next()); array[i][1] = Integer.parseInt(sc.next()); ...
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.List; import java.util.Scanner; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { List<Integer> bingo = new ArrayList<>(); for (int i = 0; i < 9; i++) { bingo.add(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; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner kb = new Scanner(System.in); int[] input = new int[9]; String k = "No"; for (int i = 0; i < 9; i++) { input[i] = kb.nextInt(); } int n = kb.nextInt(); int[] a = new 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 <bits/stdc++.h> #define rep(i,n) for(int i = 0; i < (n); ++i) using namespace std; int a[3][3]; int d[3][3]; int main() { rep(i,3)rep(j,3) cin >> a[i][j]; int n; cin >> n; rep(ni,n) { int x; cin >> x; rep(i,3)rep(j,3) if(a[i][j] == x) d[i][j] = 1; } bool ans = false; rep(i,3) { int cnt = 0; ...
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[9]; for (int i = 0; i < 9; i++) { A[i] = scanner.nextInt(); } final int N = scanner.nextInt(); int ana = 0; int b; 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.Scanner; 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(); for(int i = 0; i < n; i++){ int b = sc.nextInt(); for(int j = 0; ...
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) throws Exception { Scanner sc = new Scanner(System.in); int[][] A = new int[3][3]; boolean[][] plotA = new boolean[3][3]; for(int i=0;i<3;i++){ for(int j=0;j<3;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
import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Map<Integer, Integer> valToPlace= new HashMap<Integer, Integer>(); boolean[] bingo = new boolean[10]; for (int i=0; i<3; i++) { 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 i in range(3)] n=int(input()) for i in range(n): b=int(input()) for j in range(3): for k in range(3): if a[j][k]==b: a[j][k]=-1 ans='No' for i in a: if list(i)==[-1,-1,-1]: ans='Yes' for i in zip(*a): if list(i)==[-1,-1,-1]: ans='Yes' if a[0][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
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]; int count=0; 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 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
A=[list(map(int,input().split())) for i in range(3)] N=int(input()) B=[int(input()) for i in range(N)] x=[[0]*3 for i in range(3)] for b in B: for i,l in enumerate(A): for j,a in enumerate(l): if a==b: x[i][j]=1 print('Yes' if sum([all(l) for l in x]+[all(l) for l in zip(*x)]+[al...
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
#!/usr/bin/env python3 def func(a, i): return {a[0]:i, a[1]:i+1, a[2]:i+2} A = {} for i in range(3): A.update(func(input().split(), 3*i)) N = int(input()) b = [A.get(input(), -1) for _ in range(N)] 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]]...
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.Math; public class Main { public static void main(String args[]) { Scanner scan=new Scanner(System.in); int[][] a = new int[3][3]; int count=0; for(int i=0;i<3;i++) { for(int j=0;j<3;j++) { a[i][j]=scan.nextInt(); } } int n = s...
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(){ vector<int> a(9); int n; string ans = "No"; for(int i=0;i<9;i++){ cin >> a[i]; } cin >> n; vector<int> b(n); for(int i=0;i<n;i++){ cin >> b[i]; } for(int i=0;i<n;i++){ for(int j=0;j<9;j++){ if(b[i]!=a[j]){ }else{ ...
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
p1=list(map(int,input().split())) p2=list(map(int,input().split())) p3=list(map(int,input().split())) p=p1+p2+p3 n=int(input()) for _ in range(n): b=int(input()) if b in p: p[p.index(b)]=0 if p[0]+p[1]+p[2]==0 or p[3]+p[4]+p[5]==0 or p[6]+p[7]+p[8]==0 or p[0]+p[3]+p[6]==0 or p[1]+p[4]+p[7]==0 or p[2]+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
A = [list(map(int, input().split())) for _ in range(3)] N = int(input()) B = [int(input()) for _ in range(N)] ans = False for a in A: ans |= set(a) <= set(B) for i in range(3): ans |= set([A[0][i], A[1][i], A[2][i]]) <= set(B) ans |= set([A[0][0], A[1][1], A[2][2]]) <= set(B) ans |= set([A[0][2], 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
import java.util.BitSet; import java.util.Scanner; class Solver { static final Solver INSTANCE = new Solver(); void solve(Scanner sc) { int[] A = new int[9]; for (int i = 0; i < A.length; i++) { A[i] = sc.nextInt(); } int N = sc.nextInt(); int[] B = new int[N]; for (int i = 0; i < N; i++) { B[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> using namespace std; int a[3][3],b[3][3]; bool judge(){ for(int i=0;i<3;i++){ if(b[i][0]&&b[i][1]&&b[i][2]) return true; } for(int j=0;j<3;j++){ if(b[0][j]&&b[1][j]&&b[2][j]) return true; } if(b[0][0]&&b[1][1]&&b[2][2]) return true; if(b[0][2]&&b[1][1]&&b[2][0]) return true; return false;...
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
def ii():return int(input()) def mi():return map(int,input().split()) a=[] for _ in range(3): a+=list(mi()) n=ii() b=[] for i in range(n): b+=ii(), def ana(x): if x in b: return 1 else: return 0 c=[ana(aa) for aa in a] oks="012 345 678 036 147 258 048 246".split() for ok in oks: res=1 for j 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
#include<bits/stdc++.h> using namespace std; int main(){ int i,j,k,N,b; int flg=0; vector<vector<int>>A(3,vector<int>(3)),ch(3,vector<int>(3)); for(i=0;i<3;i++)for(j=0;j<3;j++)cin>>A[i][j]; cin>>N; 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)ch[j][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.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[][] a = new int[3][3]; boolean[][] c = new boolean[3][3]; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; 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
import java.util.Scanner; public class Main{ public static void main(String[]args){ Scanner scan = new Scanner(System.in); int[][] arr = new int[3][3]; int tmp,n; boolean flag; flag=false; for(int r=0;r<3;r++){ for(int c=0;c<3;c++){ arr[r][...
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()) L = [] L.append({a, b, c}) L.append({d, e, f}) L.append({g, h, i}) L.append({a, d, g}) L.append({b, e, h}) L.append({c, f, i}) L.append({a, e, i}) L.append({c, e, g}) N = int(input()) B = {int(input()) 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
import itertools A=[list(map(int,input().split())) for i in range(3)] A=list(itertools.chain.from_iterable(A)) N=int(input()) for _ in range(N): b=int(input()) try: A[A.index(b)]="X" except: continue answer="No" for bingo in [[0,1,2],[3,4,5],[6,7,8],[0,4,8],[2,4,6],[0,3,6],[1,4,7],[2,5,8]]: ...
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 i in range(3)] n = int(input()) q,l,r = 0,0,0 for _ in range(n): b = int(input()) for i in range(3): if b in a[i]: a[i][a[i].index(b)]=0 for i in range(3): l += a[i][i] t,y = 0,0 for j in range(3): y += a[j][i] t += a[i][j] if i+j...
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(); while (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.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] value = new int[9]; boolean[] flags = new boolean[9]; for(int i = 0; i < 9; i++) { value[i] = 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
A=[[-1 for i in range(3)] for j in range(3)] for i in range(3): A[i] = map(int, raw_input().split()) #print A N = int(raw_input()) B = [-1 for i in range(N)] for i in range(N): B[i] = int(raw_input()) #print B for i in range(N): for j in range(3): for k in range(3): if B[i] == A[j][...
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.*; class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] bingo = new int[9]; int[][] card = {{0,1,2},{3,4,5},{6,7,8},{0,3,6},{1,4,7},{2,5,8},{0,4,8},{2,4,6}}; boolean ok = false; for(int i = 0;i < 9;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
Flag = False A = [] for i in range(3): A.extend(list(map(int, input().split()))) N = int(input()) B = [int(input()) for i in range(N)] for i in B: if i in A: A[A.index(i)] = 0 for i in range(3): if A[i] + A[i+3] + A[i+6] == 0: Flag = True if A[3*i] + A[3*i+1] + A[3*i+2] == 0: Flag = True if A[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
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int an[9]; rep(i,9) cin >> an[i]; int n, b; cin >> n; int bn[9];rep(i,9) bn[i] = 0; rep(k,n) { cin >> b; rep(i,9) if (an[i] == b) bn[i] = 1; } bool flg = false; rep(i,3) { if (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
def bingo(C): if C[0]==C[1]==C[2] and C[0]==1: return True elif C[3]==C[4]==C[5] and C[3]==1: return True elif C[6]==C[7]==C[8] and C[6]==1: return True elif C[0]==C[3]==C[6] and C[0]==1: return True elif C[1]==C[4]==C[7] and C[1]==1: return True elif C[2]...
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
A = [None]*3 for i in range(3): A[i] = map(int, raw_input().split()) N = input() for _ in range(N): b = input() for y in range(3): for x in range(3): if A[y][x]==b: A[y][x] = 0 ans = "No" for y in range(3): if A[y]==[0, 0, 0]: ans = "Yes" for x in range(3): if [A[y][x] for y in range(3...
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; #define rep(i, n) for (int i = 0; i < (int)(n); i++) 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 (b == a[j]) a[j] = 0; } } if ((a[0] || a[1] || a[2]) && (a[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; int n,a[3][3]; bool v[100],l[3]={1,1,1},r[3]={1,1,1},ans=0; int main() { for(int i=0,j,x; i<3; ++i) for(j=0; j<3; ++j) scanf("%d",&a[i][j]); scanf("%d",&n); for(int i=1,x; i<=n; ++i) { scanf("%d",&x); v[x]=1; } for(int i=0,j; i<3; ++i) { for(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
#include <iostream> using namespace std; bool t; int i,j,k,n,a[10][10],b[101],c[10][10],s,s1; int main () { for (i=1;i<=3;i++) for (j=1;j<=3;j++) cin>>a[i][j]; cin>>n; for (i=1;i<=n;i++) cin>>b[i]; for (k=1;k<=n;k++) for (i=1;i<=3;i++) for (j=1;j<=3;j++) if (b[k]==a[i][j]) c[i][j]=1; if (c[1][1]+c[...
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
# template by 3xC and starkizard. # contributors: ##################################################################################### from __future__ import division, print_function import sys import os from collections import Counter, deque, defaultdict import itertools import math import io """Uncomment modul...
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.*; 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(); Map<Integer,Boolean> m=new HashMap<>(); for(int i=0;i<n;i++)m.put(sc.nextInt(),true); boolean b=false; ...
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 sheet[][] = new int[3][3]; for(int i = 0; i < 3; i++) for(int j = 0; j < 3; j++) sheet[i][j] = sc.nextInt(); int N = sc.nextInt(); for(int n = 0; n < N; n++){ int x = sc...
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 argc, char const *argv[]) { int a[9]; for (int i = 0; i < 9; ++i) { cin>>a[i]; } int n; cin>>n; int b,c[9]={}; for (int i = 0; i < n; ++i) { cin>>b; for (int j = 0; j < 9; ++j) { if (a[j]==b) { c[j]=1; } } } int f=0; 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> #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) using namespace std; int main(){ vector<int> bingo{0b111000000, 0b000111000, 0b000000111, 0b100100100, 0b010010010, 0b001001001, 0b100010001, 0b001010100}; vector<int> a(9); int n; rep(i,9)cin >> a.at(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<iostream> using namespace std; int main() { // 整数の入力 int a[9],n,b,c[9]; for(int i=0;i<9;i++){ cin >> a[i]; } cin >> n; for(int i=0;i<n;i++){ cin >> b; for(int j=0;j<9;j++){ if(a[j]==b){ c[j]=1; } } } string ...
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; 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 <iostream> using namespace std; static int card[100]; static int pattern[] ={ 0x07, 0x111, 0x38, 0x1a0, 0x54, 0x1c0, 0x49, 0x92, 0x124, }; int main(){ int val; int flg = 0; int shiftval = 0; for(int i=0;i<9;++i){ cin >> val; card[val] = 1 << shiftval; ++shiftval; } int n; cin >> 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 sc = new Scanner(System.in); int[][] A = new int[3][3]; boolean[][] flg = new boolean[3][3]; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { A[i][j] = sc.nextInt(); flg[i][j] = false; } ...
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> #define rep(i,n) for(int i=0;i<n;i++) using namespace std; int main(){ vector<vector<int>> vec(3,vector<int>(3)); rep(i,3){ rep(j,3) cin>>vec[i][j]; } int n,a; cin>>n; while(cin>>a){ rep(i,3){ rep(j,3){ if(vec[i][j]==a) vec[i][j]=0; } } } bool flag...
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(){ ios_base::sync_with_stdio(0); cin.tie(0); int n[9]; for(int i=0;i<9;i++)cin>>n[i]; int a;cin>>a; bool p[9]={0,0,0,0,0,0,0,0,0}; for(int i=0;i<a;i++){ int d;cin>>d; auto itr=find(n,n+9,d); if(itr!=end(n)) p[d...
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
f=lambda a:any(all(b)for b in a)|all(a[i][i]for i in(0,1,2)) a=eval('list(map(int,input().split())),'*3) exec('b=int(input());a=[[u*(u!=b)for u in t]for t in a];'*int(input())) a=[[not u for u in t]for t in a] print('NYoe s'[f(a)|f([t[::-1]for t in zip(*a)])::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 <iostream> #include <stdio.h> #define rep(i,min,sup) for(int i=min;i<sup;i++) #define per(i,min,sup) for(int i=(sup-1);i>=min;i--) #define swap(a,b) {a+=b;b=a-b;a-=b;} #define ll long long using namespace std; int main(){ int A[9]; rep(i,0,9)scanf("%d",&A[i]); int N,b,c=0; scanf("%d",&N); rep(i,0,...
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
arr = [] ans = [] for i in range(3): arr.extend(list(map(int,input().split()))) N = int(input()) for j in range(N): num = int(input()) if num in arr: ans.append(arr.index(num)) ans = set(ans) if (set([0,1,2])<=ans)or(set([3,4,5])<=ans)or(set([6,7,8])<=ans)or(set([0,3,6])<=ans)or(set([1,4,7])<=ans)or(set([2,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 <iostream> using namespace std; int main() { 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] = 0; break; } } } bool ans = false; for (int i = 0; i < 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
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]; boolean[][] S = new boolean[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...
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 keyboard = new Scanner(System.in); int[] A = new int[10]; for(int i=1; i<10; i++) { A[i] = keyboard.nextInt(); } int N = keyboard.nextInt(); int[] B = new int[N+1]; for(int j=1; j<N+1; j++) { B[...
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; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { vector<int> vec(9); rep(i,9){cin >> vec.at(i);} int N; int B; cin>>N; string flg="No"; rep(j,N){cin>>B; rep(i,9){if(vec.at(i)==B){vec.at(i)=0;} if((vec.at(0)+vec.at(1)+vec.at...
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> b; for(int i=0; i<9; i++){ int val; cin >> val; b.push_back(val); } int N; cin >> N; for(int i = 0; i<N; i++) { int val; cin >> val; for(int j = 0; j<9; j++){ if(b[j] == val) b[j]=0; } } ...
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> #include<cstdio> #include<string> using namespace std; int main(){ int A[3][3]; int N; int b; for(int i=0;i<3;i++) for(int j=0;j<3;j++) cin>>A[i][j]; cin>>N; string ans="No"; for(int k=0;k<N;k++){ cin>>b; for(int i=0;i<3;i++) for(int j=0;j<3;j++) if(A[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.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); String o="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=...
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) { Main main = new Main(); main.run(); } public void run() { Scanner sc = new Scanner(System.in); int A[][] = new int[3][3]; boolean c[][] = new boolean[3][3]; for(int i=0; i<3; i++) { for(int j=0; j<3; 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
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,4,6},{2,5,8},{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
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d, e, f, g, h, i; cin >> a >> b >> c >> d >> e >> f >> g >> h >> i; int n; cin >> n; vector<bool> bn(101); for (int j = 0; j < n; j++) { int t; cin >> t; bn[t] = true; } bool bingo = (bn[a] && bn[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); int[][] array = new int[3][3]; int sum = 0; for(int i = 0;i<3;i++) { for(int j = 0;j<3;j++) { array[i][j] = sc.nextInt(); } } int n = sc.nextInt(); int[] array2 = new 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 <bits/stdc++.h> using namespace std; #define REP(i,n) for(int i=0;i<n;i++) int a[3][3]; template<typename T> void fin(T a){ cout<<a<<endl; exit(0); } signed main(){ REP(i,3)REP(j,3)cin>>a[i][j]; int n;cin>>n; while(n--){ int s;cin>>s; REP(i,3)REP(j,3)if(a[i][j]==s)a[i][j]=0; } REP(i,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; int main(){ vector<int> a(9); for(int i=0;i<9;i++) cin>>a.at(i); vector<bool> c={0,0,0,0,0,0,0,0,0}; int n; cin>>n; for(int i=0;i<n;i++){ int b; cin>>b; for(int ia=0;ia<9;ia++) if(b==a.at(ia)) c.at(ia)=1; } bool bc=0; for(int 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
#include<stdio.h> int main(){ int a[3][3],c,b[8]={0},n; for(int i=0;i<3;i++) for(int f=0;f<3;f++) scanf("%d",&a[i][f]); scanf("%d",&n); for(int t=0;t<n;t++) { scanf("%d",&c); for(int i=0;i<3;i++) for(int f=0;f<3;f++) if(a[i][f]==c) a[i][f]=0; } 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
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() # index of A for _ in range(N): b = int(input()) if b in A: s |= {A.index(b)} # bingo index bingo = [{0, 1, 2}, {0, 3, 6}, {0, 4, 8}, {1, 4, 7}, {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
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(); boolean[][] bingo = new boolean[3][3]; int N = sc.nextInt(); for(int k=0; k<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 { static final int MOD=1000000007; 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(); ...
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 = [input().split() for _ in range(3)] N = int(input()) B = [input() for _ in range(N)] for i in range(3): for j in range(3): if A[i][j] in B: A[i][j] = 0 if A[0][0] == A[1][1] == A[2][2] or A[0][2] == A[1][1] == A[2][0]: print('Yes') exit() for n in range(3): if A[0][n] == A[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
B=[] for _ in range(3):B+=list(map(int,input().split())) S=set(int(input()) for _ in range(int(input()))) for i,b in enumerate(B): if b in S:B[i]=0 if B[0]+B[1]+B[2]==0 or B[3]+B[4]+B[5]==0 or B[6]+B[7]+B[8]==0 or B[0]+B[3]+B[6]==0 or B[1]+B[4]+B[7]==0 or B[2]+B[5]+B[8]==0 or B[0]+B[4]+B[8]==0 or B[2]+B[4]+B[6]==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
*t,=map(int,open(0).read().split()) a=t[:9] s={10} for b in t[10:]: if b in a:s|={a.index(b)} print('NYoe s'[any(s>={i*3,i*3+1,i*3+2}or s>={i,i+3,i+6}for i in(0,1,2))or s>={0,4,8}or s>={2,4,6}::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
import java.util.*; 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 l=0;l<3;l++){ A[i][l]=scan.nextInt(); } } int b = scan.nextIn...
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(); for (int i = 0; i < n; i++) { 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 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[100]; 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.*; 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++){ in...
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
L=[] for i in range(3): a,b,c=map(int,input().split()) L+=[a,b,c] N=int(input()) l= [int(input()) for i in range(N)] a=[0]*9 for i in l: for j in range(9): if i==L[j]: a[j]=1 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[...
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 = [] A.append(map(int, raw_input().split())) A.append(map(int, raw_input().split())) A.append(map(int, raw_input().split())) N = int(raw_input()) for i in range(N): b = int(raw_input()) for j in range(3): for k in range(3): if A[j][k] == b: A[j][k] = 0 flag = False ...
PYTHON