QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#574216 | #9320. Find the Easiest Problem | daring | WA | 521ms | 90928kb | Java11 | 1.0kb | 2024-09-18 21:06:57 | 2024-09-18 21:06:57 |
Judging History
answer
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int t = scanner.nextInt();
while (t-- > 0) {
solve(scanner);
}
scanner.close();
}
private static void solve(Scanner scanner) {
int n = scanner.nextInt();
Map<String, Set<String>> mp = new HashMap<>();
for (int i = 0; i < n; i++) {
String a = scanner.next();
String b = scanner.next();
String c = scanner.next();
if (c.charAt(0) == 'a') {
mp.computeIfAbsent(b, k -> new HashSet<>()).add(a);
}
}
String ans = "";
int mx = 0;
for (Map.Entry<String, Set<String>> entry : mp.entrySet()) {
if (entry.getValue().size() > mx) {
mx = entry.getValue().size();
ans = entry.getKey();
}
}
System.out.println(ans);
}
}
详细
Test #1:
score: 100
Accepted
time: 87ms
memory: 53612kb
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: 521ms
memory: 90928kb
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 Q A 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'