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
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); BigInteger dogs = new BigInteger(String.valueOf(sc.next())); BigInteger[] results; StringBuilder result = new StringBuilder(""); results = dogs.divideAndRe...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include <bits/stdc++.h> using namespace std; int main() { long N; cin>>N; N--; string ans=""; while(N>=0){ long t=N%26; ans+=char('a'+t); N/=26; N--; } reverse(ans.begin(),ans.end()); cout<<ans<<endl; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include <iostream> #include <algorithm> using namespace std; int main () { long long n; cin >> n; string o = ""; while (n > 0) { n--; o += 'a'+(n%26); n /= 26; } reverse(o.begin(), o.end()); cout << o << endl; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include<iostream> #include<algorithm> using namespace std; int main(){ string s; long long n; cin>>n; while(n>0){ n-=1; s+=n%26+'a'; n/=26; } reverse(s.begin(),s.end()); cout<<s; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include<bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; string ans = ""; while(n!=0) { n--; ans+=('a' +n%26); n/=26; } reverse(ans.begin(), ans.end()); cout << ans; }
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.ArrayList; import java.util.List; 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 < 9; i++) { a[i] = scan.nextInt(); } int n = scan.nextInt(); List<Integer> b = new Ar...
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+=list(map(int, input().split())) N=int(input()) b=[] for _ in range(N): b.append(int(input())) 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}] hole=set() for num in b: for i in range(9): if num==A[i]: hole.add(i) for tri in BIN...
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = 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] = Integer.parseInt(in.next()); } } int n = Integer.parseInt(in.next()); 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 = [list(map(int, input().split())) for i in range(3)] n = int(input()) b = [int(input()) for i in range(n)] flag = False for i in range(3): if all(a[i][j] in b for j in range(3)): flag = True if all(a[j][i] in b for j in range(3)): flag = True if all(a[i][i] in b for i in range(3)) or all(a[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
s,a=',036,048,246,258,345,678,',open(0).read().split() for i in a[9:]:s=s.replace(str(a.index(i)),'') print('NYoe s'[',,'in s::2])
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
a=[] sheet=[0]*9 for _ in range(3): a+=list(map(int,input().split())) n=int(input()) for _ in range(n): b=int(input()) if b in a: c=a.index(b) sheet[c]=1 bingo=[[0,3,6],[1,4,7],[2,5,8],[0,1,2],[3,4,5],[6,7,8],[0,4,8],[2,4,6]] flg=0 for bb in bingo: if sheet[bb[0]]==1: if sheet[...
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
a = [] for i in range(3): a += list(map(int, input().split())) bg = [False]*9 n = int(input()) for i in range(n): b = int(input()) if b in a: bg[a.index(b)] = True num = [[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 x, y, z in num: if bg[x] and bg[y] and bg[z]: p...
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.*; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int bingo[][] = new int[3][3]; int B[][] = new int[3][3]; int count[] = new int [8]; for(int i=0;i<3;i++) { for(int j =0; j<3;j++) { bingo[i][j] = sc.nextInt(); } } int N = sc.ne...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args)throws Exception{ Scanner stdIn=new Scanner(System.in); int A[][]=new int[3][3]; boolean cout[][]=new boolean[3][3]; boolean key=true; int ans=0; for(int i=0;i<3;i++){ for(int j=0;j<3;j++){ A[i][j]=stdIn.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 i in range(3)] n=int(input()) b=[input() for i in range(n)] flg=0 for i in range(3): for j in range(3): if a[i][j] in b: a[i][j]=0 for n in range(3): if a[0][n]==a[1][n]==a[2][n]: flg=1 elif a[n][0]==a[n][1]==a[n][2]: flg=1 elif a[0][0]==a[1][1]==a[2][2]: flg=1 eli...
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 num[9]; for(int i=0;i<9;i++){ cin>>num[i]; //cout<<A[i]<<endl; } bool A[9]={false}; int N; cin>>N; int b; for(int i=0;i<N;i++){ cin>>b; for(int j=0;j<9;j++){ if(num[j]==b)A[j]=true; } } string ans="No"...
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) throws Exception{ Scanner scn = new Scanner(System.in); int[] a = new int[9]; for(int i=0; i<a.length; ++i){ a[i] = scn.nextInt(); } int n = scn.nextInt(); int[] b = new int[n]; for(int i=0; i<b.length; ++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 <bits/stdc++.h> using namespace std; vector<int> x1 = {0,3,6,0,1,2,0,2}; vector<int> x2 = {1,4,7,3,4,5,4,4}; vector<int> x3 = {2,5,8,6,5,8,8,6}; int main(){ vector<int> A(9); vector<bool> B(9,false); int N; for(int i=0; i<9; i++) cin >> A[i]; cin >> N; for(int i=0; i<N; i++){ int b; cin >...
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; using ll = long long; int main(void){ int a[3][3]={0};for(int i=0;i<9;i++)cin>>a[i/3][i%3]; int n;cin>>n; for(int i=0;i<n;i++){int tmp;cin>>tmp;for(int j=0;j<9;j++)if(a[j/3][j%3]==tmp)a[j/3][j%3]=0;} int ans=1; ans*=a[0][0]+a[0][1]+a[0][2]; ans*=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
a=[list(map(int,input().split()))for _ 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]=0 ans="No" for i in range(3): if a[i][0]==a[i][1]==a[i][2]==0: ans="Yes" if a[0][i]==a[1][i]==a[2][i]==0: ans="Yes" ...
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0; i<(n); i++) int a[3][3], n, b; bool c[3][3], ok, t, u; int main(){ rep(i,3) rep(j,3) scanf("%d", &a[i][j]); scanf("%d", &n); rep(i,n){ scanf("%d", &b); rep(j,3) rep(k,3) if(a[j][k] == b) c[j][k] = true; } rep(i,3){ t = true; u = true...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[][] card = new int[3][3]; boolean[][] hit = new boolean[3][3]; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { c...
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[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(); } boole...
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 p; int[][] a = new int[3][3]; boolean[][] b = 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 ...
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 a[3][3]; int n; int count[8] = {}; int i,j,k; int b; int f; int ret=0; for(i=0;i<3;i++){ for(j=0;j<3;j++){ scanf("%d",&a[i][j]); } } scanf("%d",&n); for(k=0;k<n;k++){ scanf("%d",&b); for(i=0;i<3;i++){ for(j=0;j<3;j++){ if( a[i][j] == b){ coun...
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=[] for i in range(3): a=list(map(int, input().split())) for j in a: l.append(j) n=int(input()) l2=[] for i in range(n): l2.append(int(input())) for i in range(len(l)): if l[i] in l2: l[i]=0 #print(l) y1=l[0]+l[1]+l[2] y2=l[3]+l[4]+l[5] y3=l[6]+l[7]+l[8] t1=l[0]+l[3]+l[6] t2=l[1]+l[4]+l[7] t3=l[...
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> int main(){ using namespace std; vector<unsigned long> A(9); for(auto& i : A)cin >> i; unsigned long N; cin >> N; for(unsigned long i{0}, b; i < N; ++i){ cin >> b; for(auto& j : A)if(j == b)j = 0; } bool f{false}; f |= !A[0] & !A[1] & !A[2]; ...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
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 hit[][] = new int[3][3]; for(int i = 0;i < 3;i++){ for(int j = 0;j < 3;j++){ a[i][j] = sc.nextInt(); } } int n = sc.nextInt(); ...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include<iostream> using namespace std; int main(){ int B[9],N; for(int i=0;i<9;i++){ cin >> B[i]; } cin >> N; int C[N]; for(int j=0;j<N;j++){ cin >> C[j]; for(int i=0;i<9;i++){ if(C[j]==B[i]){ B[i]=0; } } } if(B[0]+B[1]+B[2]==0|B[3]+B[4]+B[5]==0|B[6]+B[7]+B[8]==0|B[...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include <iostream> using namespace std; int main() { int a[3][3], cnt[8] = {}; for (int i = 0; i < 3; ++i) for (int j = 0; j < 3; ++j) cin >> a[i][j]; int n; cin >> n; while (n--) { int b; cin >> b; for (int i = 0; i < 3; ++i) { for (int j = 0; j < 3; ++j) { if (a[i][j] == b) { ++cnt[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); 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]; ...
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()))+list(map(int,input().split()))+list(map(int,input().split())) n=int(input()) b=[int(input()) for _ in range(n)] open=[] for i in range(n): if b[i] in a: open.append(a.index(b[i])) correct=[{0,1,2},{3,4,5},{6,7,8},{2,5,8},{1,4,7},{0,3,6},{0,4,8},{2,4,6}] for i in correct: ...
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.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); // String s = sc.next(); // int n = sc.nextInt(); ArrayList<Integer> bingoCard = new ArrayList<>(); for(int i=0;i<9;i++) { int a = sc.nextInt(); bing...
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); Integer array[][] = new Integer[3][3]; for(int i = 0;i < 3;i++) { for(int j = 0; j < 3; j++) { array[i][j] = scan.nextInt(); } } int n = scan.nextInt(); for(int k = 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
#B a = [list(map(int,input().split())) for _ in range(3)] c = [a[0][0],a[0][1],a[0][2],a[1][0],a[1][1],a[1][2],a[2][0],a[2][1],a[2][2]] n = int(input()) b = [int(input()) for _ in range(n)] for i in range(n): if b[i] in c: c[c.index(b[i])] = 0 #print(c) p = sum(c[:3])*sum(c[3:6])*sum(c[6:9])*sum(c[::3])*...
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include <bits/stdc++.h> #define rep(i,n) for (int i=0; i<(n); ++i) using namespace std; using ll=long long; int main(){ int a[9]; rep(i,9)cin>>a[i]; int n; cin>>n; vector<int>b(n); rep(i,n){ cin>>b[i]; rep(j,9){ if(b[i]==a[j])a[j]=0; } } if((a[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
f = lambda:list(map(int,input().split())) la = f()+f()+f() sb = set() n = int(input()) for i in range(n): b = int(input()) if b in la: sb.add(la.index(b)) ls = [{0,1,2},{0,3,6},{0,4,8},{1,4,7},{2,4,6},{2,5,8},{3,4,5},{6,7,8}] for s in ls: if s<=sb: print('Yes') break else: 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
card = [] for i in range(3): card += list(map(int, input().split())) N = int(input()) bingo = [(1, 2, 3), (4, 5, 6), (7, 8, 9), (1, 4, 7), (2, 5, 8), (3, 6, 9), (1, 5, 9), (3, 5, 7)] for i in range(N): n = int(input()) if n in card: card[card.index(n)] = "hit" #print(card) ans = "No" for patt in bingo: if 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
#include<bits/stdc++.h> using namespace std; int main(){ int m,n,a[4][4],x[105]={0},y[105]={0}; for(int i=1;i<4;i++) for(int j=1;j<4;j++){ cin>>a[i][j]; x[a[i][j]]=i; y[a[i][j]]=j; } cin>>n; for(int i=0;i<n;i++){ cin>>m; if(x[m]){ a[x[m]][y[m]]=-1; } } int ok=0; for(int i=1;i<4;i++) if(a[...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int array[][] = new int [3][3]; boolean ans[][] = new boolean [3][3]; for(int i = 0;i<3;i++){ for(int j = 0;j<3;j++){ array[i][j] = sc.nextInt(); } } int n = sc.nextInt...
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); //List<String> list=new ArrayList<String>(Arrays.asList(s.split(""))); //List<Integer> list=new ArrayList<Integer>(); int[][] array = new int[3][3]; for(int i=0;3>i;i++) { for(int 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
a=open(0).read().split();print('YNeos'[all(t-set(map(a.index,a[10:]))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; int a[5][5],f[5][5]; int main() { for(int i=1;i<=3;i++) for(int j=1;j<=3;j++) cin>>a[i][j]; int n; cin>>n; for(int i=1;i<=n;i++) { int k; cin>>k; for(int j=1;j<=3;j++) for(int l=1;l<=3;l++) if(a[j][l]==k) f[j][l]=1; } if((f[1][1]&&f[1][2]&&f[1][...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<string> #include<cmath> using namespace std; int main() { int a[5][5]={0},i,j,n,b[105]={0},k,l=0; 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>>k; b[k]++; } for(i=0;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.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); List<Integer> card = new ArrayList<>(); for (int i = 0; i < 9; i++) { card.add(sc.nextInt()); } boolean[] mark = ...
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 x[3][3]; int dx[3],dy[3]; int main(){ int i,j,n,a; for(i=0;i<3;i++){ for(j=0;j<3;j++){ scanf("%d",&x[i][j]); } } scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&a); for(j=0;j<3;j++){ for(int k=0;k<3;k++){ if(x[j][k]==a){ x[j][k]=-1; } } } } for(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; int main() { int N, n, c=0; vector<int> a(9),b(9,0); for (int i=0;i<9;i++){ cin>>a.at(i); } cin>>N; for (int i=0;i<N;i++){ cin>>n; for (int i=0;i<9;i++){ if(a.at(i)==n){ b.at(i)=1; } } } c+=b[0]*b[1]*b[2]+b[3]*b[4]*b[5]+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 sys x=[] for i in range(3): a,b,c=map(int,input().split()) x.append(a) x.append(b) x.append(c) n=int(input()) p=[int(input()) for i in range(n)] for i in range(9): if x[i] in p: x[i]=0 def ch(s,d): global x if x[s]==0 and x[s+d]==0 and x[s+d+d]==0: print('Yes') sys.exit() d=1 ch(0,d) c...
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.*; 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 < 9; i++) bingo[i/3][i%3] = Integer.parseInt(sc.next()); int n = sc.nextInt(); for(int i = 0; i < n...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
a = [list(map(int, input().split())) for _ in range(3)] n = int(input()) b = [int(input()) for _ in range(n)] lines = [set(x) for x in a] + [set(x) for x in zip(*a)] + [set([a[0][0], a[1][1], a[2][2]]), set([a[0][2], a[1][1], a[2][0]])] bs = set(b) if any(line.issubset(bs) for line in lines): print('Yes') else: ...
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; using ll = long long; #define rep(i, n) for(i = 0; i < n; i++) const int U=2e5+5; int main() { int i,j,k; string ans="No"; int bin[3][3]; rep(i,3) rep(j,3) cin >> bin[i][j]; int N; cin>>N; int b[N]; rep(i,N){ cin>>b[i]; rep(j, 3) rep(k, 3) if (bin[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.io.InputStream; import java.io.PrintStream; import java.util.Arrays; import java.util.Scanner; public class Main { InputStream in = System.in; PrintStream out = System.out; public void _main(String[] args) { Scanner sc = new Scanner(in); int[][] A = new int[4][4]; for (int i = 1; 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
import sys range = xrange input = raw_input A = [] for _ in range(3): A.append([int(x) for x in input().split()]) C = [[False,False,False] for _ in range(3)] n = int(input()) for _ in range(n): b = int(input()) for x in range(3): for y in range(3): if A[x][y] == b: C[x...
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 A[9]; for(int i = 0; i<9; i++){ cin>>A[i]; } int n; cin>>n; while(n--){ int x; cin>>x; for(int i =0; i<9; i++){ if(A[i]==x)A[i]=0; } } if(A[0]==A[4]&&A[4]==A[8])cout<<"Yes"; else if(A[2]==A[4]&&A[4]==A[6])cout<<"Y...
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<functional> #include<algorithm> #include<cstring> using namespace std; int main(void) { int i,j,a[9],flg[9],b,n,f; int che[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}}; for(i=0;i<9;i++) scanf("%d",&a[i]); for(i=0;i<9;i++) flg[i]=0; scanf("%d",&n); 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<bits/stdc++.h> using namespace std; int a[3][3]; bool b[3][3]; bool check(){ for(int i=0;i<3;i++) if(b[i][0] && b[i][1] && b[i][2]) return(true); for(int i=0;i<3;i++) if(b[0][i] && b[1][i] && b[2][i]) return(true); if(b[0][0] && b[1][1] && b[2][2]) return(true); if(b[2][0] && b[1][1] && b[0][2]) return...
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(int i=0;i<(n);++i) using namespace std; typedef long long ll; typedef pair<int, int> P; vector<vector<int>> a(3, vector<int>(3)); map<int, bool> mp; int main() { rep(i, 3)rep(j, 3) cin >> a[i][j]; int n; cin >> n; rep(i, n) { int b; cin >> b; mp[b] = true; } bool...
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=[0]*9 for i in range(3): A[i*3:i*3+3]=input().split() for i in range(int(input())): b=input() for j in range(9): if A[j]==b: A[j]="0" s="012345678036147258048246" a=f=0 for i in range(24): a+=int(A[int(s[i])]) if i%3==2: if a==0: f+=1 a=0 if f>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]; boolean[][] b = new boolean[3][3]; for(int i = 0 ; i < 3 ; i++) { for(int j = 0 ; j < 3 ; j++) { a[i][j] = Integer.parseInt(sc.next()); b[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.*; 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++) { int b = 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
import java.util.Scanner; 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 num = sc.nextInt(); int[] readout...
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 for i,j,k in [ (0,1,2),(3,4,5),(6,7,8), (0,3,6),(1,4,7),(2,5,8), (0,4,8),(2,4,6), ]: if A[i]==A[j]==A[k]: print('Yes') break else: pri...
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,b,c=map(int,input().split()) d,e,f=map(int,input().split()) g,h,i=map(int,input().split()) lst=[a,b,c,d,e,f,g,h,i] for i in range(int(input())): x=int(input()) for j in range(9): if x==lst[j]: lst[j]=0 a,b,c,d,e,f,g,h,i=lst tf=0 for k in [a+b+c,d+e+f,g+h+i,a+d+g,b+e+h,c+f+i,a+e+i,c+e+g]: if not k: ...
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<long>> a(3,vector<long>(3)); for(int i=0;i<3;i++)for(int j=0;j<3;j++) cin>>a[i][j]; long N; cin>>N; vector<long> b(N); for(int i=0;i<N;i++) cin>>b[i]; for(int k=0;k<N;k++){ for(int i=0;i<3;i++)for(int j=0;j<3;j++) if(a[i][j]==b[k]) a[i][j]=-1...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
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]; boolean[][] s = new boolean[3][...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { 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 ...
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[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(); } boole...
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]; int b[11]; int n; bool found[102]; bool check(int r, int c, int i, int j) { for (int k = 0; k < 3; k++, r += i, c += j) { if (!found[a[r][c]]) return false; } return true; } int main() { for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { ...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
def resolve(): a = [] bingo = [(0,3,6),(1,4,7),(2,5,8),(0,1,2),(3,4,5) ,(6,7,8),(0,4,8),(2,4,6)] for _ in range(3): a += list(map(int,input().split())) for i in range(int(input())): r = int(input()) if r in a: a[a.index(r)]=0 ans = 'No' for i in bingo: if a[i[0]] == 0 and a[i[1]]==0 and a[i[2]]==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): A += list(map(int,input().split())) called = [False] * 9 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)) N = int(input()) for i in range(N): target = int(input()) if target in A: called[A.index(target)] = True for a,b,c in bingo: if called[a] and cal...
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)] 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]==0 or A[0][i]+A[1][i]+A[2][i]==0: print('Yes') exit(0) if A[0][0]+A[1][1]+A[2][2]==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)] N = int(input()) bn = [int(input()) for _ in range(N)] flag = False for row in A: if all(item in bn for item in row): flag = True for col in zip(*A): if all(item in bn for item in col): flag = True if all(A[i][i] in bn for i in range(3))...
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) { Map<Integer, Integer> ele = new HashMap<Integer, Integer>(); Set<Integer> idx = new HashSet<Integer>(); int[][] 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}}; boolean bf = 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> using namespace std; int main() { int arr[3][3],flag[100]={0},i,j,n,x,x1,x2,x3,x4,x5,x6,x7,x8,x9; for(i=0;i<3;i++) { for(j=0;j<3;j++) cin >> arr[i][j]; } cin >> n; for(i=0;i<n;i++) { cin >> x; flag[x]=1; } x1 = flag[arr[0][0]]; x2 = flag[arr[0][1]]; x3 = flag[arr[0][2]]; x4...
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,=map(int,open(0).read().split());print('YNeos'[all(t-set(a.index(b)for b in a[10:])for t in({0,1,2},{0,3,6},{0,4,8},{1,4,7},{2,4,6},{2,5,8},{3,4,5},{6,7,8}))::2])
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for (int i = 0; i < (n); i++) #define all(v) begin(v),end(v) using ll = long long; int main() { vector<vector<int>> a(3,vector<int>(3)); rep(i,3)rep(j,3)cin>>a[i][j]; int n;cin>>n; rep(i,n){ int b;cin>>b; rep(j,3)rep(k,3){ if(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
*inputs, = map(int, open(0).read().split()) A = inputs[:9] B = inputs[9:] C = [0] * 9 for b in B: if b in A: C[A.index(b)] = 1 if any([ all(C[:3]), all(C[3:6]), all(C[6:]), all(C[::3]), all(C[1::3]), all(C[2::3]), all([C[0], C[4], C[8]]), all([C[2], C[4], C[6]]) ]): print('Yes') else: ...
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=[] A.extend(list(map(int,input().split())) for i in range(3)) N=int(input()) for i in range(N): j=input() for l in range(3): for m in range(3): S=S.replace(str([9,l*3+m][A[l][m]==int(j)]),"") print(["No","Yes"][S.find(" ")>-1])
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.Scanner; public class Main{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int[][] n = new int[3][3]; for(int i = 0;i < n.length; i ++){ for(int j = 0; j < n[0].length; j ++){ n[i][j] = sc.nextInt(); } } int x = sc.nextInt(); int[] num = new int[x];...
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()) 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] =0 ans = "No" for i in range(3): if a[i][0]==a[i][1]==a[i][2]==0:ans="Yes" if a[0][i]==a[1][i]==a[2][i]==0:ans="Ye...
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
a = [] for _ in range(3): a += list(map(int, input().split())) n = int(input()) b = {int(input()): None for _ in range(n)} r = [(ai in b) for ai in a] combs = [ [0,1,2], [3,4,5], [6,7,8], [0,3,6], [1,4,7], [2,5,8], [0,4,8], [2,4,6], ] if any([all([r[c] for c in comb]) for comb in c...
PYTHON3
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[][] A = new int[3][3]; boolean[][] flag = new boolean[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
import java.util.*; import java.util.Map.Entry; class Main { static int mod = (int) (Math.pow(10,9)+7); // static int mod = 998244353; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] b=new int[9]; for(int i=0;i<9;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 <bits/stdc++.h> using namespace std; int main(){ int a[3][3],b,c; for (int i=0;i<3;i++) for (int n=0;n<3;n++) cin>>a[i][n]; cin>>b; for (int i=0;i<b;i++){ cin>>c; for (int n=0;n<3;n++) for (int m=0;m<3;m++) if (a[n][m]==c) a[n][m]=1000; } for (int i=0;i<3;i++) if (a[i][0]==1000&&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
#include <iostream> #include <vector> using namespace std; int main() { vector<int> A(9, 0), B(9, 0); bool flg = false; 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(A[j] == b) B[j] = 1; } } for(in...
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 <string> using namespace std; int main(){ int a[9], n, b[10]; for(int i=0; i<9;i++){ cin>>a[i]; } cin>>n; for(int i=0; i<n; i++){ cin>>b[i]; 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
p,r=input,range A=sum([list(map(int,p().split()))for _ in r(3)],[]) b=[int(p())for _ in r(int(p()))] print('YNeos'[all([sum(1<<i for i in r(9)if A[i]in b)&v!=v for v in[7,56,73,84,146,273,292,448]])::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 a[11][11],t,x; bool flag[11][11]; int main() { for(int i=0;i<3;i++) { for(int j=0;j<3;j++) { cin>>a[i][j]; } } cin>>t; while(t--) { cin>>x; for(int i=0;i<3;i++) { for(int j=0;j<3;j++) { if(a[i][j]==x) flag[i][j]=1; } } } if(flag[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; #define rep(i,n) for (int i =0;i<(n);++i) using ll = long long; using P = pair<int, int>; int main() { int A[3][3],AA[3][3]; rep(i, 3) { rep(j, 3) { cin >> AA[i][j]; } } int N; cin >> N; vector<int> b(N); rep(i, N) { cin >> b[i]; rep(j, 3) { rep(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 scan = new Scanner(System.in); int a[][]=new int[3][3]; int ans[][]=new int[3][3]; for(int i=0;i<3;i++) { for(int j=0;j<3;j++) { a[i][j]=scan.nextInt(); ans[i][j]=0; } } int n=scan.nextInt(); 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
import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int[][] card = new int[3][3]; boolean[][] bingo = 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
A = [] for i in range(3): for x in input().split(): A.append(int(x)) N = int(input()) for _ in range(N): y = int(input()) A = [0 if x == y else x for x in A] if any((sum(A[::3]) == 0, sum(A[1::3]) == 0, sum(A[2::3]) == 0, sum(A[:3]) == 0, sum(A[3:6]) == 0, sum(A[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
input = raw_input a_dict = {} for i in range(3): a_line = map(int, input().split(" ")) for j in range(3): a = a_line[j] a_dict[a] = (i, j) n = int(input()) taishos = a_dict.keys() attas = [[False, False, False] for _ in range(3)] for _ in range(n): b = int(input()) if b in taishos: ...
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.io.*; import java.util.*; public class Main { public static void main (String[] args) { Scanner s=new Scanner(System.in); long a[][]=new long[3][3]; for(int i=0;i<3;i++) {for(int j=0;j<3;j++) a[i][j]=s.nextLong(); } int n=s.nextInt(); for(int kk=0;kk<n;kk++) {long p=s.nextLong(); 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
#include <bits/stdc++.h> using namespace std; #define fori(x) for (int i = 0; i < x; ++i) #define forj(x) for (int j = 0; j < x; ++j) int main() { int a[9]; fori(9) cin >> a[i]; int n, b[10]; cin >> n; fori(n) cin >> b[i]; fori(n) { int j = 0; for (; j < 9 && b[i] != a[j]; ++j) { } if (j >= 9) { co...
CPP
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner sc = new Scanner(System.in); int board[][] = new int[3][3]; for(int i = 0; i < 3; i++){ for(int j = 0; j < 3; j++){ board[i][j] = sc.nextInt(); } } int n = sc.nextInt(); ...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
import java.util.*; public class Main { public static int max(int a, int b){return (a > b ? a : b);} public static int min(int a, int b){return (a < b ? a : b);} public static int gcd(int a, int b){return (b > 0 ? gcd(b, a % b) : a);} public static int lcm(int a, int b){return a / gcd(a, b) * b;} pu...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include<iostream> using namespace std; int main(){ int a[3][3]; int n; int b[10]; int i=0; int j=0; int k=0; int l=0; 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[i]; } for(k=0;k<n;k++){ for(i=0;i<3;i++){ for(j=0;j<3;j++){ if(b[k]==a[i][j])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.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(); } } ...
JAVA
p02760 AtCoder Beginner Contest 157 - Bingo
We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}. The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet. Determine whether we will have a bi...
6
0
#include<iostream> using namespace std; int main(){ int a[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(a[j]==b[i])a[j]=0; } } if((a[0]==0&&a[1]==0&&a[2]==0)||(a[3]==0&&a[4]==0&&a[5]==0)||(a[6]==0&&a[7]==...
CPP