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; int main() { int a[3][3],b[10]; for(int i=0;i<3;++i) for(int j=0;j<3;++j) cin>>a[i][j]; map<int,int>m; int n; cin>>n; for(int i=0;i<n;++i){ cin>>b[i]; m[b[i]]=1; } int k=0; for(int i=0;i<3;++i){ if(m...
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=[[int(i) for i in input().split(" ")]for k in range(3)] N=int(input()) for i in range(N): b=int(input()) for x,y in [(x,y) for x in range(3) for y in range(3) if A[x][y]==b]: A[x][y]=0 M=1 for k in range(3): M*=sum(A[i][k] for i in range(3)) M*=sum(A[k][i] for i in range(3)) M*=sum(A[i][i] fo...
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()) b = [int(input()) for i in range(n)] b = set(b) g = [0]*9 for i in range(3): for j in range(3): if a[i][j] in b: g[i*3+j] = 1 for i,j,k in [[0,3,6],[1,4,7],[2,5,8],[0,4,8],[2,4,6],[0,1,2],[3,4,5],[6,7,8]]: if g[i]==g[j]==g[k]==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 A = [] for _ in range(3): A += [list(map(int, input().split()))] import copy B = copy.deepcopy(A) for i in range(3): B += [[A[0][i], A[1][i], A[2][i]]] B += [[A[0][0], A[1][1], A[2][2]]] B += [[A[0][2], A[1][1], A[2][0]]] B = [set(b) for b in B] N = int(input()) bs = [] for _ in range(N): bs += [int(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> using namespace std; int A[3][3],N,b; bool a[3][3]; int main(){ for(int i=0;i<9;i++){cin>>A[i/3][i%3];a[i/3][i%3]=false;} cin>>N; for(int i=0;i<N;i++){ cin>>b; for(int j=0;j<9;j++)if(A[j/3][j%3]==b)a[j/3][j%3]=true; } if((a[0][0]&&a[0][1]&&a[0][2])||(a[1][0]&&a[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 mat[3][3]; int vis[3][3]; int main() { for(int i = 0; i < 3; i++) for(int j = 0; j < 3; j++) scanf("%d", &mat[i][j]); int n; scanf("%d", &n); while(n--) { int x; scanf("%d", &x); for(int i = 0; i < 3; i++) for(int j = 0; j < 3; j++) if(mat[i][j] == x) v...
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,c = [int(x) for x in input().split()] d,e,f = [int(x) for x in input().split()] g,h,i = [int(x) for x in input().split()] n = int(input()) S = {int(input()) for x in range(n)} def q(x,y,z): return x in S and y in S and z in S print('Yes' if q(a,b,c) or q(d,e,f) or q(g,h,i) or q(a,d,g) or q(b,e,h) or q(c,f,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.*; 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(); } } int N = stdIn.nextInt(); for(int k=0;k<N;k++){ int b = stdIn.nextInt(); fo...
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 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]) b = 1; if (!V[1] && !V[4] && !V[7]) b = 1; if (!V[2] && !V[5] && !V[8]) b = 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.HashMap; import java.util.Map; import java.util.Scanner; public class Main { public static void main(String[] args){ try(Scanner sc = new Scanner(System.in)) { boolean mark[] = new boolean[9]; Map<Integer, Integer> numMap = new HashMap<>(); for(int i = 0 ; i < 9 ; 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
a = [list(map(int, input().split())) for _ in range(3)] n = int(input()) b = [int(input()) for _ in range(n)] bingo = 'No' for t in zip(*a): a.append(list(t)) a.append([a[i][i] for i in range(3)]) a.append([a[i][2-i]for i in range(3)]) for line in a: if all(item in b for item in line): bingo = '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
#include<bits/stdc++.h> #define int long long using namespace std; int n,a[4][4],pd[4][4],tot[101]; int hh() { for(int i=1;i<=3;i++) if((pd[i][1]&&pd[i][2]&&pd[i][3])||(pd[1][i]&&pd[2][i]&&pd[3][i])) return 1; if(pd[1][1]&&pd[2][2]&&pd[3][3]) return 1; if(pd[3][1]&&pd[2][2]&&pd[1][3]) return 1; return 0; } sign...
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)] raw = [] for i in range(3): raw.append([a[i][0],a[i][1],a[i][2]]) raw.append([a[0][i],a[1][i],a[2][i]]) raw.append([a[0][0],a[1][1],a[2][2]]) raw.append([a[0][2],a[1][1],a[2][0]]) cnt = [0]*8 n = int(input()) for i in range(n): b = int(input()) for 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
// B - Bingo #include <bits/stdc++.h> using namespace std; #define rp(i,s,e) for(int i=(s);i<(e);++i) #define YES puts("Yes") #define NO puts("No") int main(){ int A[3][3]; rp(i,0,3)rp(j,0,3) cin>>A[i][j]; int N; cin>>N; rp(i,0,N){ int b; cin>>b; rp(r,0,3)rp(c,0,3) if(A[r][c] == b) A[r][c] = 0; } rp(r,0,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
A = [] A += map(int, input().split()) A += map(int, input().split()) A += map(int, input().split()) N = int(input()) for _ in range(N): b = int(input()) try: A[A.index(b)] = 0 except ValueError: pass res = ( (A[0]+A[1]+A[2])*(A[3]+A[4]+A[5])*(A[6]+A[7]+A[8])* (A[0]+A[3]+A[6])*(A[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 "bits/stdc++.h" using namespace std; int main() { int x, A[200] = {}; bool B[10] = {}; for (int i = 1; i <= 9; ++i) { cin >> x; A[x] = i; } int N; cin >> N; for (int i = 0; i < N; ++i) { cin >> x; B[A[x]] = true; } bool ans = false; 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.ArrayList; import java.util.Scanner; class Main { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner scanner = new Scanner(System.in); int A[] = new int[9]; for(int ij = 0; ij<9;ij++){ A[ij]= scanner.nextInt(); } int N =scanner.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
#include <iostream> #include <vector> #include <cmath> #include <iomanip> #include <algorithm> #include <queue> using namespace std; #define rep(i,n) for(int i=0; i<(n); i++) int main() { int n,ans=0; vector<int>a(9),c(9); rep(i,9)cin>>c[i]; cin>>n; vector<int>b(n); rep(i,n)cin>>b[i]; rep(...
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
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<int(n);i++) using namespace std; int main() { int a[3][3]; int n; rep(i,3){ rep(j,3){ cin >>a[i][j]; } } cin >> n; vector<int>b(n); rep(i,n){ cin >> b[i]; rep(j,3){ rep(k,3){ if (a[j][k]==b[i]){ a[j][k]=0; } } } } //yoko ...
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=open(0).read().split();print('YNeos'[all(t-set(map(a.index,a[9:]))for t in({0,3,6},{0,4,8},{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; #define rep(i, n) for(int i = 0; i < (int)(n); i++) int main(void){ int n; int i,j; string s ="No"; vector<int> a(9); vector<bool> t(9,false); rep(i,9){ cin>>a.at(i); } cin>>n; int b; rep(i,n){ cin>>b; rep(j,9){ if(a.at(j)==b)t.at(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
a1,a2,a3,_,*b = [i.split() for i in open(0)] bingo = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [2, 5, 8], [0, 3, 6], [1, 4, 7], [0, 4, 8], [2, 4, 6]] s = ["" if i in sum(b,[]) else i for i in a1 + a2 + a3] for i,j,k in bingo: if {s[i],s[j],s[k]} == {''}: print('Yes') exit() print('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
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(); for(int k=0;k<n;k++) { int b = 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; int n,m,i,j,d,x[9]; map<int,int> a; int main() { for(;i<9;i++)cin>>x[i]; for(cin>>n,j;j<n;j++){ cin>>m; for(i=0;i<9;i++)if(m==x[i])x[i]=0; } for(i=0;i<3;i++) if(x[i]+x[i+3]+x[i+6]==0)return cout<<"Yes",0; for(i=0;i<7;i+=3)if(x[i]+x[i+1]+x[i+2]==0)return cou...
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; #define rep(i,c) for(int i=0;i<(int)c;i++) #define print(var) cout<<var<<endl; const int inf = 1000000000;//10^9 int main(){ vector<int> bingo(9); vector<int> hit(9); rep(i,9) cin>>bingo[i]; int N; cin>>N; rep(i,N) { int num; cin>>num; rep(j,9){ if(num==bingo...
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; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int a[9]; rep(i, 9) cin >> a[i]; int n; cin >> n; int b[n]; rep(i, n) cin >> b[i]; rep(i, n) { rep(j, 9) { if (a[j] == b[i]) a[j] = 0; else continue; } } int l1, l2,...
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(list(map(int,input().split())) for _ in range(3)) n = int(input()) b = list(int(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 for i in range(3): if a[i][0] == a[i][1] == a[i][2] or a[0][i] == a[1][i] == a[2][i] or a[0][0] == a[1][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[] $){ Scanner s=new Scanner(System.in); int[] f=new int[9]; Arrays.setAll(f,i->s.nextInt()); for(int n=s.nextInt();n>0;--n){ int i=s.nextInt(); for(int j=0;j<9;++j) if(i==f[j]) f[j]=0; } boolean r=false; r|=f(f,0,4,8);...
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) { int[][] a = new int[3][3]; int[] b = new int[10]; boolean[][] match = new boolean[3][3]; int n; boolean result = false; Scanner sc = new Scanner(System.in); for (int i = 0; i < 3; i++) { String arg1 = sc.nextLin...
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[9]; int ans[] = new int[9]; for(int i = 0; i < 9; i++){ A[i] = stdIn.nextInt(); ans[i] = 1; } int N = stdIn.nextInt(); int B[] = 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
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[] B = new int[N]; for(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 <stdio.h> int main(void){ int n,tt,i; int a[101],b[10]; for(i=0;i<101;i++){ a[i]=-1; } for(i=0;i<9;i++){ b[i+1]=0; scanf("%d",&n); a[n]=i+1; } scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&tt); b[a[tt]]=1; } if((b[1]*b[2]*b[3])==1||(b[4]*b[5]*b[6])==1||(b[7]*b[8]*b[9])==1||(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 A[][],B[][]; A= new int [3][3]; B= new int [3][3]; for (int i=0;i<3;i++) { for (int j=0;j<3;j++) { A[i][j]= sc.nextInt(); B[i][j]=0; } } int N ; 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=[] 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]: print('Yes') break else: prin...
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[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
#include <cstdio> #include <algorithm> bool cell[9]; int main() { int a[9]; for (int i = 0; i < 9; ++i) { scanf("%d", a + i); } int n; scanf("%d", &n); for (int i = 0; i < n; ++i) { int b; scanf("%d", &b); for (int j = 0; j < 9; ++j) { if (a[j] == b) cell[j] = true; } } bool ok = false; 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
#include<iostream> using namespace std; struct node{ int d,l,r; }sp[200]; int main() { int arr[4][4]={0}; for(int i=1;i<=3;++i) for(int j=1;j<=3;++j) { int d; cin>>d; sp[d]={1,i,j}; } int cnt; cin>>cnt; for(int i=1;i<=cnt;++i) { int q; cin>>q; if(sp[q].d==1)arr[sp[q].l][sp[q].r]=1; } for(int 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 <iostream> using namespace std; int main() { int a[9]; for (int i = 0; i < 9; i++) cin >> a[i]; int n; cin >> n; for (int i = 0; i < n; i++) { int b; cin >> b; for (int j = 0; j < 9; j++) { if (b == a[j]) a[j] = 0; } } bool bingo = false; for (int i = 0; i < 3; 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 = [] for i in range(3): a += list(map(int,input().split())) n = int(input()) b = [] for i in range(n): b = int(input()) if b in a: a[a.index(b)] = 0 ans = 0 if a[0]+a[4]+a[8] == 0 or a[2]+a[4]+a[6] == 0: ans = 1 if ans != 1: for i in range(3): if sum(a[i*3:i*3+3]) == 0 or a[i]+a[i+3]+a[i+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
A = [] for i in range(3): p,q,r = map(int, input().split()) A.append(p) A.append(q) A.append(r) n = int(input()) for i in range(n): b = int(input()) if b in A: A[A.index(b)] = 0 if A[0]==A[1]==A[2]==0 or A[3]==A[4]==A[5]==0 or A[6]==A[7]==A[8]==0 or A[0]==A[3]==A[6]==0 or A[1]==A[4]==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.io.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); // ------------------------------------------------ int[][] a = new int[3][3]; boolean[][] card = { { false, false, 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.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int [] in = new int [9]; for(int i=0;i<9;i++){ in[i] = sc.nextInt(); } int b = 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 = sum([list(map(int,input().split()))for _ in range(3)],[]) N = int(input()) b = [int(input()) for _ in range(N)] f=0 for i in range(9): if A[i]in b:f|=1<<i ans=[v for v in [7,56,73,84,146,273,292,448]if 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
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("YNeos"[not" "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<iostream> using namespace std; int main(){ int A[9]; for (int i = 0; i < 9; i++) { cin >> A[i]; } int N; cin >> N; for (int i = 0; i < N; i++) { int b; cin >> b; for (int i = 0; i < 9; i++){ if(A[i] == b){ A[i] = 0; } } } if( A[0]+A[1]+A[2] == 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 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++){ 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
a = [] for i in range(3): a += list(map(int, input().split())) c = [False] * 9 n = int(input()) for i in range(n): b = int(input()) if b in a: c[a.index(b)] = True d = [[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[2], c[5], c[8]], [c[0], c[4]...
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]; int i,j,k,b; String ans = "No"; for(i = 0;i < 3;i++){ for(j = 0;j < 3;j++){ a[i][j] = sc.nextInt(); } } int N = sc.nextInt(); for(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; public class Main { static String s = ""; public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner sc = new Scanner(System.in); String ans = "No"; //Aをとる 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();...
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; using ll = long long; using P = pair<int, int>; int main() { int card[3][3]; rep(i, 3) rep(j, 3) cin >> card[i][j]; int n; cin >> n; bool ans[3][3] = { false }; int b; rep(i, n) { cin >> b; rep(i, 3) rep(j, 3) if...
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 { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int[] card = new int[9]; for(int i = 0; i < 9; i++){ card[i] = sc.nextInt(); } int num = sc.nextInt(); for(int i = 0; i< num; 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 count = 0; int[] aArray = new int[9]; for (int i = 0; i < 9; i++) { aArray[i] = sc.nextInt(); } int n = sc.nextInt(); int[] bArray = new int[n]; for (int j = 0; j < n; 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
//package atcoder; import java.util.*; import java.math.BigDecimal; 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 ok[][] = new 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
#include<iostream> #include<algorithm> using namespace std; int main() { int n,b,i,j; int a[9],f[9],c[8]; for(i=0;i<9;i++) cin >> a[i]; fill(f,f+9,0); cin >> n; for(j=0;j<n;j++){ cin >> b; for(i=0;i<9;i++) if(a[i]==b) f[i]=1; } for(i=0;i<3;i++) c[i]=f[i*3]+f[i*3+1]+f[i*3+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
#include<bits/stdc++.h> using namespace std; int main(){ //freopen("/home/byte001/Code/Input/1.txt","r",stdin); vector<int >a(9,0); for(int i=0;i<9;i++) cin>>a[i]; int n; cin>>n; bool isTrue = false; vector<int >b(9,0); while(n--){ int x; cin>>x; for(int i=0;i<9;i++) if(a[i]==x) b[i]=1; } if( (b[0]==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 collections mat = [map(int,raw_input().split(' ')) for _ in range(3)] d = {mat[i][j] : (i,j) for i in range(3) for j in range(3)} n = int(raw_input()) cols = collections.Counter() rows = collections.Counter() ac = collections.Counter() cc = collections.Counter() flag = False for __ in range(n): h = d.get(int...
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 { static int[][] bingo = new int[3][3]; public static void main(String[] args) { Scanner sc = new Scanner(System.in); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { bingo[i][j] = Integer.parseInt(sc.next()); } } int n = Integer.parseInt(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
#include<bits/stdc++.h> using namespace std; int li[3][3]; int k[110][2]; int main() { int a; memset(k,-1,sizeof(k)); for(int i=0;i<3;i++) for(int j=0;j<3;j++) { cin>>a; k[a][0]=i; k[a][1]=j; } int n; cin>>n; for(int i=0;i<n;i++) { cin>>a; if(k[a][0]==-1) continue; int x=k[a][0]; int y=k[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.*; public class Main { public static void main(String[] args) { Scanner scan = 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] = scan.nextInt(); } } int n = scan.nextInt(); for(int h=0;h<n;h++) { int in_nu...
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> #include<iomanip> #include<vector> #include<map> #include<string> #include<queue> #include<tuple> #include<utility> #include<functional> #include<algorithm> #define LL long long using namespace std; int n,a[10]; map<int,int>k; bool b[10],ans=false; int main() { for(int i=0;i<9;i++){ cin>>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 in = new Scanner(System.in); int[] A = new int[9]; for (int i=0; i<9; i++) { A[i] = in.nextInt(); } int N = in.nextInt(); int[] b = new int[N]; for (int i=0; i<N; i++) { b[i] = in.nextInt(); } boolean f...
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[10]; bool avai[10]; signed main(){ for(register int i=1;i<=9;++i) scanf("%d",&a[i]); int n; scanf("%d",&n); while(n--){ int x; scanf("%d",&x); for(register int i=1;i<=9;++i) if(a[i]==x) avai[i]=true; } bool f=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
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 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<bits/stdc++.h> using namespace std; int n,q; int a[5][5]; bool k[5][5],ans; int main() { for(int i=1;i<=3;i++) for(int j=1;j<=3;j++) scanf("%d",&a[i][j]); cin>>n; while(n--) { cin>>q; for(int i=1;i<=3;i++) for(int j=1;j<=3;j++) if(a[i][j]==q) k[i][j]=1; } for(int i=1;i<=3;i++) if(k[i][1]&&k[i][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
#include<bits/stdc++.h> using namespace std ; #define pb push_back #define endl '\n' #define x first #define y second int a[3][3]; int main(){ for(int i=0;i<3;i++){ for(int j=0;j<3;j++){ cin>>a[i][j]; } } int n,b; cin>>n; while(n--){ cin>>b; for(int i=0;i<3;i++) for(int j=0;j<3;j++) if(a[i][j]==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> using namespace std; int main(){ vector<int> s(9); for(int i=0;i<9;++i)cin>>s[i]; vector<bool> f(9,false); int N; cin>>N; for(int i=0;i<N;++i){ int b; cin>>b; const int pos=distance(s.cbegin(),find(s.cbegin(),s.cend(),b)); 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
#include<cstdio> #include<cstring> #include<string> #include<iostream> #include<cmath> using namespace std; int mp[106],a[5][5],n,b,ans=0; int main(){ for(int i=1;i<=3;i++) for(int j=1;j<=3;j++) cin>>a[i][j]; cin>>n; while(n--){ cin>>b; mp[b]=1; } for(int i=1;i<=3;i++) if( mp[a[i][1]]+mp[a[i][2]]+mp[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
a=open(0).read().split();print('YNeos'[all(t-set(map(a.index,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
a = [list(map(int, input().split())) for _ in range(3)] a = a[0] + a[1] + a[2] c = [ a[0:3], a[3:6], a[6:9], a[::3], a[1::3], a[2::3], [a[0], a[4], a[8]], [a[2], a[4], a[6]] ] n = int(input()) b = [int(input()) for _ in range(n)] same = set(a) & set(b) for d in c: cnt = 0 for n in same: ...
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++) using ll = long long; int main() { int a[3][3]; REP(i,3) REP(j,3) cin >> a[i][j]; int n; cin >> n; int b; REP(i,n) { cin >> b; REP(i,3) { REP(j,3) { if (a[i][j] == b) a[i][j] = 0; } } } int bingo = 0; RE...
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=list(int(input()) for i in range(n)) bingo="No" for k in range(n): for i in range(3): for j in range(3): if b[k]==a[i][j]: a[i][j]=0 for i in range(3): if a[i]==[0,0,0]:bingo="Yes" if a[0][i]==a[1][i]==a[2][i]==0: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
#include<bits/stdc++.h> using namespace std; int A[10],f,i,j,k,l,a,b; int main(){ for(auto& c:A)cin>>c; for(;j<A[9];j++){ cin>>b; for(k=0;k<9;++k)A[k]*=A[k]!=b; } string s="012345678036147258048246"; for(auto c:s){ a+=A[c-'0']; if((++l)%3==0){ f+=a==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 A[3][3],N,B; int x[3][3]; 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)x[j][k]=1; } } bool X=false; for(int i=0;i<3;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<bits/stdc++.h> using namespace std; #include<cstdio> #define el "\n" #define sp " " typedef long long ll; ll b[3][3]; int main() { ll a[3][3]; for(ll i=0;i<3;i++) for(ll j=0;j<3;j++) cin>>a[i][j]; ll n,x; cin>>n; for(ll i=0;i<n;i++) { cin>>x; for(ll i=0;i<3;i++) for(ll j=0;j<3;j++) if(a[i][j]==x) 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 _ 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=[v for v in [7,56,73,84,146,273,292,448]if 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
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int a[] = new int[9]; for (int i = 0; i < 9; i += 3) { Stri...
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[][] card = new int[3][3]; boolean[][] cardflg = new boolean[3][3]; boolean flag = false; for(int i=0;i<3;i++){ for(int j=0;j<3;j++){ card[i][j] = 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.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); ArrayList<Integer> card = new ArrayList<>(9); for (int i = 0; i < 9; i++) { card.add(sc.nextInt()); } int coun...
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); //String word_before = sc.next(); 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.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.*; public class Main{ public static void main(String[]args){ int[][] bingo=new int[3][3]; Scanner sc = new Scanner(System.in); for(int i=0;i<3;i++){ for(int j=0;j<3;j++){ bingo[i][j]=sc.nextInt(); } } 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 scan = new Scanner(System.in); int[] A = new int[9]; for(int i = 0;i < 9;i++) { A[i] = scan.nextInt(); } int N = scan.nextInt(); int[] b = new int [N]; for(int i = 0;i < N;i++) { b[i] = scan.nextInt(); } scan...
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 <stdio.h> int arr[3][3]; int row[3],col[3],diag[2]; int main(){ for(int i=0;i<3;i++) for(int j=0;j<3;j++) scanf("%d",&arr[i][j]); int N;scanf("%d",&N); while(N--){ int t;scanf("%d",&t); for(int i=0;i<3;i++){ for(int j=0;j<3;j++){ if(arr[i][j]==t){ row[i]++; col[j]++; if(i==j) diag[...
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 i in range(3): a.extend(input().split()) n = int(input()) for i in range(n): c = input() if c in a: a[a.index(c)] = '0' 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] == ...
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.*; class Main { Scanner sc; int[][] A; int N; private void calc() { sc = new Scanner(System.in); A = new int[3][3]; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { A[i][j] = sc.nextInt(); } } N = sc.nextInt(); for (int i = 0; i < N; i++) { int b = 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)] b=[i for i in [int(input()) for _ in range(int(input()))] for j in A if i in j] A=[[1 if A[i][j] in b else 0 for j in range(len(A[i]))] for i in range(len(A))] print('NYoe s'[any([all(i) for i in A]) or any([all(i) for i in list(zip(*A))]) or all([A[0][0],A[1][1],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<bits/stdc++.h> using namespace std; int main(){ vector<vector <int>>b(3,vector<int>(3)); for(int i=0;i<3;i++){ for(int k=0;k<3;k++){ cin >>b.at(i).at(k); } } int n,z=0; cin>>n; vector<int>a(n); for(int i=0;i<n;i++){ cin>>a.at(i); for(int j=0;j<3;j++){ for(int k=0;k<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
a1 = list(map(int, input().split())) a2 = list(map(int, input().split())) a3 = list(map(int, input().split())) N = int(input()) B = {int(input()) for _ in range(N)} A = a1+a2+a3 ijk = [ [0,1,2], [3,4,5], [6,7,8],[0,3,6],[1,4,7],[2,5,8],[0,4,8],[2,4,6]] end = False for i,j,k in ijk: if {A[i], A[j], A[k]} <= 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> #define rep(i, n) for (int i=0;i<(n);i++) #define ll long long using namespace std; int G[3][3]; bool T[3][3]; int main() { rep(i, 3) rep(j, 3) cin>>G[i][j]; int n; cin>>n; vector<int> b(n); rep(i, n) cin>>b[i]; bool frag=false; rep(i, n) { rep(j, 3) { rep(k, 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.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
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 int long long #define N 666666 int arr[N]; int mp[6][6]; signed main(){ for(int i=1;i<=3;i++) for(int j=1;j<=3;j++){ cin>>mp[i][j]; } int m; map<int,int> vis; cin>>m; while(m--){ int t; cin>>t; vis[t]++; } for(int i=1;i<=3;i++){ int f=0; 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.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int a[] = new int[9]; for (int i = 0; i < a.length; i++) { a[i] = scan.nextInt(); } int n = scan.nextInt(); for (int i = 0; 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, = map(int, open(0).read().split()) N = A[9] B = A[10:] A = A[:9] T = [False]*9 for b in B: if b in A: T[A.index(b)] = True 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)] for a, b, c in bingo: if T[a] and T[b] and T[c]: 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
#include <iostream> #include <cmath> #include <vector> using namespace std; int main(){ vector<int> a(9); for (int i=0; i<3; i++){ cin >> a[i*3] >> a[i*3+1] >> a[i*3+2]; } int n; cin >> n; int b; for (int i=0; i<n; i++){ cin >> b; for (int j=0; j<9; j++){ 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 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(); boolean bingo = 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[][] bingo = new int[3][3]; for(int i = 0; i < 3; i++){ for(int i2 = 0; i2 < 3; i2++){ bingo[i][i2] = sc.nextInt(); } } int n = sc.nextInt(); boolean[][] bingo2 = new 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
grid = [[0 for i in xrange(3)] for j in xrange(3)] for i in xrange(3): grid[i] = map(int, raw_input().strip().split()) ans = [[0 for i in xrange(3)] for j in xrange(3)] q = input() for _ in xrange(q): num = input() for i in xrange(3): for j in xrange(3): if grid[i][j] == num: ...
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 main(){ int i,j; vector<int>a(9); for(i=0;i<9;i++)cin>>a[i]; int n; cin >> n; int b; for(i=0;i<n;i++){ cin >> b; for(j=0;j<9;j++){ if(b==a[j])a[j]=-1; } } bool chk = false; for(i=0;i<3;i++){ if(a[i]==-1 && a[i+3]==-1 && a[i+6]==-...
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(); int b[] = new int[N]; for (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
#include <bits/stdc++.h> using namespace std; #define N 5 #define M 105 int n,a[N][N],x[M],y[M];bool ans,vs[N][N]; int main() { for(int i=1;i<=3;++i) for(int j=1;j<=3;++j) scanf("%d",&a[i][j]),x[a[i][j]]=i,y[a[i][j]]=j; scanf("%d",&n); for(int i=1,t;i<=n;++i) scanf("%d",&t),vs[x[t]][y[t]]=1; for(int i=1;i<=3;++i)...
CPP