Submission #36414352
Source Code Expand
import java.io.*;
import java.util.*;
public class Main {
static FastScanner sc = new FastScanner();
static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
static void solve(){
int n = sc.nextInt();
HashSet<String>set = new HashSet<>();
List<String>list = new ArrayList<>();
for(int i = 0;i < n;i++){
String str = sc.next();
list.add(str);
set.add(str);
}
if(set.size() != n){
System.out.println("No");
return;
}
char[]f = new char[]{'H','D','C','S'};
char[]s = new char[]{'A','T','J','Q','K'};
for(int i = 0;i < n;i++){
boolean first = false;
boolean second = false;
for(char c : f){
if(list.get(i).charAt(0) == c){
first = true;
}
}
for(char c : s){
if(list.get(i).charAt(1) == c){
second = true;
}
}
for(int j = 2;j <= 9;j++){
if(list.get(i).charAt(1) - '0' == j){
second = true;
}
}
if(!first || ! second){
System.out.println("No");
return;
}
}
System.out.println("Yes");
}
public static void main(String[] args) {
int n = 1;
//n = sc.nextInt();
for(int i = 0;i < n;i++){
solve();
}
}
static class FastScanner {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st=new StringTokenizer("");
String next() {
while (!st.hasMoreTokens())
try {
st=new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
int[] readArray(int n) {
int[] a=new int[n];
for (int i=0; i<n; i++) a[i]=nextInt();
return a;
}
long nextLong() {
return Long.parseLong(next());
}
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - Playing Cards Validation |
| User | liuji |
| Language | Java (OpenJDK 11.0.6) |
| Score | 200 |
| Code Size | 2414 Byte |
| Status | AC |
| Exec Time | 74 ms |
| Memory | 32972 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 200 / 200 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example0.txt, example1.txt, example2.txt, example3.txt |
| All | example0.txt, example1.txt, example2.txt, example3.txt, max0.txt, random0.txt, random1.txt, random10.txt, random11.txt, random12.txt, random13.txt, random2.txt, random3.txt, random4.txt, random5.txt, random6.txt, random7.txt, random8.txt, random9.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| example0.txt | AC | 74 ms | 32896 KiB |
| example1.txt | AC | 63 ms | 32400 KiB |
| example2.txt | AC | 67 ms | 32156 KiB |
| example3.txt | AC | 66 ms | 32436 KiB |
| max0.txt | AC | 63 ms | 32536 KiB |
| random0.txt | AC | 70 ms | 32424 KiB |
| random1.txt | AC | 70 ms | 32924 KiB |
| random10.txt | AC | 60 ms | 32112 KiB |
| random11.txt | AC | 68 ms | 32908 KiB |
| random12.txt | AC | 71 ms | 32972 KiB |
| random13.txt | AC | 66 ms | 32520 KiB |
| random2.txt | AC | 71 ms | 32896 KiB |
| random3.txt | AC | 71 ms | 32912 KiB |
| random4.txt | AC | 67 ms | 32664 KiB |
| random5.txt | AC | 64 ms | 32504 KiB |
| random6.txt | AC | 68 ms | 32872 KiB |
| random7.txt | AC | 71 ms | 32748 KiB |
| random8.txt | AC | 59 ms | 31996 KiB |
| random9.txt | AC | 65 ms | 32044 KiB |