QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#575445#9320. Find the Easiest Problem1091857051WA 164ms62064kbJava82.0kb2024-09-19 14:23:232024-09-19 14:23:23

Judging History

你现在查看的是最新测评结果

  • [2024-09-19 14:23:23]
  • 评测
  • 测评结果:WA
  • 用时:164ms
  • 内存:62064kb
  • [2024-09-19 14:23:23]
  • 提交

answer

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.nio.Buffer;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.StringTokenizer;

public class Main {
	static kattio sc=new kattio();
	static PrintWriter out=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	public static void main(String[] args) {
		int t=sc.nextint();
		while (t-->0) {
			sovle();
		}
		out.close();
	}
	static void sovle(){
		int n=sc.nextint();
		Map<String, Set<String>>map=new HashMap<>();
		for (int i = 0; i < n; i++) {
			String s1=sc.next();
			String s2=sc.next();
			String s3=sc.next();
			if (s3.charAt(0)=='a') {
				if (!map.containsKey(s2)) {
					map.put(s2, new HashSet<>());
				}
				map.get(s2).add(s1);
			}
		}
		int max=0;String ans="";
		for (Entry<String, Set<String>> i : map.entrySet()) {
			if (i.getValue().size()>max) {
				max=i.getValue().size();
				ans=i.getKey();
			}
		}
		out.println(ans);
	}
}
class kattio extends PrintWriter{
	private BufferedReader b;
	private StringTokenizer st;
	public kattio(){this(System.in,System.out);}
	public kattio(InputStream i,OutputStream o){
		super(o);
		b=new BufferedReader(new InputStreamReader(i));
	}
	public kattio(String i,String o) throws IOException{
		super(o);
		b=new BufferedReader(new FileReader(i));
	}
	public String next(){
		try {
			while (st==null||!st.hasMoreElements()) {
				st=new StringTokenizer(b.readLine());
			}
			return st.nextToken();
		} catch (Exception e) {
			return null;
			// TODO: handle exception
		}
	}
	public int nextint(){return Integer.parseInt(next());}
	public long nextlong(){return Long.parseLong(next());}
}

詳細信息

Test #1:

score: 100
Accepted
time: 32ms
memory: 38016kb

input:

2
5
teamA A accepted
teamB B rejected
teamC A accepted
teamB B accepted
teamD C accepted
4
teamA A rejected
teamB A accepted
teamC B accepted
teamC B accepted

output:

A
A

result:

ok 2 lines

Test #2:

score: -100
Wrong Answer
time: 164ms
memory: 62064kb

input:

1000
44
WaiooyIXa O accepted
WaiooyIXa P accepted
ZYYsNWag P accepted
DPIawQg D rejected
IzPdjnM Z rejected
Ra D rejected
kwQyGxLo I rejected
DPIawQg L accepted
kwQyGxLo I accepted
mmWxDuADCB D rejected
PXwVAOgwiz P rejected
ZYYsNWag U accepted
IzPdjnM Z accepted
TgBNO P rejected
kwQyGxLo J accepted...

output:

Z
P
Z
I
B
I
G
H
S
K
J
I
H
R
Z
C
K
O
Q
P
A
B
I
A
A
N
A
B
Q
O
F
O
R
T
H
G
K
E
S
D
F
D
R
C
U
V
W
P
A
O
P
E
A
B
U
M
C
T
L
G
V
A
Z
N
E
O
Q
F
B
G
J
I
E
M
A
A
S
A
K
W
J
S
E
W
Z
K
F
I
S
P
M
Q
G
G
H
W
I
P
T
D
O
A
F
N
C
S
Y
Z
S
G
J
F
Q
F
O
C
B
B
U
C
I
A
E
I
P
K
C
R
X
V
D
N
L
Q
L
I
X
I
H
U
J
Z
D
K
G
F
T
F
B
R
...

result:

wrong answer 2nd lines differ - expected: 'E', found: 'P'